|
31 | 31 | #include "interpreter/interpreterRuntime.hpp" |
32 | 32 | #include "oops/arrayOop.hpp" |
33 | 33 | #include "oops/markWord.hpp" |
34 | | -#include "oops/methodData.hpp" |
35 | 34 | #include "oops/method.hpp" |
| 35 | +#include "oops/methodData.hpp" |
| 36 | +#include "oops/resolvedFieldEntry.hpp" |
36 | 37 | #include "oops/resolvedIndyEntry.hpp" |
37 | 38 | #include "prims/jvmtiExport.hpp" |
38 | 39 | #include "prims/jvmtiThreadState.hpp" |
@@ -330,12 +331,29 @@ void InterpreterMacroAssembler::load_resolved_indy_entry(Register cache, Registe |
330 | 331 | // Get address of invokedynamic array |
331 | 332 | ld_d(cache, FP, frame::interpreter_frame_cache_offset * wordSize); |
332 | 333 | ld_d(cache, Address(cache, in_bytes(ConstantPoolCache::invokedynamic_entries_offset()))); |
333 | | - // Scale the index to be the entry index * sizeof(ResolvedInvokeDynamicInfo) |
| 334 | + // Scale the index to be the entry index * sizeof(ResolvedIndyEntry) |
334 | 335 | slli_d(index, index, log2i_exact(sizeof(ResolvedIndyEntry))); |
335 | 336 | addi_d(cache, cache, Array<ResolvedIndyEntry>::base_offset_in_bytes()); |
336 | 337 | add_d(cache, cache, index); |
337 | 338 | } |
338 | 339 |
|
| 340 | +void InterpreterMacroAssembler::load_field_entry(Register cache, Register index, int bcp_offset) { |
| 341 | + // Get index out of bytecode pointer |
| 342 | + get_cache_index_at_bcp(index, bcp_offset, sizeof(u2)); |
| 343 | + // Take shortcut if the size is a power of 2 |
| 344 | + if (is_power_of_2(sizeof(ResolvedFieldEntry))) { |
| 345 | + slli_d(index, index, log2i_exact(sizeof(ResolvedFieldEntry))); // Scale index by power of 2 |
| 346 | + } else { |
| 347 | + li(cache, sizeof(ResolvedFieldEntry)); |
| 348 | + mul_d(index, index, cache); // Scale the index to be the entry index * sizeof(ResolvedIndyEntry) |
| 349 | + } |
| 350 | + ld_d(cache, FP, frame::interpreter_frame_cache_offset * wordSize); |
| 351 | + // Get address of field entries array |
| 352 | + ld_d(cache, Address(cache, ConstantPoolCache::field_entries_offset())); |
| 353 | + addi_d(cache, cache, Array<ResolvedIndyEntry>::base_offset_in_bytes()); |
| 354 | + add_d(cache, cache, index); |
| 355 | +} |
| 356 | + |
339 | 357 | // Load object from cpool->resolved_references(index) |
340 | 358 | void InterpreterMacroAssembler::load_resolved_reference_at_index( |
341 | 359 | Register result, Register index, Register tmp) { |
|
0 commit comments