< prev index next >

src/hotspot/cpu/arm/interpreterRT_arm.cpp

Print this page
rev 54026 : 8213845: ARM32: Interpreter doesn't call result handler after native calls
Summary: Fix mapping of native jboolean result to 0..1 on ARM32
Reviewed-by: aph
Contributed-by: christoph.goettschkes@microdoc.com


  69   (u1) SignatureIterator::float_parm, // float
  70   (u1) SignatureIterator::double_parm, // double
  71 #endif
  72   (u1) SignatureIterator::obj_parm, // obj
  73   (u1) SignatureIterator::done_parm // done
  74 };
  75 
  76 uint64_t InterpreterRuntime::normalize_fast_native_fingerprint(uint64_t fingerprint) {
  77   if (fingerprint == UCONST64(-1)) {
  78     // special signature used when the argument list cannot be encoded in a 64 bits value
  79     return fingerprint;
  80   }
  81   int shift = SignatureIterator::static_feature_size;
  82   uint64_t result = fingerprint & ((1 << shift) - 1);
  83   fingerprint >>= shift;
  84 
  85   BasicType ret_type = (BasicType) (fingerprint & SignatureIterator::result_feature_mask);
  86   // For ARM, the fast signature handler only needs to know whether
  87   // the return value must be unboxed. T_OBJECT and T_ARRAY need not
  88   // be distinguished from each other and all other return values
  89   // behave like integers with respect to the handler.

  90   bool unbox = (ret_type == T_OBJECT) || (ret_type == T_ARRAY);
  91   if (unbox) {
  92     ret_type = T_OBJECT;
  93   } else {
  94     ret_type = T_INT;
  95   }
  96   result |= ((uint64_t) ret_type) << shift;
  97   shift += SignatureIterator::result_feature_size;
  98   fingerprint >>= SignatureIterator::result_feature_size;
  99 
 100   while (true) {
 101     uint32_t type = (uint32_t) (fingerprint & SignatureIterator::parameter_feature_mask);
 102     if (type == SignatureIterator::done_parm) {
 103       result |= ((uint64_t) SignatureIterator::done_parm) << shift;
 104       return result;
 105     }
 106     assert((type >= SignatureIterator::bool_parm) && (type <= SignatureIterator::obj_parm), "check fingerprint encoding");
 107     int shared = shared_type[type - SignatureIterator::bool_parm];
 108     result |= ((uint64_t) shared) << shift;
 109     shift += SignatureIterator::parameter_feature_size;
 110     fingerprint >>= SignatureIterator::parameter_feature_size;
 111   }
 112 }
 113 #endif // SHARING_FAST_NATIVE_FINGERPRINTS


 264     } else {
 265       __ ldr(Rtemp, Address(Rlocals, Interpreter::local_offset_in_bytes(offset()+1)));
 266       __ str(Rtemp, Address(SP, (_abi_offset) * wordSize));
 267       __ ldr(Rtemp, Address(Rlocals, Interpreter::local_offset_in_bytes(offset())));
 268       __ str(Rtemp, Address(SP, (_abi_offset+1) * wordSize));
 269       _abi_offset += 2;
 270       _single_fpr_slot = 16;
 271     }
 272 #endif // AARCH64
 273 }
 274 #endif // __SOFTFP__
 275 #endif // __ABI_HARD__
 276 
 277 void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
 278   iterate(fingerprint);
 279 
 280   BasicType result_type = SignatureIterator::return_type(fingerprint);
 281 
 282   address result_handler = Interpreter::result_handler(result_type);
 283 
 284 #ifdef AARCH64
 285   __ mov_slow(R0, (address)result_handler);
 286 #else
 287   // Check that result handlers are not real handler on ARM (0 or -1).
 288   // This ensures the signature handlers do not need symbolic information.
 289   assert((result_handler == NULL)||(result_handler==(address)0xffffffff),"");
 290   __ mov_slow(R0, (intptr_t)result_handler);
 291 #endif
 292 
 293   __ ret();
 294 }
 295 
 296 
 297 // Implementation of SignatureHandlerLibrary
 298 
 299 void SignatureHandlerLibrary::pd_set_handler(address handler) {}
 300 
 301 class SlowSignatureHandler: public NativeSignatureIterator {
 302  private:
 303   address   _from;
 304   intptr_t* _to;
 305 
 306 #ifndef __ABI_HARD__
 307   virtual void pass_int() {
 308     *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
 309     _from -= Interpreter::stackElementSize;
 310   }
 311 




  69   (u1) SignatureIterator::float_parm, // float
  70   (u1) SignatureIterator::double_parm, // double
  71 #endif
  72   (u1) SignatureIterator::obj_parm, // obj
  73   (u1) SignatureIterator::done_parm // done
  74 };
  75 
  76 uint64_t InterpreterRuntime::normalize_fast_native_fingerprint(uint64_t fingerprint) {
  77   if (fingerprint == UCONST64(-1)) {
  78     // special signature used when the argument list cannot be encoded in a 64 bits value
  79     return fingerprint;
  80   }
  81   int shift = SignatureIterator::static_feature_size;
  82   uint64_t result = fingerprint & ((1 << shift) - 1);
  83   fingerprint >>= shift;
  84 
  85   BasicType ret_type = (BasicType) (fingerprint & SignatureIterator::result_feature_mask);
  86   // For ARM, the fast signature handler only needs to know whether
  87   // the return value must be unboxed. T_OBJECT and T_ARRAY need not
  88   // be distinguished from each other and all other return values
  89   // behave like integers with respect to the handler except T_BOOLEAN
  90   // which must be mapped to the range 0..1.
  91   bool unbox = (ret_type == T_OBJECT) || (ret_type == T_ARRAY);
  92   if (unbox) {
  93     ret_type = T_OBJECT;
  94   } else if (ret_type != T_BOOLEAN) {
  95     ret_type = T_INT;
  96   }
  97   result |= ((uint64_t) ret_type) << shift;
  98   shift += SignatureIterator::result_feature_size;
  99   fingerprint >>= SignatureIterator::result_feature_size;
 100 
 101   while (true) {
 102     uint32_t type = (uint32_t) (fingerprint & SignatureIterator::parameter_feature_mask);
 103     if (type == SignatureIterator::done_parm) {
 104       result |= ((uint64_t) SignatureIterator::done_parm) << shift;
 105       return result;
 106     }
 107     assert((type >= SignatureIterator::bool_parm) && (type <= SignatureIterator::obj_parm), "check fingerprint encoding");
 108     int shared = shared_type[type - SignatureIterator::bool_parm];
 109     result |= ((uint64_t) shared) << shift;
 110     shift += SignatureIterator::parameter_feature_size;
 111     fingerprint >>= SignatureIterator::parameter_feature_size;
 112   }
 113 }
 114 #endif // SHARING_FAST_NATIVE_FINGERPRINTS


 265     } else {
 266       __ ldr(Rtemp, Address(Rlocals, Interpreter::local_offset_in_bytes(offset()+1)));
 267       __ str(Rtemp, Address(SP, (_abi_offset) * wordSize));
 268       __ ldr(Rtemp, Address(Rlocals, Interpreter::local_offset_in_bytes(offset())));
 269       __ str(Rtemp, Address(SP, (_abi_offset+1) * wordSize));
 270       _abi_offset += 2;
 271       _single_fpr_slot = 16;
 272     }
 273 #endif // AARCH64
 274 }
 275 #endif // __SOFTFP__
 276 #endif // __ABI_HARD__
 277 
 278 void InterpreterRuntime::SignatureHandlerGenerator::generate(uint64_t fingerprint) {
 279   iterate(fingerprint);
 280 
 281   BasicType result_type = SignatureIterator::return_type(fingerprint);
 282 
 283   address result_handler = Interpreter::result_handler(result_type);
 284 






 285   __ mov_slow(R0, (intptr_t)result_handler);

 286 
 287   __ ret();
 288 }
 289 
 290 
 291 // Implementation of SignatureHandlerLibrary
 292 
 293 void SignatureHandlerLibrary::pd_set_handler(address handler) {}
 294 
 295 class SlowSignatureHandler: public NativeSignatureIterator {
 296  private:
 297   address   _from;
 298   intptr_t* _to;
 299 
 300 #ifndef __ABI_HARD__
 301   virtual void pass_int() {
 302     *_to++ = *(jint *)(_from+Interpreter::local_offset_in_bytes(0));
 303     _from -= Interpreter::stackElementSize;
 304   }
 305 


< prev index next >