Skip to content

Commit 6d82436

Browse files
author
Matias Saavedra Silva
committedNov 21, 2023
8320278: ARM32 build is broken after JDK-8301997
Reviewed-by: coleenp, stuefe
1 parent f69e665 commit 6d82436

5 files changed

+168
-191
lines changed
 

‎src/hotspot/cpu/arm/interp_masm_arm.cpp

+15-42
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
#include "oops/methodData.hpp"
4040
#include "oops/resolvedFieldEntry.hpp"
4141
#include "oops/resolvedIndyEntry.hpp"
42+
#include "oops/resolvedMethodEntry.hpp"
4243
#include "prims/jvmtiExport.hpp"
4344
#include "prims/jvmtiThreadState.hpp"
4445
#include "runtime/basicLock.hpp"
@@ -222,48 +223,6 @@ void InterpreterMacroAssembler::get_index_at_bcp(Register index, int bcp_offset,
222223
}
223224
}
224225

225-
// Sets cache, index.
226-
void InterpreterMacroAssembler::get_cache_and_index_at_bcp(Register cache, Register index, int bcp_offset, size_t index_size) {
227-
assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
228-
assert_different_registers(cache, index);
229-
230-
get_index_at_bcp(index, bcp_offset, cache, index_size);
231-
232-
// load constant pool cache pointer
233-
ldr(cache, Address(FP, frame::interpreter_frame_cache_offset * wordSize));
234-
235-
// convert from field index to ConstantPoolCacheEntry index
236-
assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below");
237-
logical_shift_left(index, index, 2);
238-
}
239-
240-
// Sets cache, index, bytecode.
241-
void InterpreterMacroAssembler::get_cache_and_index_and_bytecode_at_bcp(Register cache, Register index, Register bytecode, int byte_no, int bcp_offset, size_t index_size) {
242-
get_cache_and_index_at_bcp(cache, index, bcp_offset, index_size);
243-
// caution index and bytecode can be the same
244-
add(bytecode, cache, AsmOperand(index, lsl, LogBytesPerWord));
245-
ldrb(bytecode, Address(bytecode, (1 + byte_no) + in_bytes(ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::indices_offset())));
246-
TemplateTable::volatile_barrier(MacroAssembler::LoadLoad, noreg, true);
247-
}
248-
249-
// Sets cache. Blows reg_tmp.
250-
void InterpreterMacroAssembler::get_cache_entry_pointer_at_bcp(Register cache, Register reg_tmp, int bcp_offset, size_t index_size) {
251-
assert(bcp_offset > 0, "bcp is still pointing to start of bytecode");
252-
assert_different_registers(cache, reg_tmp);
253-
254-
get_index_at_bcp(reg_tmp, bcp_offset, cache, index_size);
255-
256-
// load constant pool cache pointer
257-
ldr(cache, Address(FP, frame::interpreter_frame_cache_offset * wordSize));
258-
259-
// skip past the header
260-
add(cache, cache, in_bytes(ConstantPoolCache::base_offset()));
261-
// convert from field index to ConstantPoolCacheEntry index
262-
// and from word offset to byte offset
263-
assert(sizeof(ConstantPoolCacheEntry) == 4*wordSize, "adjust code below");
264-
add(cache, cache, AsmOperand(reg_tmp, lsl, 2 + LogBytesPerWord));
265-
}
266-
267226
// Load object from cpool->resolved_references(index)
268227
void InterpreterMacroAssembler::load_resolved_reference_at_index(
269228
Register result, Register index) {
@@ -343,6 +302,20 @@ void InterpreterMacroAssembler::load_field_entry(Register cache, Register index,
343302
}
344303
}
345304

305+
void InterpreterMacroAssembler::load_method_entry(Register cache, Register index, int bcp_offset) {
306+
// Get index out of bytecode pointer
307+
get_index_at_bcp(index, bcp_offset, cache /* as tmp */, sizeof(u2));
308+
mov(cache, sizeof(ResolvedMethodEntry));
309+
mul(index, index, cache); // Scale the index to be the entry index * sizeof(ResolvedMethodEntry)
310+
311+
// load constant pool cache pointer
312+
ldr(cache, Address(FP, frame::interpreter_frame_cache_offset * wordSize));
313+
// Get address of method entries array
314+
ldr(cache, Address(cache, ConstantPoolCache::method_entries_offset()));
315+
add(cache, cache, Array<ResolvedMethodEntry>::base_offset_in_bytes());
316+
add(cache, cache, index);
317+
}
318+
346319
// Generate a subtype check: branch to not_subtype if sub_klass is
347320
// not a subtype of super_klass.
348321
// Profiling code for the subtype check failure (profile_typecheck_failed)

‎src/hotspot/cpu/arm/interp_masm_arm.hpp

+1-5
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,6 @@ class InterpreterMacroAssembler: public MacroAssembler {
8989

9090
// Sets index. Blows reg_tmp.
9191
void get_index_at_bcp(Register index, int bcp_offset, Register reg_tmp, size_t index_size = sizeof(u2));
92-
// Sets cache, index.
93-
void get_cache_and_index_at_bcp(Register cache, Register index, int bcp_offset, size_t index_size = sizeof(u2));
94-
void get_cache_and_index_and_bytecode_at_bcp(Register cache, Register index, Register bytecode, int byte_no, int bcp_offset, size_t index_size = sizeof(u2));
95-
// Sets cache. Blows reg_tmp.
96-
void get_cache_entry_pointer_at_bcp(Register cache, Register reg_tmp, int bcp_offset, size_t index_size = sizeof(u2));
9792

9893
// Load object from cpool->resolved_references(*bcp+1)
9994
void load_resolved_reference_at_index(Register result, Register tmp);
@@ -103,6 +98,7 @@ class InterpreterMacroAssembler: public MacroAssembler {
10398

10499
void load_resolved_indy_entry(Register cache, Register index);
105100
void load_field_entry(Register cache, Register index, int bcp_offset = 1);
101+
void load_method_entry(Register cache, Register index, int bcp_offset = 1);
106102

107103
void pop_ptr(Register r);
108104
void pop_i(Register r = R0_tos);

‎src/hotspot/cpu/arm/templateInterpreterGenerator_arm.cpp

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
#include "oops/method.inline.hpp"
3838
#include "oops/oop.inline.hpp"
3939
#include "oops/resolvedIndyEntry.hpp"
40+
#include "oops/resolvedMethodEntry.hpp"
4041
#include "prims/jvmtiExport.hpp"
4142
#include "prims/jvmtiThreadState.hpp"
4243
#include "prims/methodHandles.hpp"
@@ -373,12 +374,11 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state,
373374
__ add(Rstack_top, Rstack_top, AsmOperand(Rcache, lsl, Interpreter::logStackElementSize));
374375
} else {
375376
// Pop N words from the stack
376-
__ get_cache_and_index_at_bcp(Rcache, Rindex, 1, index_size);
377-
378-
__ add(Rtemp, Rcache, AsmOperand(Rindex, lsl, LogBytesPerWord));
379-
__ ldrb(Rtemp, Address(Rtemp, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
377+
assert(index_size == sizeof(u2), "Can only be u2");
378+
__ load_method_entry(Rcache, Rindex);
379+
__ ldrh(Rcache, Address(Rcache, in_bytes(ResolvedIndyEntry::num_parameters_offset())));
380380
__ check_stack_top();
381-
__ add(Rstack_top, Rstack_top, AsmOperand(Rtemp, lsl, Interpreter::logStackElementSize));
381+
__ add(Rstack_top, Rstack_top, AsmOperand(Rcache, lsl, Interpreter::logStackElementSize));
382382
}
383383

384384
__ convert_retval_to_tos(state);

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Nov 21, 2023

@openjdk-notifier[bot]
Please sign in to comment.