hotspot/src/cpu/x86/vm/interpreterRT_x86_64.cpp
author trims
Thu, 12 Mar 2009 18:16:36 -0700
changeset 2154 72a9b7284ccf
parent 1217 5eb97f366a6a
child 2257 d8e6e11e7f32
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
1217
5eb97f366a6a 6754988: Update copyright year
xdono
parents: 1066
diff changeset
     2
 * Copyright 2003-2008 Sun Microsystems, Inc.  All Rights Reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    19
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    20
 * CA 95054 USA or visit www.sun.com if you need additional information or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    21
 * have any questions.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
489c9b5090e2 Initial load
duke
parents:
diff changeset
    25
#include "incls/_precompiled.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
#include "incls/_interpreterRT_x86_64.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
#define __ _masm->
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
// Implementation of SignatureHandlerGenerator
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
Register InterpreterRuntime::SignatureHandlerGenerator::from() { return r14; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
Register InterpreterRuntime::SignatureHandlerGenerator::to()   { return rsp; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
Register InterpreterRuntime::SignatureHandlerGenerator::temp() { return rscratch1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
void InterpreterRuntime::SignatureHandlerGenerator::pass_int() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  switch (_num_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
    __ movl(c_rarg1, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  case 1:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
    __ movl(c_rarg2, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  case 2:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    __ movl(c_rarg3, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
    __ movl(rax, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    __ movl(Address(to(), _stack_offset), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  switch (_num_int_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    __ movl(c_rarg1, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  case 1:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    __ movl(c_rarg2, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  case 2:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    __ movl(c_rarg3, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    __ movl(c_rarg4, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  case 4:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    __ movl(c_rarg5, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    __ movl(rax, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
    __ movl(Address(to(), _stack_offset), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  const Address src(from(), Interpreter::local_offset_in_bytes(offset() + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  switch (_num_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  case 0:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
    96
    __ movptr(c_rarg1, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  case 1:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   100
    __ movptr(c_rarg2, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  case 2:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   104
    __ movptr(c_rarg3, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  default:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   109
    __ movptr(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   110
    __ movptr(Address(to(), _stack_offset), rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  switch (_num_int_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  case 0:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   117
    __ movptr(c_rarg1, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  case 1:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   121
    __ movptr(c_rarg2, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  case 2:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   125
    __ movptr(c_rarg3, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  case 3:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   129
    __ movptr(c_rarg4, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  case 4:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   133
    __ movptr(c_rarg5, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  default:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   137
    __ movptr(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   138
    __ movptr(Address(to(), _stack_offset), rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  if (_num_args < Argument::n_float_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
    __ movflt(as_XMMRegister(++_num_args), src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    __ movl(rax, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
    __ movl(Address(to(), _stack_offset), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  if (_num_fp_args < Argument::n_float_register_parameters_c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
    __ movflt(as_XMMRegister(_num_fp_args++), src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    __ movl(rax, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
    __ movl(Address(to(), _stack_offset), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  const Address src(from(), Interpreter::local_offset_in_bytes(offset() + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  if (_num_args < Argument::n_float_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
    __ movdbl(as_XMMRegister(++_num_args), src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   174
    __ movptr(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   175
    __ movptr(Address(to(), _stack_offset), rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  if (_num_fp_args < Argument::n_float_register_parameters_c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    __ movdbl(as_XMMRegister(_num_fp_args++), src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
  } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   182
    __ movptr(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   183
    __ movptr(Address(to(), _stack_offset), rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  switch (_num_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
    assert(offset() == 0, "argument register 1 can only be (non-null) receiver");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   196
    __ lea(c_rarg1, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  case 1:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   200
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    __ xorl(c_rarg2, c_rarg2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   202
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   203
    __ cmov(Assembler::notEqual, c_rarg2, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  case 2:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   207
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
    __ xorl(c_rarg3, c_rarg3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   209
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   210
    __ cmov(Assembler::notEqual, c_rarg3, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  default:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   214
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
    __ xorl(temp(), temp());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   216
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   217
    __ cmov(Assembler::notEqual, temp(), rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   218
    __ movptr(Address(to(), _stack_offset), temp());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
  switch (_num_int_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    assert(offset() == 0, "argument register 1 can only be (non-null) receiver");
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   226
    __ lea(c_rarg1, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
  case 1:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   230
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
    __ xorl(c_rarg2, c_rarg2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   232
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   233
    __ cmov(Assembler::notEqual, c_rarg2, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
  case 2:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   237
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    __ xorl(c_rarg3, c_rarg3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   239
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   240
    __ cmov(Assembler::notEqual, c_rarg3, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  case 3:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   244
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    __ xorl(c_rarg4, c_rarg4);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   246
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   247
    __ cmov(Assembler::notEqual, c_rarg4, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
  case 4:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   251
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    __ xorl(c_rarg5, c_rarg5);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   253
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   254
    __ cmov(Assembler::notEqual, c_rarg5, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  default:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   258
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
    __ xorl(temp(), temp());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   260
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   261
    __ cmov(Assembler::notEqual, temp(), rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   262
    __ movptr(Address(to(), _stack_offset), temp());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
  // generate code to handle arguments
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
  iterate(fingerprint);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  // return result handler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
  __ lea(rax, ExternalAddress(Interpreter::result_handler(method()->result_type())));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  __ ret(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
  __ flush();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
// Implementation of SignatureHandlerLibrary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
void SignatureHandlerLibrary::pd_set_handler(address handler) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
class SlowSignatureHandler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  : public NativeSignatureIterator {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  address   _from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  intptr_t* _to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
  intptr_t* _reg_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
  intptr_t* _fp_identifiers;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
  unsigned int _num_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  void verify_tag(frame::Tag t) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
    assert(!TaggedStackInterpreter ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
           *(intptr_t*)(_from+Interpreter::local_tag_offset_in_bytes(0)) == t, "wrong tag");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
  virtual void pass_int()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
    jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
    if (_num_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
      *_reg_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
      _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  virtual void pass_long()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
    intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
    _from -= 2*Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
    if (_num_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
      *_reg_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
      _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
  virtual void pass_object()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
    intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
    debug_only(verify_tag(frame::TagReference));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    if (_num_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
      *_reg_args++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
      _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
      *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
  virtual void pass_float()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
    jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
    if (_num_args < Argument::n_float_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
      *_reg_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
      *_fp_identifiers |= (0x01 << (_num_args*2)); // mark as float
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
      _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   357
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
  virtual void pass_double()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
    intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   362
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
    _from -= 2*Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
489c9b5090e2 Initial load
duke
parents:
diff changeset
   365
    if (_num_args < Argument::n_float_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
      *_reg_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   367
      *_fp_identifiers |= (0x3 << (_num_args*2)); // mark as double
489c9b5090e2 Initial load
duke
parents:
diff changeset
   368
      _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   369
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   370
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   371
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   372
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   373
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  SlowSignatureHandler(methodHandle method, address from, intptr_t* to)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
    : NativeSignatureIterator(method)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
    _from = from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
    _to   = to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
    _reg_args = to - (method->is_static() ? 4 : 5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
    _fp_identifiers = to - 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
    _to = _to + 4;  // Windows reserves stack space for register arguments
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    *(int*) _fp_identifiers = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
    _num_args = (method->is_static() ? 1 : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
class SlowSignatureHandler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
  : public NativeSignatureIterator {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  address   _from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
  intptr_t* _to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
  intptr_t* _int_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
  intptr_t* _fp_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
  intptr_t* _fp_identifiers;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
  unsigned int _num_int_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
  unsigned int _num_fp_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
  void verify_tag(frame::Tag t) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
    assert(!TaggedStackInterpreter ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
           *(intptr_t*)(_from+Interpreter::local_tag_offset_in_bytes(0)) == t, "wrong tag");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
  virtual void pass_int()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
    jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
    if (_num_int_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
      *_int_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
      _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
  virtual void pass_long()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
    intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
    _from -= 2*Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
    if (_num_int_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
      *_int_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
      _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
  virtual void pass_object()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
    intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
    debug_only(verify_tag(frame::TagReference));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
    if (_num_int_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
      *_int_args++ = (*from_addr == 0) ? NULL : (intptr_t)from_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
      _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   444
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
      *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
  virtual void pass_float()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
    jint from_obj = *(jint*)(_from+Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
    if (_num_fp_args < Argument::n_float_register_parameters_c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
      *_fp_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   457
      _num_fp_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
  virtual void pass_double()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
    intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
    _from -= 2*Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
    if (_num_fp_args < Argument::n_float_register_parameters_c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
      *_fp_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   470
      *_fp_identifiers |= (1 << _num_fp_args); // mark as double
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
      _num_fp_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  SlowSignatureHandler(methodHandle method, address from, intptr_t* to)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
    : NativeSignatureIterator(method)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
    _from = from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
    _to   = to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
    _int_args = to - (method->is_static() ? 14 : 15);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
    _fp_args =  to - 9;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
    _fp_identifiers = to - 10;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
    *(int*) _fp_identifiers = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
    _num_int_args = (method->is_static() ? 1 : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
    _num_fp_args = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
IRT_ENTRY(address,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
          InterpreterRuntime::slow_signature_handler(JavaThread* thread,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
                                                     methodOopDesc* method,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
                                                     intptr_t* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
                                                     intptr_t* to))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
  methodHandle m(thread, (methodOop)method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
  assert(m->is_native(), "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
  // handle arguments
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
  SlowSignatureHandler(m, (address)from, to + 1).iterate(UCONST64(-1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  // return result handler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
  return Interpreter::result_handler(m->result_type());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
IRT_END