1 /*
   2  * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2012, 2015 SAP AG. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #include "precompiled.hpp"
  27 #include "asm/macroAssembler.inline.hpp"
  28 #include "interpreter/bytecodeHistogram.hpp"
  29 #include "interpreter/interpreter.hpp"
  30 #include "interpreter/interpreterGenerator.hpp"
  31 #include "interpreter/interpreterRuntime.hpp"
  32 #include "interpreter/interp_masm.hpp"
  33 #include "interpreter/templateTable.hpp"
  34 #include "oops/arrayOop.hpp"
  35 #include "oops/methodData.hpp"
  36 #include "oops/method.hpp"
  37 #include "oops/oop.inline.hpp"
  38 #include "prims/jvmtiExport.hpp"
  39 #include "prims/jvmtiThreadState.hpp"
  40 #include "prims/methodHandles.hpp"
  41 #include "runtime/arguments.hpp"
  42 #include "runtime/deoptimization.hpp"
  43 #include "runtime/frame.inline.hpp"
  44 #include "runtime/sharedRuntime.hpp"
  45 #include "runtime/stubRoutines.hpp"
  46 #include "runtime/synchronizer.hpp"
  47 #include "runtime/timer.hpp"
  48 #include "runtime/vframeArray.hpp"
  49 #include "utilities/debug.hpp"
  50 #ifdef COMPILER1
  51 #include "c1/c1_Runtime1.hpp"
  52 #endif
  53 
  54 #define __ _masm->
  55 
  56 #ifdef PRODUCT
  57 #define BLOCK_COMMENT(str) // nothing
  58 #else
  59 #define BLOCK_COMMENT(str) __ block_comment(str)
  60 #endif
  61 
  62 #define BIND(label) bind(label); BLOCK_COMMENT(#label ":")
  63 
  64 int AbstractInterpreter::BasicType_as_index(BasicType type) {
  65   int i = 0;
  66   switch (type) {
  67     case T_BOOLEAN: i = 0; break;
  68     case T_CHAR   : i = 1; break;
  69     case T_BYTE   : i = 2; break;
  70     case T_SHORT  : i = 3; break;
  71     case T_INT    : i = 4; break;
  72     case T_LONG   : i = 5; break;
  73     case T_VOID   : i = 6; break;
  74     case T_FLOAT  : i = 7; break;
  75     case T_DOUBLE : i = 8; break;
  76     case T_OBJECT : i = 9; break;
  77     case T_ARRAY  : i = 9; break;
  78     default       : ShouldNotReachHere();
  79   }
  80   assert(0 <= i && i < AbstractInterpreter::number_of_result_handlers, "index out of bounds");
  81   return i;
  82 }
  83 
  84 address AbstractInterpreterGenerator::generate_slow_signature_handler() {
  85   // Slow_signature handler that respects the PPC C calling conventions.
  86   //
  87   // We get called by the native entry code with our output register
  88   // area == 8. First we call InterpreterRuntime::get_result_handler
  89   // to copy the pointer to the signature string temporarily to the
  90   // first C-argument and to return the result_handler in
  91   // R3_RET. Since native_entry will copy the jni-pointer to the
  92   // first C-argument slot later on, it is OK to occupy this slot
  93   // temporarilly. Then we copy the argument list on the java
  94   // expression stack into native varargs format on the native stack
  95   // and load arguments into argument registers. Integer arguments in
  96   // the varargs vector will be sign-extended to 8 bytes.
  97   //
  98   // On entry:
  99   //   R3_ARG1        - intptr_t*     Address of java argument list in memory.
 100   //   R15_prev_state - BytecodeInterpreter* Address of interpreter state for
 101   //     this method
 102   //   R19_method
 103   //
 104   // On exit (just before return instruction):
 105   //   R3_RET            - contains the address of the result_handler.
 106   //   R4_ARG2           - is not updated for static methods and contains "this" otherwise.
 107   //   R5_ARG3-R10_ARG8: - When the (i-2)th Java argument is not of type float or double,
 108   //                       ARGi contains this argument. Otherwise, ARGi is not updated.
 109   //   F1_ARG1-F13_ARG13 - contain the first 13 arguments of type float or double.
 110 
 111   const int LogSizeOfTwoInstructions = 3;
 112 
 113   // FIXME: use Argument:: GL: Argument names different numbers!
 114   const int max_fp_register_arguments  = 13;
 115   const int max_int_register_arguments = 6;  // first 2 are reserved
 116 
 117   const Register arg_java       = R21_tmp1;
 118   const Register arg_c          = R22_tmp2;
 119   const Register signature      = R23_tmp3;  // is string
 120   const Register sig_byte       = R24_tmp4;
 121   const Register fpcnt          = R25_tmp5;
 122   const Register argcnt         = R26_tmp6;
 123   const Register intSlot        = R27_tmp7;
 124   const Register target_sp      = R28_tmp8;
 125   const FloatRegister floatSlot = F0;
 126 
 127   address entry = __ function_entry();
 128 
 129   __ save_LR_CR(R0);
 130   __ save_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14));
 131   // We use target_sp for storing arguments in the C frame.
 132   __ mr(target_sp, R1_SP);
 133   __ push_frame_reg_args_nonvolatiles(0, R11_scratch1);
 134 
 135   __ mr(arg_java, R3_ARG1);
 136 
 137   __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_signature), R16_thread, R19_method);
 138 
 139   // Signature is in R3_RET. Signature is callee saved.
 140   __ mr(signature, R3_RET);
 141 
 142   // Get the result handler.
 143   __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::get_result_handler), R16_thread, R19_method);
 144 
 145   {
 146     Label L;
 147     // test if static
 148     // _access_flags._flags must be at offset 0.
 149     // TODO PPC port: requires change in shared code.
 150     //assert(in_bytes(AccessFlags::flags_offset()) == 0,
 151     //       "MethodDesc._access_flags == MethodDesc._access_flags._flags");
 152     // _access_flags must be a 32 bit value.
 153     assert(sizeof(AccessFlags) == 4, "wrong size");
 154     __ lwa(R11_scratch1/*access_flags*/, method_(access_flags));
 155     // testbit with condition register.
 156     __ testbitdi(CCR0, R0, R11_scratch1/*access_flags*/, JVM_ACC_STATIC_BIT);
 157     __ btrue(CCR0, L);
 158     // For non-static functions, pass "this" in R4_ARG2 and copy it
 159     // to 2nd C-arg slot.
 160     // We need to box the Java object here, so we use arg_java
 161     // (address of current Java stack slot) as argument and don't
 162     // dereference it as in case of ints, floats, etc.
 163     __ mr(R4_ARG2, arg_java);
 164     __ addi(arg_java, arg_java, -BytesPerWord);
 165     __ std(R4_ARG2, _abi(carg_2), target_sp);
 166     __ bind(L);
 167   }
 168 
 169   // Will be incremented directly after loop_start. argcnt=0
 170   // corresponds to 3rd C argument.
 171   __ li(argcnt, -1);
 172   // arg_c points to 3rd C argument
 173   __ addi(arg_c, target_sp, _abi(carg_3));
 174   // no floating-point args parsed so far
 175   __ li(fpcnt, 0);
 176 
 177   Label move_intSlot_to_ARG, move_floatSlot_to_FARG;
 178   Label loop_start, loop_end;
 179   Label do_int, do_long, do_float, do_double, do_dontreachhere, do_object, do_array, do_boxed;
 180 
 181   // signature points to '(' at entry
 182 #ifdef ASSERT
 183   __ lbz(sig_byte, 0, signature);
 184   __ cmplwi(CCR0, sig_byte, '(');
 185   __ bne(CCR0, do_dontreachhere);
 186 #endif
 187 
 188   __ bind(loop_start);
 189 
 190   __ addi(argcnt, argcnt, 1);
 191   __ lbzu(sig_byte, 1, signature);
 192 
 193   __ cmplwi(CCR0, sig_byte, ')'); // end of signature
 194   __ beq(CCR0, loop_end);
 195 
 196   __ cmplwi(CCR0, sig_byte, 'B'); // byte
 197   __ beq(CCR0, do_int);
 198 
 199   __ cmplwi(CCR0, sig_byte, 'C'); // char
 200   __ beq(CCR0, do_int);
 201 
 202   __ cmplwi(CCR0, sig_byte, 'D'); // double
 203   __ beq(CCR0, do_double);
 204 
 205   __ cmplwi(CCR0, sig_byte, 'F'); // float
 206   __ beq(CCR0, do_float);
 207 
 208   __ cmplwi(CCR0, sig_byte, 'I'); // int
 209   __ beq(CCR0, do_int);
 210 
 211   __ cmplwi(CCR0, sig_byte, 'J'); // long
 212   __ beq(CCR0, do_long);
 213 
 214   __ cmplwi(CCR0, sig_byte, 'S'); // short
 215   __ beq(CCR0, do_int);
 216 
 217   __ cmplwi(CCR0, sig_byte, 'Z'); // boolean
 218   __ beq(CCR0, do_int);
 219 
 220   __ cmplwi(CCR0, sig_byte, 'L'); // object
 221   __ beq(CCR0, do_object);
 222 
 223   __ cmplwi(CCR0, sig_byte, '['); // array
 224   __ beq(CCR0, do_array);
 225 
 226   //  __ cmplwi(CCR0, sig_byte, 'V'); // void cannot appear since we do not parse the return type
 227   //  __ beq(CCR0, do_void);
 228 
 229   __ bind(do_dontreachhere);
 230 
 231   __ unimplemented("ShouldNotReachHere in slow_signature_handler", 120);
 232 
 233   __ bind(do_array);
 234 
 235   {
 236     Label start_skip, end_skip;
 237 
 238     __ bind(start_skip);
 239     __ lbzu(sig_byte, 1, signature);
 240     __ cmplwi(CCR0, sig_byte, '[');
 241     __ beq(CCR0, start_skip); // skip further brackets
 242     __ cmplwi(CCR0, sig_byte, '9');
 243     __ bgt(CCR0, end_skip);   // no optional size
 244     __ cmplwi(CCR0, sig_byte, '0');
 245     __ bge(CCR0, start_skip); // skip optional size
 246     __ bind(end_skip);
 247 
 248     __ cmplwi(CCR0, sig_byte, 'L');
 249     __ beq(CCR0, do_object);  // for arrays of objects, the name of the object must be skipped
 250     __ b(do_boxed);          // otherwise, go directly to do_boxed
 251   }
 252 
 253   __ bind(do_object);
 254   {
 255     Label L;
 256     __ bind(L);
 257     __ lbzu(sig_byte, 1, signature);
 258     __ cmplwi(CCR0, sig_byte, ';');
 259     __ bne(CCR0, L);
 260    }
 261   // Need to box the Java object here, so we use arg_java (address of
 262   // current Java stack slot) as argument and don't dereference it as
 263   // in case of ints, floats, etc.
 264   Label do_null;
 265   __ bind(do_boxed);
 266   __ ld(R0,0, arg_java);
 267   __ cmpdi(CCR0, R0, 0);
 268   __ li(intSlot,0);
 269   __ beq(CCR0, do_null);
 270   __ mr(intSlot, arg_java);
 271   __ bind(do_null);
 272   __ std(intSlot, 0, arg_c);
 273   __ addi(arg_java, arg_java, -BytesPerWord);
 274   __ addi(arg_c, arg_c, BytesPerWord);
 275   __ cmplwi(CCR0, argcnt, max_int_register_arguments);
 276   __ blt(CCR0, move_intSlot_to_ARG);
 277   __ b(loop_start);
 278 
 279   __ bind(do_int);
 280   __ lwa(intSlot, 0, arg_java);
 281   __ std(intSlot, 0, arg_c);
 282   __ addi(arg_java, arg_java, -BytesPerWord);
 283   __ addi(arg_c, arg_c, BytesPerWord);
 284   __ cmplwi(CCR0, argcnt, max_int_register_arguments);
 285   __ blt(CCR0, move_intSlot_to_ARG);
 286   __ b(loop_start);
 287 
 288   __ bind(do_long);
 289   __ ld(intSlot, -BytesPerWord, arg_java);
 290   __ std(intSlot, 0, arg_c);
 291   __ addi(arg_java, arg_java, - 2 * BytesPerWord);
 292   __ addi(arg_c, arg_c, BytesPerWord);
 293   __ cmplwi(CCR0, argcnt, max_int_register_arguments);
 294   __ blt(CCR0, move_intSlot_to_ARG);
 295   __ b(loop_start);
 296 
 297   __ bind(do_float);
 298   __ lfs(floatSlot, 0, arg_java);
 299 #if defined(LINUX)
 300   __ stfs(floatSlot, 4, arg_c);
 301 #elif defined(AIX)
 302   __ stfs(floatSlot, 0, arg_c);
 303 #else
 304 #error "unknown OS"
 305 #endif
 306   __ addi(arg_java, arg_java, -BytesPerWord);
 307   __ addi(arg_c, arg_c, BytesPerWord);
 308   __ cmplwi(CCR0, fpcnt, max_fp_register_arguments);
 309   __ blt(CCR0, move_floatSlot_to_FARG);
 310   __ b(loop_start);
 311 
 312   __ bind(do_double);
 313   __ lfd(floatSlot, - BytesPerWord, arg_java);
 314   __ stfd(floatSlot, 0, arg_c);
 315   __ addi(arg_java, arg_java, - 2 * BytesPerWord);
 316   __ addi(arg_c, arg_c, BytesPerWord);
 317   __ cmplwi(CCR0, fpcnt, max_fp_register_arguments);
 318   __ blt(CCR0, move_floatSlot_to_FARG);
 319   __ b(loop_start);
 320 
 321   __ bind(loop_end);
 322 
 323   __ pop_frame();
 324   __ restore_nonvolatile_gprs(R1_SP, _spill_nonvolatiles_neg(r14));
 325   __ restore_LR_CR(R0);
 326 
 327   __ blr();
 328 
 329   Label move_int_arg, move_float_arg;
 330   __ bind(move_int_arg); // each case must consist of 2 instructions (otherwise adapt LogSizeOfTwoInstructions)
 331   __ mr(R5_ARG3, intSlot);  __ b(loop_start);
 332   __ mr(R6_ARG4, intSlot);  __ b(loop_start);
 333   __ mr(R7_ARG5, intSlot);  __ b(loop_start);
 334   __ mr(R8_ARG6, intSlot);  __ b(loop_start);
 335   __ mr(R9_ARG7, intSlot);  __ b(loop_start);
 336   __ mr(R10_ARG8, intSlot); __ b(loop_start);
 337 
 338   __ bind(move_float_arg); // each case must consist of 2 instructions (otherwise adapt LogSizeOfTwoInstructions)
 339   __ fmr(F1_ARG1, floatSlot);   __ b(loop_start);
 340   __ fmr(F2_ARG2, floatSlot);   __ b(loop_start);
 341   __ fmr(F3_ARG3, floatSlot);   __ b(loop_start);
 342   __ fmr(F4_ARG4, floatSlot);   __ b(loop_start);
 343   __ fmr(F5_ARG5, floatSlot);   __ b(loop_start);
 344   __ fmr(F6_ARG6, floatSlot);   __ b(loop_start);
 345   __ fmr(F7_ARG7, floatSlot);   __ b(loop_start);
 346   __ fmr(F8_ARG8, floatSlot);   __ b(loop_start);
 347   __ fmr(F9_ARG9, floatSlot);   __ b(loop_start);
 348   __ fmr(F10_ARG10, floatSlot); __ b(loop_start);
 349   __ fmr(F11_ARG11, floatSlot); __ b(loop_start);
 350   __ fmr(F12_ARG12, floatSlot); __ b(loop_start);
 351   __ fmr(F13_ARG13, floatSlot); __ b(loop_start);
 352 
 353   __ bind(move_intSlot_to_ARG);
 354   __ sldi(R0, argcnt, LogSizeOfTwoInstructions);
 355   __ load_const(R11_scratch1, move_int_arg); // Label must be bound here.
 356   __ add(R11_scratch1, R0, R11_scratch1);
 357   __ mtctr(R11_scratch1/*branch_target*/);
 358   __ bctr();
 359   __ bind(move_floatSlot_to_FARG);
 360   __ sldi(R0, fpcnt, LogSizeOfTwoInstructions);
 361   __ addi(fpcnt, fpcnt, 1);
 362   __ load_const(R11_scratch1, move_float_arg); // Label must be bound here.
 363   __ add(R11_scratch1, R0, R11_scratch1);
 364   __ mtctr(R11_scratch1/*branch_target*/);
 365   __ bctr();
 366 
 367   return entry;
 368 }
 369 
 370 address AbstractInterpreterGenerator::generate_result_handler_for(BasicType type) {
 371   //
 372   // Registers alive
 373   //   R3_RET
 374   //   LR
 375   //
 376   // Registers updated
 377   //   R3_RET
 378   //
 379 
 380   Label done;
 381   address entry = __ pc();
 382 
 383   switch (type) {
 384   case T_BOOLEAN:
 385     // convert !=0 to 1
 386     __ neg(R0, R3_RET);
 387     __ orr(R0, R3_RET, R0);
 388     __ srwi(R3_RET, R0, 31);
 389     break;
 390   case T_BYTE:
 391      // sign extend 8 bits
 392      __ extsb(R3_RET, R3_RET);
 393      break;
 394   case T_CHAR:
 395      // zero extend 16 bits
 396      __ clrldi(R3_RET, R3_RET, 48);
 397      break;
 398   case T_SHORT:
 399      // sign extend 16 bits
 400      __ extsh(R3_RET, R3_RET);
 401      break;
 402   case T_INT:
 403      // sign extend 32 bits
 404      __ extsw(R3_RET, R3_RET);
 405      break;
 406   case T_LONG:
 407      break;
 408   case T_OBJECT:
 409     // unbox result if not null
 410     __ cmpdi(CCR0, R3_RET, 0);
 411     __ beq(CCR0, done);
 412     __ ld(R3_RET, 0, R3_RET);
 413     __ verify_oop(R3_RET);
 414     break;
 415   case T_FLOAT:
 416      break;
 417   case T_DOUBLE:
 418      break;
 419   case T_VOID:
 420      break;
 421   default: ShouldNotReachHere();
 422   }
 423 
 424   __ BIND(done);
 425   __ blr();
 426 
 427   return entry;
 428 }
 429 
 430 // Call an accessor method (assuming it is resolved, otherwise drop into
 431 // vanilla (slow path) entry.
 432 address InterpreterGenerator::generate_jump_to_normal_entry(void) {
 433   address entry = __ pc();
 434   address normal_entry = Interpreter::entry_for_kind(Interpreter::zerolocals);
 435   assert(normal_entry != NULL, "should already be generated.");
 436   __ branch_to_entry(normal_entry, R11_scratch1);
 437   __ flush();
 438 
 439   return entry;
 440 }
 441 
 442 // Abstract method entry.
 443 //
 444 address InterpreterGenerator::generate_abstract_entry(void) {
 445   address entry = __ pc();
 446 
 447   //
 448   // Registers alive
 449   //   R16_thread     - JavaThread*
 450   //   R19_method     - callee's method (method to be invoked)
 451   //   R1_SP          - SP prepared such that caller's outgoing args are near top
 452   //   LR             - return address to caller
 453   //
 454   // Stack layout at this point:
 455   //
 456   //   0       [TOP_IJAVA_FRAME_ABI]         <-- R1_SP
 457   //           alignment (optional)
 458   //           [outgoing Java arguments]
 459   //           ...
 460   //   PARENT  [PARENT_IJAVA_FRAME_ABI]
 461   //            ...
 462   //
 463 
 464   // Can't use call_VM here because we have not set up a new
 465   // interpreter state. Make the call to the vm and make it look like
 466   // our caller set up the JavaFrameAnchor.
 467   __ set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R12_scratch2/*tmp*/);
 468 
 469   // Push a new C frame and save LR.
 470   __ save_LR_CR(R0);
 471   __ push_frame_reg_args(0, R11_scratch1);
 472 
 473   // This is not a leaf but we have a JavaFrameAnchor now and we will
 474   // check (create) exceptions afterward so this is ok.
 475   __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError),
 476                   R16_thread);
 477 
 478   // Pop the C frame and restore LR.
 479   __ pop_frame();
 480   __ restore_LR_CR(R0);
 481 
 482   // Reset JavaFrameAnchor from call_VM_leaf above.
 483   __ reset_last_Java_frame();
 484 
 485 #ifdef CC_INTERP
 486   // Return to frame manager, it will handle the pending exception.
 487   __ blr();
 488 #else
 489   // We don't know our caller, so jump to the general forward exception stub,
 490   // which will also pop our full frame off. Satisfy the interface of
 491   // SharedRuntime::generate_forward_exception()
 492   __ load_const_optimized(R11_scratch1, StubRoutines::forward_exception_entry(), R0);
 493   __ mtctr(R11_scratch1);
 494   __ bctr();
 495 #endif
 496 
 497   return entry;
 498 }
 499 
 500 // Interpreter intrinsic for WeakReference.get().
 501 // 1. Don't push a full blown frame and go on dispatching, but fetch the value
 502 //    into R8 and return quickly
 503 // 2. If G1 is active we *must* execute this intrinsic for corrrectness:
 504 //    It contains a GC barrier which puts the reference into the satb buffer
 505 //    to indicate that someone holds a strong reference to the object the
 506 //    weak ref points to!
 507 address InterpreterGenerator::generate_Reference_get_entry(void) {
 508   // Code: _aload_0, _getfield, _areturn
 509   // parameter size = 1
 510   //
 511   // The code that gets generated by this routine is split into 2 parts:
 512   //    1. the "intrinsified" code for G1 (or any SATB based GC),
 513   //    2. the slow path - which is an expansion of the regular method entry.
 514   //
 515   // Notes:
 516   // * In the G1 code we do not check whether we need to block for
 517   //   a safepoint. If G1 is enabled then we must execute the specialized
 518   //   code for Reference.get (except when the Reference object is null)
 519   //   so that we can log the value in the referent field with an SATB
 520   //   update buffer.
 521   //   If the code for the getfield template is modified so that the
 522   //   G1 pre-barrier code is executed when the current method is
 523   //   Reference.get() then going through the normal method entry
 524   //   will be fine.
 525   // * The G1 code can, however, check the receiver object (the instance
 526   //   of java.lang.Reference) and jump to the slow path if null. If the
 527   //   Reference object is null then we obviously cannot fetch the referent
 528   //   and so we don't need to call the G1 pre-barrier. Thus we can use the
 529   //   regular method entry code to generate the NPE.
 530   //
 531 
 532   address entry = __ pc();
 533 
 534   const int referent_offset = java_lang_ref_Reference::referent_offset;
 535   guarantee(referent_offset > 0, "referent offset not initialized");
 536 
 537   if (UseG1GC) {
 538      Label slow_path;
 539 
 540     // Debugging not possible, so can't use __ skip_if_jvmti_mode(slow_path, GR31_SCRATCH);
 541 
 542     // In the G1 code we don't check if we need to reach a safepoint. We
 543     // continue and the thread will safepoint at the next bytecode dispatch.
 544 
 545     // If the receiver is null then it is OK to jump to the slow path.
 546     __ ld(R3_RET, Interpreter::stackElementSize, CC_INTERP_ONLY(R17_tos) NOT_CC_INTERP(R15_esp)); // get receiver
 547 
 548     // Check if receiver == NULL and go the slow path.
 549     __ cmpdi(CCR0, R3_RET, 0);
 550     __ beq(CCR0, slow_path);
 551 
 552     // Load the value of the referent field.
 553     __ load_heap_oop(R3_RET, referent_offset, R3_RET);
 554 
 555     // Generate the G1 pre-barrier code to log the value of
 556     // the referent field in an SATB buffer. Note with
 557     // these parameters the pre-barrier does not generate
 558     // the load of the previous value.
 559 
 560     // Restore caller sp for c2i case.
 561 #ifdef ASSERT
 562       __ ld(R9_ARG7, 0, R1_SP);
 563       __ ld(R10_ARG8, 0, R21_sender_SP);
 564       __ cmpd(CCR0, R9_ARG7, R10_ARG8);
 565       __ asm_assert_eq("backlink", 0x544);
 566 #endif // ASSERT
 567     __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started.
 568 
 569     __ g1_write_barrier_pre(noreg,         // obj
 570                             noreg,         // offset
 571                             R3_RET,        // pre_val
 572                             R11_scratch1,  // tmp
 573                             R12_scratch2,  // tmp
 574                             true);         // needs_frame
 575 
 576     __ blr();
 577 
 578     // Generate regular method entry.
 579     __ bind(slow_path);
 580     __ branch_to_entry(Interpreter::entry_for_kind(Interpreter::zerolocals), R11_scratch1);
 581     __ flush();
 582 
 583     return entry;
 584   } else {
 585     return generate_jump_to_normal_entry();
 586   }
 587 }
 588 
 589 void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) {
 590   // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in
 591   // the days we had adapter frames. When we deoptimize a situation where a
 592   // compiled caller calls a compiled caller will have registers it expects
 593   // to survive the call to the callee. If we deoptimize the callee the only
 594   // way we can restore these registers is to have the oldest interpreter
 595   // frame that we create restore these values. That is what this routine
 596   // will accomplish.
 597 
 598   // At the moment we have modified c2 to not have any callee save registers
 599   // so this problem does not exist and this routine is just a place holder.
 600 
 601   assert(f->is_interpreted_frame(), "must be interpreted");
 602 }