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 // Abstract method entry.
 431 //
 432 address InterpreterGenerator::generate_abstract_entry(void) {
 433   address entry = __ pc();
 434 
 435   //
 436   // Registers alive
 437   //   R16_thread     - JavaThread*
 438   //   R19_method     - callee's method (method to be invoked)
 439   //   R1_SP          - SP prepared such that caller's outgoing args are near top
 440   //   LR             - return address to caller
 441   //
 442   // Stack layout at this point:
 443   //
 444   //   0       [TOP_IJAVA_FRAME_ABI]         <-- R1_SP
 445   //           alignment (optional)
 446   //           [outgoing Java arguments]
 447   //           ...
 448   //   PARENT  [PARENT_IJAVA_FRAME_ABI]
 449   //            ...
 450   //
 451 
 452   // Can't use call_VM here because we have not set up a new
 453   // interpreter state. Make the call to the vm and make it look like
 454   // our caller set up the JavaFrameAnchor.
 455   __ set_top_ijava_frame_at_SP_as_last_Java_frame(R1_SP, R12_scratch2/*tmp*/);
 456 
 457   // Push a new C frame and save LR.
 458   __ save_LR_CR(R0);
 459   __ push_frame_reg_args(0, R11_scratch1);
 460 
 461   // This is not a leaf but we have a JavaFrameAnchor now and we will
 462   // check (create) exceptions afterward so this is ok.
 463   __ call_VM_leaf(CAST_FROM_FN_PTR(address, InterpreterRuntime::throw_AbstractMethodError),
 464                   R16_thread);
 465 
 466   // Pop the C frame and restore LR.
 467   __ pop_frame();
 468   __ restore_LR_CR(R0);
 469 
 470   // Reset JavaFrameAnchor from call_VM_leaf above.
 471   __ reset_last_Java_frame();
 472 
 473 #ifdef CC_INTERP
 474   // Return to frame manager, it will handle the pending exception.
 475   __ blr();
 476 #else
 477   // We don't know our caller, so jump to the general forward exception stub,
 478   // which will also pop our full frame off. Satisfy the interface of
 479   // SharedRuntime::generate_forward_exception()
 480   __ load_const_optimized(R11_scratch1, StubRoutines::forward_exception_entry(), R0);
 481   __ mtctr(R11_scratch1);
 482   __ bctr();
 483 #endif
 484 
 485   return entry;
 486 }
 487 
 488 // Interpreter intrinsic for WeakReference.get().
 489 // 1. Don't push a full blown frame and go on dispatching, but fetch the value
 490 //    into R8 and return quickly
 491 // 2. If G1 is active we *must* execute this intrinsic for corrrectness:
 492 //    It contains a GC barrier which puts the reference into the satb buffer
 493 //    to indicate that someone holds a strong reference to the object the
 494 //    weak ref points to!
 495 address InterpreterGenerator::generate_Reference_get_entry(void) {
 496   // Code: _aload_0, _getfield, _areturn
 497   // parameter size = 1
 498   //
 499   // The code that gets generated by this routine is split into 2 parts:
 500   //    1. the "intrinsified" code for G1 (or any SATB based GC),
 501   //    2. the slow path - which is an expansion of the regular method entry.
 502   //
 503   // Notes:
 504   // * In the G1 code we do not check whether we need to block for
 505   //   a safepoint. If G1 is enabled then we must execute the specialized
 506   //   code for Reference.get (except when the Reference object is null)
 507   //   so that we can log the value in the referent field with an SATB
 508   //   update buffer.
 509   //   If the code for the getfield template is modified so that the
 510   //   G1 pre-barrier code is executed when the current method is
 511   //   Reference.get() then going through the normal method entry
 512   //   will be fine.
 513   // * The G1 code can, however, check the receiver object (the instance
 514   //   of java.lang.Reference) and jump to the slow path if null. If the
 515   //   Reference object is null then we obviously cannot fetch the referent
 516   //   and so we don't need to call the G1 pre-barrier. Thus we can use the
 517   //   regular method entry code to generate the NPE.
 518   //
 519 
 520   if (UseG1GC) {
 521     address entry = __ pc();
 522 
 523     const int referent_offset = java_lang_ref_Reference::referent_offset;
 524     guarantee(referent_offset > 0, "referent offset not initialized");
 525 
 526     Label slow_path;
 527 
 528     // Debugging not possible, so can't use __ skip_if_jvmti_mode(slow_path, GR31_SCRATCH);
 529 
 530     // In the G1 code we don't check if we need to reach a safepoint. We
 531     // continue and the thread will safepoint at the next bytecode dispatch.
 532 
 533     // If the receiver is null then it is OK to jump to the slow path.
 534     __ ld(R3_RET, Interpreter::stackElementSize, CC_INTERP_ONLY(R17_tos) NOT_CC_INTERP(R15_esp)); // get receiver
 535 
 536     // Check if receiver == NULL and go the slow path.
 537     __ cmpdi(CCR0, R3_RET, 0);
 538     __ beq(CCR0, slow_path);
 539 
 540     // Load the value of the referent field.
 541     __ load_heap_oop(R3_RET, referent_offset, R3_RET);
 542 
 543     // Generate the G1 pre-barrier code to log the value of
 544     // the referent field in an SATB buffer. Note with
 545     // these parameters the pre-barrier does not generate
 546     // the load of the previous value.
 547 
 548     // Restore caller sp for c2i case.
 549 #ifdef ASSERT
 550       __ ld(R9_ARG7, 0, R1_SP);
 551       __ ld(R10_ARG8, 0, R21_sender_SP);
 552       __ cmpd(CCR0, R9_ARG7, R10_ARG8);
 553       __ asm_assert_eq("backlink", 0x544);
 554 #endif // ASSERT
 555     __ mr(R1_SP, R21_sender_SP); // Cut the stack back to where the caller started.
 556 
 557     __ g1_write_barrier_pre(noreg,         // obj
 558                             noreg,         // offset
 559                             R3_RET,        // pre_val
 560                             R11_scratch1,  // tmp
 561                             R12_scratch2,  // tmp
 562                             true);         // needs_frame
 563 
 564     __ blr();
 565 
 566     // Generate regular method entry.
 567     __ bind(slow_path);
 568     __ jump_to_entry(Interpreter::entry_for_kind(Interpreter::zerolocals), R11_scratch1);
 569     return entry;
 570   }
 571 
 572   return NULL;
 573 }
 574 
 575 void Deoptimization::unwind_callee_save_values(frame* f, vframeArray* vframe_array) {
 576   // This code is sort of the equivalent of C2IAdapter::setup_stack_frame back in
 577   // the days we had adapter frames. When we deoptimize a situation where a
 578   // compiled caller calls a compiled caller will have registers it expects
 579   // to survive the call to the callee. If we deoptimize the callee the only
 580   // way we can restore these registers is to have the oldest interpreter
 581   // frame that we create restore these values. That is what this routine
 582   // will accomplish.
 583 
 584   // At the moment we have modified c2 to not have any callee save registers
 585   // so this problem does not exist and this routine is just a place holder.
 586 
 587   assert(f->is_interpreted_frame(), "must be interpreted");
 588 }