43 move(offset(), jni_offset() + 1); 44 } 45 46 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() { 47 move(offset(), jni_offset() + 1); 48 } 49 50 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() { 51 move(offset(), jni_offset() + 2); 52 move(offset() + 1, jni_offset() + 1); 53 } 54 55 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() { 56 box (offset(), jni_offset() + 1); 57 } 58 59 void InterpreterRuntime::SignatureHandlerGenerator::pass_valuetype() { 60 box (offset(), jni_offset() + 1); 61 } 62 63 void InterpreterRuntime::SignatureHandlerGenerator::pass_valuetype() { 64 box (offset(), jni_offset() + 1); 65 } 66 67 void InterpreterRuntime::SignatureHandlerGenerator::move(int from_offset, int to_offset) { 68 __ movl(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset))); 69 __ movl(Address(to(), to_offset * wordSize), temp()); 70 } 71 72 73 void InterpreterRuntime::SignatureHandlerGenerator::box(int from_offset, int to_offset) { 74 __ lea(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset))); 75 __ cmpptr(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), (int32_t)NULL_WORD); // do not use temp() to avoid AGI 76 Label L; 77 __ jcc(Assembler::notZero, L); 78 __ movptr(temp(), NULL_WORD); 79 __ bind(L); 80 __ movptr(Address(to(), to_offset * wordSize), temp()); 81 } 82 83 84 void InterpreterRuntime::SignatureHandlerGenerator::generate( uint64_t fingerprint) { 85 // generate code to handle arguments 86 iterate(fingerprint); 120 virtual void pass_long() { 121 _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); 122 _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0)); 123 _to += 2; 124 _from -= 2*Interpreter::stackElementSize; 125 } 126 127 virtual void pass_object() { 128 // pass address of from 129 intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0)); 130 *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr; 131 _from -= Interpreter::stackElementSize; 132 } 133 134 virtual void pass_valuetype() { 135 // pass address of from 136 intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0)); 137 *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr; 138 _from -= Interpreter::stackElementSize; 139 } 140 141 virtual void pass_valuetype() { 142 // pass address of from 143 intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0)); 144 *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr; 145 _from -= Interpreter::stackElementSize; 146 } 147 148 public: 149 SlowSignatureHandler(methodHandle method, address from, intptr_t* to) : 150 NativeSignatureIterator(method) { 151 _from = from; 152 _to = to + (is_static() ? 2 : 1); 153 } 154 }; 155 156 IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler(JavaThread* thread, Method* method, intptr_t* from, intptr_t* to)) 157 methodHandle m(thread, (Method*)method); 158 assert(m->is_native(), "sanity check"); 159 // handle arguments 160 SlowSignatureHandler(m, (address)from, to + 1).iterate((uint64_t)CONST64(-1)); 161 // return result handler 162 return Interpreter::result_handler(m->result_type()); 163 IRT_END | 43 move(offset(), jni_offset() + 1); 44 } 45 46 void InterpreterRuntime::SignatureHandlerGenerator::pass_float() { 47 move(offset(), jni_offset() + 1); 48 } 49 50 void InterpreterRuntime::SignatureHandlerGenerator::pass_long() { 51 move(offset(), jni_offset() + 2); 52 move(offset() + 1, jni_offset() + 1); 53 } 54 55 void InterpreterRuntime::SignatureHandlerGenerator::pass_object() { 56 box (offset(), jni_offset() + 1); 57 } 58 59 void InterpreterRuntime::SignatureHandlerGenerator::pass_valuetype() { 60 box (offset(), jni_offset() + 1); 61 } 62 63 void InterpreterRuntime::SignatureHandlerGenerator::move(int from_offset, int to_offset) { 64 __ movl(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset))); 65 __ movl(Address(to(), to_offset * wordSize), temp()); 66 } 67 68 69 void InterpreterRuntime::SignatureHandlerGenerator::box(int from_offset, int to_offset) { 70 __ lea(temp(), Address(from(), Interpreter::local_offset_in_bytes(from_offset))); 71 __ cmpptr(Address(from(), Interpreter::local_offset_in_bytes(from_offset)), (int32_t)NULL_WORD); // do not use temp() to avoid AGI 72 Label L; 73 __ jcc(Assembler::notZero, L); 74 __ movptr(temp(), NULL_WORD); 75 __ bind(L); 76 __ movptr(Address(to(), to_offset * wordSize), temp()); 77 } 78 79 80 void InterpreterRuntime::SignatureHandlerGenerator::generate( uint64_t fingerprint) { 81 // generate code to handle arguments 82 iterate(fingerprint); 116 virtual void pass_long() { 117 _to[0] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(1)); 118 _to[1] = *(intptr_t*)(_from+Interpreter::local_offset_in_bytes(0)); 119 _to += 2; 120 _from -= 2*Interpreter::stackElementSize; 121 } 122 123 virtual void pass_object() { 124 // pass address of from 125 intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0)); 126 *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr; 127 _from -= Interpreter::stackElementSize; 128 } 129 130 virtual void pass_valuetype() { 131 // pass address of from 132 intptr_t from_addr = (intptr_t)(_from + Interpreter::local_offset_in_bytes(0)); 133 *_to++ = (*(intptr_t*)from_addr == 0) ? NULL_WORD : from_addr; 134 _from -= Interpreter::stackElementSize; 135 } 136 137 public: 138 SlowSignatureHandler(methodHandle method, address from, intptr_t* to) : 139 NativeSignatureIterator(method) { 140 _from = from; 141 _to = to + (is_static() ? 2 : 1); 142 } 143 }; 144 145 IRT_ENTRY(address, InterpreterRuntime::slow_signature_handler(JavaThread* thread, Method* method, intptr_t* from, intptr_t* to)) 146 methodHandle m(thread, (Method*)method); 147 assert(m->is_native(), "sanity check"); 148 // handle arguments 149 SlowSignatureHandler(m, (address)from, to + 1).iterate((uint64_t)CONST64(-1)); 150 // return result handler 151 return Interpreter::result_handler(m->result_type()); 152 IRT_END |