< prev index next >

src/cpu/sparc/vm/interpreterRT_sparc.cpp

Print this page




  36 #include "runtime/signature.hpp"
  37 
  38 
  39 #define __ _masm->
  40 
  41 
  42 // Implementation of SignatureHandlerGenerator
  43 
  44 void InterpreterRuntime::SignatureHandlerGenerator::pass_word(int size_of_arg, int offset_in_arg) {
  45   Argument  jni_arg(jni_offset() + offset_in_arg, false);
  46   Register     Rtmp = O0;
  47   __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
  48 
  49   __ store_argument(Rtmp, jni_arg);
  50 }
  51 
  52 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
  53   Argument  jni_arg(jni_offset(), false);
  54   Register  Rtmp = O0;
  55 
  56 #ifdef _LP64
  57   __ ldx(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
  58   __ store_long_argument(Rtmp, jni_arg);
  59 #else
  60   __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
  61   __ store_argument(Rtmp, jni_arg);
  62   __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 0), Rtmp);
  63   Argument successor(jni_arg.successor());
  64   __ store_argument(Rtmp, successor);
  65 #endif
  66 }
  67 
  68 
  69 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
  70   Argument  jni_arg(jni_offset(), false);
  71 #ifdef _LP64
  72   FloatRegister  Rtmp = F0;
  73   __ ldf(FloatRegisterImpl::S, Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
  74   __ store_float_argument(Rtmp, jni_arg);
  75 #else
  76   Register     Rtmp = O0;
  77   __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
  78   __ store_argument(Rtmp, jni_arg);
  79 #endif
  80 }
  81 
  82 
  83 void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
  84   Argument  jni_arg(jni_offset(), false);
  85 #ifdef _LP64
  86   FloatRegister  Rtmp = F0;
  87   __ ldf(FloatRegisterImpl::D, Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
  88   __ store_double_argument(Rtmp, jni_arg);
  89 #else
  90   Register  Rtmp = O0;
  91   __ ld(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
  92   __ store_argument(Rtmp, jni_arg);
  93   __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
  94   Argument successor(jni_arg.successor());
  95   __ store_argument(Rtmp, successor);
  96 #endif
  97 }
  98 
  99 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
 100   Argument  jni_arg(jni_offset(), false);
 101   Argument java_arg(    offset(), true);
 102   Register    Rtmp1 = O0;
 103   Register    Rtmp2 =  jni_arg.is_register() ?  jni_arg.as_register() : O0;
 104   Register    Rtmp3 =  G3_scratch;
 105 
 106   // the handle for a receiver will never be null
 107   bool do_NULL_check = offset() != 0 || is_static();
 108 
 109   Address     h_arg = Address(Llocals, Interpreter::local_offset_in_bytes(offset()));
 110   __ ld_ptr(h_arg, Rtmp1);
 111   if (!do_NULL_check) {
 112     __ add(h_arg.base(), h_arg.disp(), Rtmp2);
 113   } else {
 114     if (Rtmp1 == Rtmp2)
 115           __ tst(Rtmp1);
 116     else  __ addcc(G0, Rtmp1, Rtmp2); // optimize mov/test pair


 154     non_float  = 0,
 155     float_sig  = 1,
 156     double_sig = 2,
 157     long_sig   = 3
 158   };
 159 
 160   virtual void pass_int() {
 161     *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
 162     _from -= Interpreter::stackElementSize;
 163     add_signature( non_float );
 164   }
 165 
 166   virtual void pass_object() {
 167     // pass address of from
 168     intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
 169     *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
 170     _from -= Interpreter::stackElementSize;
 171     add_signature( non_float );
 172    }
 173 
 174 #ifdef _LP64
 175   virtual void pass_float()  {
 176     *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
 177     _from -= Interpreter::stackElementSize;
 178     add_signature( float_sig );
 179    }
 180 
 181   virtual void pass_double() {
 182     *_to++ = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
 183     _from -= 2*Interpreter::stackElementSize;
 184    add_signature( double_sig );
 185    }
 186 
 187   virtual void pass_long() {
 188     _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
 189     _to += 1;
 190     _from -= 2*Interpreter::stackElementSize;
 191     add_signature( long_sig );
 192   }
 193 #else
 194    // pass_double() is pass_long() and pass_float() only _LP64
 195   virtual void pass_long() {
 196     _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
 197     _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0));
 198     _to += 2;
 199     _from -= 2*Interpreter::stackElementSize;
 200     add_signature( non_float );
 201   }
 202 
 203   virtual void pass_float() {
 204     *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
 205     _from -= Interpreter::stackElementSize;
 206     add_signature( non_float );
 207   }
 208 
 209 #endif // _LP64
 210 
 211   virtual void add_signature( intptr_t sig_type ) {
 212     if ( _argcount < (sizeof (intptr_t))*4 ) {
 213       *_RegArgSignature |= (sig_type << (_argcount*2) );
 214       _argcount++;
 215     }
 216   }
 217 
 218 
 219  public:
 220   SlowSignatureHandler(methodHandle method, address from, intptr_t* to, intptr_t *RegArgSig) : NativeSignatureIterator(method) {
 221     _from = from;
 222     _to   = to;
 223     _RegArgSignature = RegArgSig;
 224     *_RegArgSignature = 0;
 225     _argcount = method->is_static() ? 2 : 1;
 226   }
 227 };
 228 
 229 


  36 #include "runtime/signature.hpp"
  37 
  38 
  39 #define __ _masm->
  40 
  41 
  42 // Implementation of SignatureHandlerGenerator
  43 
  44 void InterpreterRuntime::SignatureHandlerGenerator::pass_word(int size_of_arg, int offset_in_arg) {
  45   Argument  jni_arg(jni_offset() + offset_in_arg, false);
  46   Register     Rtmp = O0;
  47   __ ld(Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
  48 
  49   __ store_argument(Rtmp, jni_arg);
  50 }
  51 
  52 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() {
  53   Argument  jni_arg(jni_offset(), false);
  54   Register  Rtmp = O0;
  55 

  56   __ ldx(Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
  57   __ store_long_argument(Rtmp, jni_arg);







  58 }
  59 
  60 
  61 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() {
  62   Argument  jni_arg(jni_offset(), false);

  63   FloatRegister  Rtmp = F0;
  64   __ ldf(FloatRegisterImpl::S, Llocals, Interpreter::local_offset_in_bytes(offset()), Rtmp);
  65   __ store_float_argument(Rtmp, jni_arg);





  66 }
  67 
  68 
  69 void InterpreterRuntime::SignatureHandlerGenerator::pass_double() {
  70   Argument  jni_arg(jni_offset(), false);

  71   FloatRegister  Rtmp = F0;
  72   __ ldf(FloatRegisterImpl::D, Llocals, Interpreter::local_offset_in_bytes(offset() + 1), Rtmp);
  73   __ store_double_argument(Rtmp, jni_arg);








  74 }
  75 
  76 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() {
  77   Argument  jni_arg(jni_offset(), false);
  78   Argument java_arg(    offset(), true);
  79   Register    Rtmp1 = O0;
  80   Register    Rtmp2 =  jni_arg.is_register() ?  jni_arg.as_register() : O0;
  81   Register    Rtmp3 =  G3_scratch;
  82 
  83   // the handle for a receiver will never be null
  84   bool do_NULL_check = offset() != 0 || is_static();
  85 
  86   Address     h_arg = Address(Llocals, Interpreter::local_offset_in_bytes(offset()));
  87   __ ld_ptr(h_arg, Rtmp1);
  88   if (!do_NULL_check) {
  89     __ add(h_arg.base(), h_arg.disp(), Rtmp2);
  90   } else {
  91     if (Rtmp1 == Rtmp2)
  92           __ tst(Rtmp1);
  93     else  __ addcc(G0, Rtmp1, Rtmp2); // optimize mov/test pair


 131     non_float  = 0,
 132     float_sig  = 1,
 133     double_sig = 2,
 134     long_sig   = 3
 135   };
 136 
 137   virtual void pass_int() {
 138     *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
 139     _from -= Interpreter::stackElementSize;
 140     add_signature( non_float );
 141   }
 142 
 143   virtual void pass_object() {
 144     // pass address of from
 145     intptr_t *from_addr = (intptr_t*)(_from + Interpreter::local_offset_in_bytes(0));
 146     *_to++ = (*from_addr == 0) ? NULL : (intptr_t) from_addr;
 147     _from -= Interpreter::stackElementSize;
 148     add_signature( non_float );
 149    }
 150 

 151   virtual void pass_float()  {
 152     *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
 153     _from -= Interpreter::stackElementSize;
 154     add_signature( float_sig );
 155    }
 156 
 157   virtual void pass_double() {
 158     *_to++ = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
 159     _from -= 2*Interpreter::stackElementSize;
 160    add_signature( double_sig );
 161    }
 162 
 163   virtual void pass_long() {
 164     _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1));
 165     _to += 1;
 166     _from -= 2*Interpreter::stackElementSize;
 167     add_signature( long_sig );
 168   }

















 169 
 170   virtual void add_signature( intptr_t sig_type ) {
 171     if ( _argcount < (sizeof (intptr_t))*4 ) {
 172       *_RegArgSignature |= (sig_type << (_argcount*2) );
 173       _argcount++;
 174     }
 175   }
 176 
 177 
 178  public:
 179   SlowSignatureHandler(methodHandle method, address from, intptr_t* to, intptr_t *RegArgSig) : NativeSignatureIterator(method) {
 180     _from = from;
 181     _to   = to;
 182     _RegArgSignature = RegArgSig;
 183     *_RegArgSignature = 0;
 184     _argcount = method->is_static() ? 2 : 1;
 185   }
 186 };
 187 
 188 
< prev index next >