Print this page
rev 1021 : 6858164: invokedynamic code needs some cleanup (post-6655638)
Note: The bug ID for this change set was erroneously used to call for review of 6815692.
Summary: Fix several crashers, remove needless paths for boxed-style bootstrap method call, refactor & simplify APIs for rewriter constantPoolOop, remove sun.dyn.CallSiteImpl
Reviewed-by: ?
rev 1022 : 6829192: JSR 292 needs to support 64-bit x86
Summary: changes for method handles and invokedynamic
Reviewed-by: ?, ?

Split Close
Expand all
Collapse all
          --- old/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
          +++ new/src/cpu/x86/vm/templateInterpreter_x86_64.cpp
↓ open down ↓ 92 lines elided ↑ open up ↑
  93   93    __ empty_expression_stack();
  94   94  
  95   95    __ call_VM(noreg,
  96   96               CAST_FROM_FN_PTR(address,
  97   97                                InterpreterRuntime::
  98   98                                throw_ClassCastException),
  99   99               c_rarg1);
 100  100    return entry;
 101  101  }
 102  102  
 103      -// Arguments are: required type in rarg1, failing object (or NULL) in rarg2
      103 +// Arguments are: required type at TOS+8, failing object (or NULL) at TOS+4.
 104  104  address TemplateInterpreterGenerator::generate_WrongMethodType_handler() {
 105  105    address entry = __ pc();
 106  106  
 107  107    __ pop(c_rarg2);              // failing object is at TOS
 108  108    __ pop(c_rarg1);              // required type is at TOS+8
 109  109  
 110      -  // expression stack must be empty before entering the VM if an
 111      -  // exception happened
      110 +  __ verify_oop(c_rarg1);
      111 +  __ verify_oop(c_rarg2);
      112 +
      113 +  // Various method handle types use interpreter registers as temps.
      114 +  __ restore_bcp();
      115 +  __ restore_locals();
      116 +
      117 +  // Expression stack must be empty before entering the VM for an exception.
 112  118    __ empty_expression_stack();
 113  119  
 114  120    __ call_VM(noreg,
 115  121               CAST_FROM_FN_PTR(address,
 116      -                              InterpreterRuntime::
 117      -                              throw_WrongMethodTypeException),
      122 +                              InterpreterRuntime::throw_WrongMethodTypeException),
 118  123               // pass required type, failing object (or NULL)
 119  124               c_rarg1, c_rarg2);
 120  125    return entry;
 121  126  }
 122  127  
 123  128  address TemplateInterpreterGenerator::generate_exception_handler_common(
 124  129          const char* name, const char* message, bool pass_oop) {
 125  130    assert(!pass_oop || message == NULL, "either oop or message but not both");
 126  131    address entry = __ pc();
 127  132    if (pass_oop) {
↓ open down ↓ 47 lines elided ↑ open up ↑
 175  180    address entry = __ pc();
 176  181  
 177  182    // Restore stack bottom in case i2c adjusted stack
 178  183    __ movptr(rsp, Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize));
 179  184    // and NULL it as marker that esp is now tos until next java call
 180  185    __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
 181  186  
 182  187    __ restore_bcp();
 183  188    __ restore_locals();
 184  189  
 185      -  __ get_cache_and_index_at_bcp(rbx, rcx, 1);
      190 +  Label L_got_cache, L_giant_index;
      191 +  if (EnableInvokeDynamic) {
      192 +    __ cmpb(Address(r13, 0), Bytecodes::_invokedynamic);
      193 +    __ jcc(Assembler::equal, L_giant_index);
      194 +  }
      195 +  __ get_cache_and_index_at_bcp(rbx, rcx, 1, false);
      196 +  __ bind(L_got_cache);
 186  197    __ movl(rbx, Address(rbx, rcx,
 187      -                       Address::times_8,
      198 +                       Address::times_ptr,
 188  199                         in_bytes(constantPoolCacheOopDesc::base_offset()) +
 189  200                         3 * wordSize));
 190  201    __ andl(rbx, 0xFF);
 191  202    if (TaggedStackInterpreter) __ shll(rbx, 1); // 2 slots per parameter.
 192  203    __ lea(rsp, Address(rsp, rbx, Address::times_8));
 193  204    __ dispatch_next(state, step);
      205 +
      206 +  // out of the main line of code...
      207 +  if (EnableInvokeDynamic) {
      208 +    __ bind(L_giant_index);
      209 +    __ get_cache_and_index_at_bcp(rbx, rcx, 1, true);
      210 +    __ jmp(L_got_cache);
      211 +  }
      212 +
 194  213    return entry;
 195  214  }
 196  215  
 197  216  
 198  217  address TemplateInterpreterGenerator::generate_deopt_entry_for(TosState state,
 199  218                                                                 int step) {
 200  219    address entry = __ pc();
 201  220    // NULL last_sp until next java call
 202  221    __ movptr(Address(rbp, frame::interpreter_frame_last_sp_offset * wordSize), (int32_t)NULL_WORD);
 203  222    __ restore_bcp();
↓ open down ↓ 1647 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX