|
36 | 36 | #include "oops/markWord.hpp"
|
37 | 37 | #include "oops/methodCounters.hpp"
|
38 | 38 | #include "oops/methodData.hpp"
|
| 39 | +#include "oops/resolvedFieldEntry.hpp" |
39 | 40 | #include "oops/resolvedIndyEntry.hpp"
|
40 | 41 | #include "prims/jvmtiExport.hpp"
|
41 | 42 | #include "prims/jvmtiThreadState.hpp"
|
@@ -349,16 +350,45 @@ void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, Regis
|
349 | 350 | }
|
350 | 351 |
|
351 | 352 | void InterpreterMacroAssembler::load_resolved_indy_entry(Register cache, Register index) {
|
352 |
| - // Get index out of bytecode pointer, get_cache_entry_pointer_at_bcp |
| 353 | + // Get index out of bytecode pointer. |
353 | 354 | get_cache_index_at_bcp(index, 1, sizeof(u4));
|
354 |
| - // Get address of invokedynamic array |
| 355 | + |
| 356 | + // Get the address of the ResolvedIndyEntry array |
355 | 357 | get_constant_pool_cache(cache);
|
356 | 358 | z_lg(cache, Address(cache, in_bytes(ConstantPoolCache::invokedynamic_entries_offset())));
|
357 |
| - // Scale the index to be the entry index * sizeof(ResolvedInvokeDynamicInfo) |
358 |
| - z_sllg(index, index, exact_log2(sizeof(ResolvedIndyEntry))); |
| 359 | + |
| 360 | + // Scale the index to form a byte offset into the ResolvedIndyEntry array |
| 361 | + size_t entry_size = sizeof(ResolvedIndyEntry); |
| 362 | + if (is_power_of_2(entry_size)) { |
| 363 | + z_sllg(index, index, exact_log2(entry_size)); |
| 364 | + } else { |
| 365 | + z_mghi(index, entry_size); |
| 366 | + } |
| 367 | + |
| 368 | + // Calculate the final field address. |
359 | 369 | z_la(cache, Array<ResolvedIndyEntry>::base_offset_in_bytes(), index, cache);
|
360 | 370 | }
|
361 | 371 |
|
| 372 | +void InterpreterMacroAssembler::load_field_entry(Register cache, Register index, int bcp_offset) { |
| 373 | + // Get field index out of bytecode pointer. |
| 374 | + get_cache_index_at_bcp(index, bcp_offset, sizeof(u2)); |
| 375 | + |
| 376 | + // Get the address of the ResolvedFieldEntry array. |
| 377 | + get_constant_pool_cache(cache); |
| 378 | + z_lg(cache, Address(cache, in_bytes(ConstantPoolCache::field_entries_offset()))); |
| 379 | + |
| 380 | + // Scale the index to form a byte offset into the ResolvedFieldEntry array |
| 381 | + size_t entry_size = sizeof(ResolvedFieldEntry); |
| 382 | + if (is_power_of_2(entry_size)) { |
| 383 | + z_sllg(index, index, exact_log2(entry_size)); |
| 384 | + } else { |
| 385 | + z_mghi(index, entry_size); |
| 386 | + } |
| 387 | + |
| 388 | + // Calculate the final field address. |
| 389 | + z_la(cache, Array<ResolvedFieldEntry>::base_offset_in_bytes(), index, cache); |
| 390 | +} |
| 391 | + |
362 | 392 | // Kills Z_R0_scratch.
|
363 | 393 | void InterpreterMacroAssembler::get_cache_and_index_and_bytecode_at_bcp(Register cache,
|
364 | 394 | Register cpe_offset,
|
|
0 commit comments