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