Mercurial > hg > truffle
comparison src/cpu/x86/vm/interp_masm_x86_64.cpp @ 1108:85f13cdfbc1d
6829192: JSR 292 needs to support 64-bit x86
Summary: changes for method handles and invokedynamic
Reviewed-by: kvn
author | twisti |
---|---|
date | Wed, 16 Dec 2009 12:48:04 +0100 |
parents | 6918603297f7 |
children | 87684f1a88b5 |
comparison
equal
deleted
inserted
replaced
1102:6dc5471e0f66 | 1108:85f13cdfbc1d |
---|---|
183 bswapl(reg); | 183 bswapl(reg); |
184 shrl(reg, 16); | 184 shrl(reg, 16); |
185 } | 185 } |
186 | 186 |
187 | 187 |
188 void InterpreterMacroAssembler::get_cache_index_at_bcp(Register index, | |
189 int bcp_offset, | |
190 bool giant_index) { | |
191 assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); | |
192 if (!giant_index) { | |
193 load_unsigned_short(index, Address(r13, bcp_offset)); | |
194 } else { | |
195 assert(EnableInvokeDynamic, "giant index used only for EnableInvokeDynamic"); | |
196 movl(index, Address(r13, bcp_offset)); | |
197 // Check if the secondary index definition is still ~x, otherwise | |
198 // we have to change the following assembler code to calculate the | |
199 // plain index. | |
200 assert(constantPoolCacheOopDesc::decode_secondary_index(~123) == 123, "else change next line"); | |
201 notl(index); // convert to plain index | |
202 } | |
203 } | |
204 | |
205 | |
188 void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, | 206 void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, |
189 Register index, | 207 Register index, |
190 int bcp_offset) { | 208 int bcp_offset, |
191 assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); | 209 bool giant_index) { |
192 assert(cache != index, "must use different registers"); | 210 assert(cache != index, "must use different registers"); |
193 load_unsigned_short(index, Address(r13, bcp_offset)); | 211 get_cache_index_at_bcp(index, bcp_offset, giant_index); |
194 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); | 212 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); |
195 assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below"); | 213 assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below"); |
196 // convert from field index to ConstantPoolCacheEntry index | 214 // convert from field index to ConstantPoolCacheEntry index |
197 shll(index, 2); | 215 shll(index, 2); |
198 } | 216 } |
199 | 217 |
200 | 218 |
201 void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, | 219 void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, |
202 Register tmp, | 220 Register tmp, |
203 int bcp_offset) { | 221 int bcp_offset, |
204 assert(bcp_offset > 0, "bcp is still pointing to start of bytecode"); | 222 bool giant_index) { |
205 assert(cache != tmp, "must use different register"); | 223 assert(cache != tmp, "must use different register"); |
206 load_unsigned_short(tmp, Address(r13, bcp_offset)); | 224 get_cache_index_at_bcp(tmp, bcp_offset, giant_index); |
207 assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below"); | 225 assert(sizeof(ConstantPoolCacheEntry) == 4 * wordSize, "adjust code below"); |
208 // convert from field index to ConstantPoolCacheEntry index | 226 // convert from field index to ConstantPoolCacheEntry index |
209 // and from word offset to byte offset | 227 // and from word offset to byte offset |
210 shll(tmp, 2 + LogBytesPerWord); | 228 shll(tmp, 2 + LogBytesPerWord); |
211 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); | 229 movptr(cache, Address(rbp, frame::interpreter_frame_cache_offset * wordSize)); |
1234 } | 1252 } |
1235 | 1253 |
1236 | 1254 |
1237 void InterpreterMacroAssembler::profile_virtual_call(Register receiver, | 1255 void InterpreterMacroAssembler::profile_virtual_call(Register receiver, |
1238 Register mdp, | 1256 Register mdp, |
1239 Register reg2) { | 1257 Register reg2, |
1258 bool receiver_can_be_null) { | |
1240 if (ProfileInterpreter) { | 1259 if (ProfileInterpreter) { |
1241 Label profile_continue; | 1260 Label profile_continue; |
1242 | 1261 |
1243 // If no method data exists, go to profile_continue. | 1262 // If no method data exists, go to profile_continue. |
1244 test_method_data_pointer(mdp, profile_continue); | 1263 test_method_data_pointer(mdp, profile_continue); |
1245 | 1264 |
1246 // We are making a call. Increment the count. | 1265 // We are making a call. Increment the count. |
1247 increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); | 1266 increment_mdp_data_at(mdp, in_bytes(CounterData::count_offset())); |
1248 | 1267 |
1268 Label skip_receiver_profile; | |
1269 if (receiver_can_be_null) { | |
1270 testptr(receiver, receiver); | |
1271 jcc(Assembler::zero, skip_receiver_profile); | |
1272 } | |
1273 | |
1249 // Record the receiver type. | 1274 // Record the receiver type. |
1250 record_klass_in_profile(receiver, mdp, reg2); | 1275 record_klass_in_profile(receiver, mdp, reg2); |
1276 bind(skip_receiver_profile); | |
1251 | 1277 |
1252 // The method data pointer needs to be updated to reflect the new target. | 1278 // The method data pointer needs to be updated to reflect the new target. |
1253 update_mdp_by_constant(mdp, | 1279 update_mdp_by_constant(mdp, |
1254 in_bytes(VirtualCallData:: | 1280 in_bytes(VirtualCallData:: |
1255 virtual_call_data_size())); | 1281 virtual_call_data_size())); |