@@ -865,6 +865,10 @@ void TemplateInterpreterGenerator::lock_method() {
865
865
// rcpool: cp cache
866
866
// stack_pointer: previous sp
867
867
void TemplateInterpreterGenerator::generate_fixed_frame (bool native_call) {
868
+ // Save ConstMethod* in r5_const_method for later use to avoid loading multiple times
869
+ Register r5_const_method = r5;
870
+ __ ldr (r5_const_method, Address (rmethod, Method::const_offset ()));
871
+
868
872
// initialize fixed part of activation frame
869
873
if (native_call) {
870
874
__ sub (esp, sp, 14 * wordSize);
@@ -875,8 +879,7 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
875
879
__ stp (zr, zr, Address (sp, 12 * wordSize));
876
880
} else {
877
881
__ sub (esp, sp, 12 * wordSize);
878
- __ ldr (rscratch1, Address (rmethod, Method::const_offset ())); // get ConstMethod
879
- __ add (rbcp, rscratch1, in_bytes (ConstMethod::codes_offset ())); // get codebase
882
+ __ add (rbcp, r5_const_method, in_bytes (ConstMethod::codes_offset ())); // get codebase
880
883
__ mov (rscratch1, frame::interpreter_frame_initial_sp_offset);
881
884
__ stp (rscratch1, rbcp, Address (__ pre (sp, -12 * wordSize)));
882
885
}
@@ -896,9 +899,10 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
896
899
__ stp (rfp, lr, Address (sp, 10 * wordSize));
897
900
__ lea (rfp, Address (sp, 10 * wordSize));
898
901
899
- __ ldr (rcpool, Address (rmethod, Method::const_offset ()));
900
- __ ldr (rcpool, Address (rcpool, ConstMethod::constants_offset ()));
901
- __ ldr (rcpool, Address (rcpool, ConstantPool::cache_offset ()));
902
+ // Save ConstantPool* in r11_constants for later use to avoid loading multiple times
903
+ Register r11_constants = r11;
904
+ __ ldr (r11_constants, Address (r5_const_method, ConstMethod::constants_offset ()));
905
+ __ ldr (rcpool, Address (r11_constants, ConstantPool::cache_offset ()));
902
906
__ sub (rscratch1, rlocals, rfp);
903
907
__ lsr (rscratch1, rscratch1, Interpreter::logStackElementSize); // rscratch1 = rlocals - fp();
904
908
// Store relativized rlocals, see frame::interpreter_frame_locals().
@@ -908,11 +912,12 @@ void TemplateInterpreterGenerator::generate_fixed_frame(bool native_call) {
908
912
// leave last_sp as null
909
913
__ stp (zr, r19_sender_sp, Address (sp, 8 * wordSize));
910
914
911
- // Get mirror
912
- __ load_mirror (r10, rmethod, r5, rscratch2);
915
+ // Get mirror. Resolve ConstantPool* -> InstanceKlass* -> Java mirror.
916
+ __ ldr (r10, Address (r11_constants, ConstantPool::pool_holder_offset ()));
917
+ __ ldr (r10, Address (r10, in_bytes (Klass::java_mirror_offset ())));
918
+ __ resolve_oop_handle (r10, rscratch1, rscratch2);
913
919
if (! native_call) {
914
- __ ldr (rscratch1, Address (rmethod, Method::const_offset ()));
915
- __ ldrh (rscratch1, Address (rscratch1, ConstMethod::max_stack_offset ()));
920
+ __ ldrh (rscratch1, Address (r5_const_method, ConstMethod::max_stack_offset ()));
916
921
__ add (rscratch1, rscratch1, MAX2 (3 , Method::extra_stack_entries ()));
917
922
__ sub (rscratch1, sp, rscratch1, ext::uxtw, 3 );
918
923
__ andr (rscratch1, rscratch1, -16 );
0 commit comments