hotspot/src/cpu/sparc/vm/interpreterRT_sparc.cpp
author jrose
Fri, 20 Mar 2009 23:19:36 -0700
changeset 2332 5c7b6f4ce0a1
parent 1 489c9b5090e2
child 2571 d602ad6538bd
permissions -rw-r--r--
6814659: separable cleanups and subroutines for 6655638 Summary: preparatory but separable changes for method handles Reviewed-by: kvn, never
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
489c9b5090e2 Initial load
duke
parents:
diff changeset
     2
 * Copyright 1998-2006 Sun Microsystems, Inc.  All Rights Reserved.
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_sparc.cpp.incl"
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
#define __ _masm->
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// Implementation of SignatureHandlerGenerator
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
void InterpreterRuntime::SignatureHandlerGenerator::pass_word(int size_of_arg, int offset_in_arg) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  Argument  jni_arg(jni_offset() + offset_in_arg, false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  Register     Rtmp = O0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  __ store_argument(Rtmp, jni_arg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  Argument  jni_arg(jni_offset(), false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  Register  Rtmp = O0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  if (TaggedStackInterpreter) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    // check at least one tag is okay
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    Label ok;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    __ ld_ptr(Llocals, Interpreter::local_tag_offset_in_bytes(offset() + 1), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    __ cmp(Rtmp, G0);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
    __ brx(Assembler::equal, false, Assembler::pt, ok);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
    __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
    __ stop("Native object has bad tag value");
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
    __ bind(ok);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
  __ ldx(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  __ store_long_argument(Rtmp, jni_arg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
  __ store_argument(Rtmp, jni_arg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 0), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
  Argument successor(jni_arg.successor());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  __ store_argument(Rtmp, successor);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
  Argument  jni_arg(jni_offset(), false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  FloatRegister  Rtmp = F0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  __ ldf(FloatRegisterImpl::S, Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  __ store_float_argument(Rtmp, jni_arg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  Argument  jni_arg(jni_offset(), false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  FloatRegister  Rtmp = F0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  __ ldf(FloatRegisterImpl::D, Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  __ store_double_argument(Rtmp, jni_arg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  Register  Rtmp = O0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  __ store_argument(Rtmp, jni_arg);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
  __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  Argument successor(jni_arg.successor());
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  __ store_argument(Rtmp, successor);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
#endif
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  Argument  jni_arg(jni_offset(), false);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
  Argument java_arg(    offset(), true);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  Register    Rtmp1 = O0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
  Register    Rtmp2 =  jni_arg.is_register() ?  jni_arg.as_register() : O0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  Register    Rtmp3 =  G3_scratch;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  // the handle for a receiver will never be null
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
  bool do_NULL_check = offset() != 0 || is_static();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
  Address     h_arg = Address(Llocals, 0, Interpreter::local_offset_in_bytes(offset()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  __ ld_ptr(h_arg, Rtmp1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
  if (TaggedStackInterpreter) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
    // check we have the obj and not the tag
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
    Label ok;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
    __ mov(frame::TagReference, Rtmp3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    __ cmp(Rtmp1, Rtmp3);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
    __ brx(Assembler::notEqual, true, Assembler::pt, ok);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    __ delayed()->nop();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    __ stop("Native object passed tag by mistake");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    __ bind(ok);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  if (!do_NULL_check) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    __ add(h_arg, Rtmp2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  } else {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    if (Rtmp1 == Rtmp2)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
          __ tst(Rtmp1);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    else  __ addcc(G0, Rtmp1, Rtmp2); // optimize mov/test pair
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    Label L;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    __ brx(Assembler::notZero, true, Assembler::pt, L);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    __ delayed()->add(h_arg, Rtmp2);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    __ bind(L);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  __ store_ptr_argument(Rtmp2, jni_arg);    // this is often a no-op
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  // generate code to handle arguments
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  iterate(fingerprint);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
  // return result handler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  Address result_handler(Lscratch, Interpreter::result_handler(method()->result_type()));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  __ sethi(result_handler);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
  __ retl();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  __ delayed()->add(result_handler, result_handler.base());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  __ flush();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
// Implementation of SignatureHandlerLibrary
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
void SignatureHandlerLibrary::pd_set_handler(address handler) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
489c9b5090e2 Initial load
duke
parents:
diff changeset
   156
489c9b5090e2 Initial load
duke
parents:
diff changeset
   157
class SlowSignatureHandler: public NativeSignatureIterator {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   158
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  address   _from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  intptr_t* _to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
  intptr_t* _RegArgSignature;                   // Signature of first Arguments to be passed in Registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  uint      _argcount;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  enum {                                        // We need to differenciate float from non floats in reg args
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
    non_float  = 0,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
    float_sig  = 1,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
    double_sig = 2,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
    long_sig   = 3
489c9b5090e2 Initial load
duke
parents:
diff changeset
   169
  };
489c9b5090e2 Initial load
duke
parents:
diff changeset
   170
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
#ifdef ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   172
  void verify_tag(frame::Tag t) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
    assert(!TaggedStackInterpreter ||
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
           *(intptr_t*)(_from+Interpreter::local_tag_offset_in_bytes(0)) == t, "wrong tag");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
#endif // ASSERT
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
  virtual void pass_int() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
    *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   180
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
    add_signature( non_float );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
  virtual void pass_object() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
    // pass address of from
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
    intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
    *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
    debug_only(verify_tag(frame::TagReference));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
    add_signature( non_float );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
#ifdef _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
  virtual void pass_float()  {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
    *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
    _from -= Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
    add_signature( float_sig );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
  virtual void pass_double() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
    *_to++ = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
    _from -= 2*Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
   add_signature( double_sig );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  virtual void pass_long() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
    _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
    _to += 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
    _from -= 2*Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
    add_signature( long_sig );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
#else
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
   // pass_double() is pass_long() and pass_float() only _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
  virtual void pass_long() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
    _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
    _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
    debug_only(verify_tag(frame::TagValue));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
    _to += 2;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
    _from -= 2*Interpreter::stackElementSize();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
    add_signature( non_float );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
#endif // _LP64
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  virtual void add_signature( intptr_t sig_type ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
    if ( _argcount < (sizeof (intptr_t))*4 ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
      *_RegArgSignature |= (sig_type << (_argcount*2) );
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
      _argcount++;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
  SlowSignatureHandler(methodHandle method, address from, intptr_t* to, intptr_t *RegArgSig) : NativeSignatureIterator(method) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
    _from = from;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
    _to   = to;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
    _RegArgSignature = RegArgSig;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
    *_RegArgSignature = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
    _argcount = method->is_static() ? 2 : 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler(
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
                                                    JavaThread* thread,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
                                                    methodOopDesc* method,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
                                                    intptr_t* from,
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
                                                    intptr_t* to ))
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  methodHandle m(thread, method);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
  assert(m->is_native(), "sanity check");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  // handle arguments
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
  // Warning: We use reg arg slot 00 temporarily to return the RegArgSignature
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  // back to the code that pops the arguments into the CPU registers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  SlowSignatureHandler(m, (address)from, m->is_static() ? to+2 : to+1, to).iterate(UCONST64(-1));
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
  // return result handler
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
  return Interpreter::result_handler(m->result_type());
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
IRT_END