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