@@ -561,40 +561,50 @@ void TemplateInterpreterGenerator::lock_method() {
561
561
// rdx: cp cache
562
562
void TemplateInterpreterGenerator::generate_fixed_frame (bool native_call) {
563
563
// initialize fixed part of activation frame
564
- __ push (rax); // save return address
565
- __ enter (); // save old & set new rbp
564
+ __ push (rax); // save return address
565
+ __ enter (); // save old & set new rbp
566
566
__ push (rbcp); // set sender sp
567
- __ push (NULL_WORD); // leave last_sp as null
568
- __ movptr (rbcp, Address (rbx, Method::const_offset ())); // get ConstMethod*
569
- __ lea (rbcp, Address (rbcp, ConstMethod::codes_offset ())); // get codebase
567
+
568
+ // Resolve ConstMethod* -> ConstantPool*.
569
+ // Get codebase, while we still have ConstMethod*.
570
+ // Save ConstantPool* in rax for later use.
571
+ __ movptr (rax, Address (rbx, Method::const_offset ()));
572
+ __ lea (rbcp, Address (rax, ConstMethod::codes_offset ()));
573
+ __ movptr (rax, Address (rax, ConstMethod::constants_offset ()));
574
+
575
+ __ push (NULL_WORD); // leave last_sp as null
570
576
__ push (rbx); // save Method*
571
- // Get mirror and store it in the frame as GC root for this Method*
572
- __ load_mirror (rdx, rbx, rscratch2);
577
+
578
+ // Get mirror and store it in the frame as GC root for this Method*.
579
+ // rax is still ConstantPool*, resolve ConstantPool* -> InstanceKlass* -> Java mirror.
580
+ __ movptr (rdx, Address (rax, ConstantPool::pool_holder_offset ()));
581
+ __ movptr (rdx, Address (rdx, in_bytes (Klass::java_mirror_offset ())));
582
+ __ resolve_oop_handle (rdx, rscratch2);
573
583
__ push (rdx);
584
+
574
585
if (ProfileInterpreter) {
575
586
Label method_data_continue;
576
587
__ movptr (rdx, Address (rbx, in_bytes (Method::method_data_offset ())));
577
588
__ testptr (rdx, rdx);
578
- __ jcc (Assembler::zero, method_data_continue);
589
+ __ jccb (Assembler::zero, method_data_continue);
579
590
__ addptr (rdx, in_bytes (MethodData::data_offset ()));
580
591
__ bind (method_data_continue);
581
592
__ push (rdx); // set the mdp (method data pointer)
582
593
} else {
583
- __ push (0 );
594
+ __ push (NULL_WORD );
584
595
}
585
596
586
- __ movptr (rdx, Address (rbx, Method::const_offset ()));
587
- __ movptr (rdx, Address (rdx, ConstMethod::constants_offset ()));
588
- __ movptr (rdx, Address (rdx, ConstantPool::cache_offset ()));
589
- __ push (rdx); // set constant pool cache
597
+ // rax is still ConstantPool*, set the constant pool cache
598
+ __ movptr (rdx, Address (rax, ConstantPool::cache_offset ()));
599
+ __ push (rdx);
590
600
591
601
__ movptr (rax, rlocals);
592
602
__ subptr (rax, rbp);
593
603
__ shrptr (rax, Interpreter::logStackElementSize); // rax = rlocals - fp();
594
604
__ push (rax); // set relativized rlocals, see frame::interpreter_frame_locals()
595
605
596
606
if (native_call) {
597
- __ push (0 ); // no bcp
607
+ __ push (NULL_WORD ); // no bcp
598
608
} else {
599
609
__ push (rbcp); // set bcp
600
610
}
@@ -1242,11 +1252,11 @@ address TemplateInterpreterGenerator::generate_normal_entry(bool synchronized) {
1242
1252
{
1243
1253
Label exit, loop;
1244
1254
__ testl (rdx, rdx);
1245
- __ jcc (Assembler::lessEqual, exit); // do nothing if rdx <= 0
1255
+ __ jccb (Assembler::lessEqual, exit); // do nothing if rdx <= 0
1246
1256
__ bind (loop);
1247
1257
__ push (NULL_WORD); // initialize local variables
1248
1258
__ decrementl (rdx); // until everything initialized
1249
- __ jcc (Assembler::greater, loop);
1259
+ __ jccb (Assembler::greater, loop);
1250
1260
__ bind (exit);
1251
1261
}
1252
1262
0 commit comments