src/hotspot/cpu/x86/interpreterRT_x86_64.cpp
author coleenp
Fri, 12 Apr 2019 09:30:17 -0400
changeset 54523 5df03f58d25b
parent 49480 d7df2dd501ce
child 54786 ebf733a324d4
permissions -rw-r--r--
8222297: IRT_ENTRY/IRT_LEAF etc are the same as JRT Summary: Replace IRT entry points with JRT. Reviewed-by: lfoltan, dcubed
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
54523
5df03f58d25b 8222297: IRT_ENTRY/IRT_LEAF etc are the same as JRT
coleenp
parents: 49480
diff changeset
     2
 * Copyright (c) 2003, 2019, Oracle and/or its affiliates. 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
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5419
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5419
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 5419
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    26
#include "interpreter/interp_masm.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "interpreter/interpreter.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "interpreter/interpreterRuntime.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "memory/allocation.inline.hpp"
49359
59f6547e151f 8199264: Remove universe.inline.hpp to simplify include dependencies
stefank
parents: 49168
diff changeset
    30
#include "memory/universe.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    31
#include "oops/method.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "oops/oop.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    33
#include "runtime/handles.inline.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    34
#include "runtime/icache.hpp"
49449
ef5d5d343e2a 8199263: Split interfaceSupport.hpp to not require including .inline.hpp files
coleenp
parents: 49359
diff changeset
    35
#include "runtime/interfaceSupport.inline.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    36
#include "runtime/signature.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
#define __ _masm->
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
// Implementation of SignatureHandlerGenerator
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
49480
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    42
InterpreterRuntime::SignatureHandlerGenerator::SignatureHandlerGenerator(const methodHandle& method, CodeBuffer* buffer) :
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    43
    NativeSignatureIterator(method) {
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    44
  _masm = new MacroAssembler(buffer);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    45
#ifdef AMD64
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    46
#ifdef _WIN64
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    47
  _num_args = (method->is_static() ? 1 : 0);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    48
  _stack_offset = (Argument::n_int_register_parameters_c+1)* wordSize; // don't overwrite return address
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    49
#else
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    50
  _num_int_args = (method->is_static() ? 1 : 0);
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    51
  _num_fp_args = 0;
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    52
  _stack_offset = wordSize; // don't overwrite return address
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    53
#endif // _WIN64
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    54
#endif // AMD64
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    55
}
d7df2dd501ce 8199809: Don't include frame.inline.hpp and other.inline.hpp from .hpp files
coleenp
parents: 49449
diff changeset
    56
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
Register InterpreterRuntime::SignatureHandlerGenerator::from() { return r14; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
Register InterpreterRuntime::SignatureHandlerGenerator::to()   { return rsp; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
Register InterpreterRuntime::SignatureHandlerGenerator::temp() { return rscratch1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
void InterpreterRuntime::SignatureHandlerGenerator::pass_int() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
  const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  switch (_num_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
    __ movl(c_rarg1, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
  case 1:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    __ movl(c_rarg2, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  case 2:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
    __ movl(c_rarg3, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
    __ movl(rax, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
    __ movl(Address(to(), _stack_offset), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  switch (_num_int_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
    __ movl(c_rarg1, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  case 1:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
    __ movl(c_rarg2, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  case 2:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
    __ movl(c_rarg3, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
  case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
    __ movl(c_rarg4, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  case 4:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
    __ movl(c_rarg5, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  default:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
    __ movl(rax, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
    __ movl(Address(to(), _stack_offset), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  const Address src(from(), Interpreter::local_offset_in_bytes(offset() + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  switch (_num_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  case 0:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   121
    __ movptr(c_rarg1, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  case 1:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   125
    __ movptr(c_rarg2, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  case 2:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   129
    __ movptr(c_rarg3, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  case 3:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  default:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   134
    __ movptr(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   135
    __ movptr(Address(to(), _stack_offset), rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  switch (_num_int_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  case 0:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   142
    __ movptr(c_rarg1, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  case 1:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   146
    __ movptr(c_rarg2, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  case 2:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   150
    __ movptr(c_rarg3, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  case 3:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   154
    __ movptr(c_rarg4, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
  case 4:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   158
    __ movptr(c_rarg5, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  default:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   162
    __ movptr(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   163
    __ movptr(Address(to(), _stack_offset), rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
  if (_num_args < Argument::n_float_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
    __ movflt(as_XMMRegister(++_num_args), src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
    __ movl(rax, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
    __ movl(Address(to(), _stack_offset), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
  if (_num_fp_args < Argument::n_float_register_parameters_c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
    __ movflt(as_XMMRegister(_num_fp_args++), src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
    __ movl(rax, src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    __ movl(Address(to(), _stack_offset), rax);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
  const Address src(from(), Interpreter::local_offset_in_bytes(offset() + 1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  if (_num_args < Argument::n_float_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    __ movdbl(as_XMMRegister(++_num_args), src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   199
    __ movptr(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   200
    __ movptr(Address(to(), _stack_offset), rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
  if (_num_fp_args < Argument::n_float_register_parameters_c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
    __ movdbl(as_XMMRegister(_num_fp_args++), src);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  } else {
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   207
    __ movptr(rax, src);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   208
    __ movptr(Address(to(), _stack_offset), rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  const Address src(from(), Interpreter::local_offset_in_bytes(offset()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  switch (_num_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    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
   221
    __ lea(c_rarg1, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  case 1:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   225
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    __ xorl(c_rarg2, c_rarg2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   227
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   228
    __ cmov(Assembler::notEqual, c_rarg2, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  case 2:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   232
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
    __ xorl(c_rarg3, c_rarg3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   234
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   235
    __ cmov(Assembler::notEqual, c_rarg3, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
    _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
  default:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   239
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
    __ xorl(temp(), temp());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   241
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   242
    __ cmov(Assembler::notEqual, temp(), rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   243
    __ movptr(Address(to(), _stack_offset), temp());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
  switch (_num_int_args) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  case 0:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
    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
   251
    __ lea(c_rarg1, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  case 1:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   255
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
    __ xorl(c_rarg2, c_rarg2);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   257
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   258
    __ cmov(Assembler::notEqual, c_rarg2, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
  case 2:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   262
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
    __ xorl(c_rarg3, c_rarg3);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   264
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   265
    __ cmov(Assembler::notEqual, c_rarg3, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
  case 3:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   269
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
    __ xorl(c_rarg4, c_rarg4);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   271
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   272
    __ cmov(Assembler::notEqual, c_rarg4, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
  case 4:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   276
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
    __ xorl(c_rarg5, c_rarg5);
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   278
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   279
    __ cmov(Assembler::notEqual, c_rarg5, rax);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
    _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
  default:
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   283
    __ lea(rax, src);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
    __ xorl(temp(), temp());
1066
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   285
    __ cmpptr(src, 0);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   286
    __ cmov(Assembler::notEqual, temp(), rax);
717c3345024f 5108146: Merge i486 and amd64 cpu directories
never
parents: 1
diff changeset
   287
    __ movptr(Address(to(), _stack_offset), temp());
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
    _stack_offset += wordSize;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
    break;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
  // generate code to handle arguments
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
  iterate(fingerprint);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
  // return result handler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
  __ lea(rax, ExternalAddress(Interpreter::result_handler(method()->result_type())));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  __ ret(0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  __ flush();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
// Implementation of SignatureHandlerLibrary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
void SignatureHandlerLibrary::pd_set_handler(address handler) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
#ifdef _WIN64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
class SlowSignatureHandler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  : public NativeSignatureIterator {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  address   _from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   316
  intptr_t* _to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   317
  intptr_t* _reg_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  intptr_t* _fp_identifiers;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  unsigned int _num_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
  virtual void pass_int()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
    jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   324
    _from -= Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
    if (_num_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
      *_reg_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
      _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  virtual void pass_long()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   335
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
    intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   337
    _from -= 2*Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
    if (_num_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
      *_reg_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
      _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  virtual void pass_object()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
    intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   350
    _from -= Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
    if (_num_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
      *_reg_args++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
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_addr == 0) ? NULL : (intptr_t) from_addr;
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_float()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   360
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   361
    jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   362
    _from -= Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   363
489c9b5090e2 Initial load
duke
parents:
diff changeset
   364
    if (_num_args < Argument::n_float_register_parameters_c-1) {
49168
23348e42fb34 8197864: VS2017 (C4334) Result of 32-bit Shift Implicitly Converted to 64 bits
lfoltan
parents: 47216
diff changeset
   365
      assert((_num_args*2) < BitsPerWord, "_num_args*2 is out of range");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   366
      *_reg_args++ = from_obj;
49168
23348e42fb34 8197864: VS2017 (C4334) Result of 32-bit Shift Implicitly Converted to 64 bits
lfoltan
parents: 47216
diff changeset
   367
      *_fp_identifiers |= ((intptr_t)0x01 << (_num_args*2)); // mark as float
1
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
  virtual void pass_double()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
    intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   377
    _from -= 2*Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
    if (_num_args < Argument::n_float_register_parameters_c-1) {
49168
23348e42fb34 8197864: VS2017 (C4334) Result of 32-bit Shift Implicitly Converted to 64 bits
lfoltan
parents: 47216
diff changeset
   380
      assert((_num_args*2) < BitsPerWord, "_num_args*2 is out of range");
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
      *_reg_args++ = from_obj;
49168
23348e42fb34 8197864: VS2017 (C4334) Result of 32-bit Shift Implicitly Converted to 64 bits
lfoltan
parents: 47216
diff changeset
   382
      *_fp_identifiers |= ((intptr_t)0x3 << (_num_args*2)); // mark as double
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
      _num_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
 public:
46727
6e4a84748e2c 8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents: 27471
diff changeset
   390
  SlowSignatureHandler(const methodHandle& method, address from, intptr_t* to)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
    : NativeSignatureIterator(method)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   393
    _from = from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
    _to   = to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
    _reg_args = to - (method->is_static() ? 4 : 5);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   397
    _fp_identifiers = to - 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   398
    _to = _to + 4;  // Windows reserves stack space for register arguments
489c9b5090e2 Initial load
duke
parents:
diff changeset
   399
    *(int*) _fp_identifiers = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   400
    _num_args = (method->is_static() ? 1 : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   401
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   402
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   403
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   404
class SlowSignatureHandler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   405
  : public NativeSignatureIterator {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   406
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   407
  address   _from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   408
  intptr_t* _to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   409
  intptr_t* _int_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   410
  intptr_t* _fp_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
  intptr_t* _fp_identifiers;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  unsigned int _num_int_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
  unsigned int _num_fp_args;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
  virtual void pass_int()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
    jint from_obj = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   418
    _from -= Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
    if (_num_int_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
      *_int_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
      _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   427
489c9b5090e2 Initial load
duke
parents:
diff changeset
   428
  virtual void pass_long()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
    intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   431
    _from -= 2*Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   432
489c9b5090e2 Initial load
duke
parents:
diff changeset
   433
    if (_num_int_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   434
      *_int_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   435
      _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   436
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   437
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   438
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   439
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   440
489c9b5090e2 Initial load
duke
parents:
diff changeset
   441
  virtual void pass_object()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   442
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   443
    intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   444
    _from -= Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   445
489c9b5090e2 Initial load
duke
parents:
diff changeset
   446
    if (_num_int_args < Argument::n_int_register_parameters_c-1) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   447
      *_int_args++ = (*from_addr == 0) ? NULL : (intptr_t)from_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   448
      _num_int_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   449
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   450
      *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   451
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   452
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   453
489c9b5090e2 Initial load
duke
parents:
diff changeset
   454
  virtual void pass_float()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   455
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   456
    jint from_obj = *(jint*)(_from+Interpreter::local_offset_in_bytes(0));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   457
    _from -= Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   458
489c9b5090e2 Initial load
duke
parents:
diff changeset
   459
    if (_num_fp_args < Argument::n_float_register_parameters_c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   460
      *_fp_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   461
      _num_fp_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   462
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   463
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   464
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   465
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   466
489c9b5090e2 Initial load
duke
parents:
diff changeset
   467
  virtual void pass_double()
489c9b5090e2 Initial load
duke
parents:
diff changeset
   468
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   469
    intptr_t from_obj = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
5419
f2e8cc8c12ea 6943304: remove tagged stack interpreter
twisti
parents: 3261
diff changeset
   470
    _from -= 2*Interpreter::stackElementSize;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   471
489c9b5090e2 Initial load
duke
parents:
diff changeset
   472
    if (_num_fp_args < Argument::n_float_register_parameters_c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   473
      *_fp_args++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   474
      *_fp_identifiers |= (1 << _num_fp_args); // mark as double
489c9b5090e2 Initial load
duke
parents:
diff changeset
   475
      _num_fp_args++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
    } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
      *_to++ = from_obj;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
 public:
46727
6e4a84748e2c 8183039: Re-examine methodHandle methods uninlined by 8144256
coleenp
parents: 27471
diff changeset
   482
  SlowSignatureHandler(const methodHandle& method, address from, intptr_t* to)
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
    : NativeSignatureIterator(method)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
    _from = from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
    _to   = to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
    _int_args = to - (method->is_static() ? 14 : 15);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
    _fp_args =  to - 9;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
    _fp_identifiers = to - 10;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
    *(int*) _fp_identifiers = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
    _num_int_args = (method->is_static() ? 1 : 0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
    _num_fp_args = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
54523
5df03f58d25b 8222297: IRT_ENTRY/IRT_LEAF etc are the same as JRT
coleenp
parents: 49480
diff changeset
   499
JRT_ENTRY(address,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
          InterpreterRuntime::slow_signature_handler(JavaThread* thread,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   501
                                                     Method* method,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
                                                     intptr_t* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
                                                     intptr_t* to))
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
   504
  methodHandle m(thread, (Method*)method);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
  assert(m->is_native(), "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
  // handle arguments
27471
6e56277909f1 8062370: Various minor code improvements
goetz
parents: 13728
diff changeset
   508
  SlowSignatureHandler(m, (address)from, to + 1).iterate((uint64_t)CONST64(-1));
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
  // return result handler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
  return Interpreter::result_handler(m->result_type());
54523
5df03f58d25b 8222297: IRT_ENTRY/IRT_LEAF etc are the same as JRT
coleenp
parents: 49480
diff changeset
   512
JRT_END