src/hotspot/share/interpreter/interpreterRuntime.cpp
changeset 54523 5df03f58d25b
parent 53994 77343f5c85cb
child 54752 3fbaea4b1f1c
equal deleted inserted replaced
54522:60bc754b9744 54523:5df03f58d25b
   154 
   154 
   155 //------------------------------------------------------------------------------------------------------------------------
   155 //------------------------------------------------------------------------------------------------------------------------
   156 // Constants
   156 // Constants
   157 
   157 
   158 
   158 
   159 IRT_ENTRY(void, InterpreterRuntime::ldc(JavaThread* thread, bool wide))
   159 JRT_ENTRY(void, InterpreterRuntime::ldc(JavaThread* thread, bool wide))
   160   // access constant pool
   160   // access constant pool
   161   LastFrameAccessor last_frame(thread);
   161   LastFrameAccessor last_frame(thread);
   162   ConstantPool* pool = last_frame.method()->constants();
   162   ConstantPool* pool = last_frame.method()->constants();
   163   int index = wide ? last_frame.get_index_u2(Bytecodes::_ldc_w) : last_frame.get_index_u1(Bytecodes::_ldc);
   163   int index = wide ? last_frame.get_index_u2(Bytecodes::_ldc_w) : last_frame.get_index_u1(Bytecodes::_ldc);
   164   constantTag tag = pool->tag_at(index);
   164   constantTag tag = pool->tag_at(index);
   165 
   165 
   166   assert (tag.is_unresolved_klass() || tag.is_klass(), "wrong ldc call");
   166   assert (tag.is_unresolved_klass() || tag.is_klass(), "wrong ldc call");
   167   Klass* klass = pool->klass_at(index, CHECK);
   167   Klass* klass = pool->klass_at(index, CHECK);
   168     oop java_class = klass->java_mirror();
   168     oop java_class = klass->java_mirror();
   169     thread->set_vm_result(java_class);
   169     thread->set_vm_result(java_class);
   170 IRT_END
   170 JRT_END
   171 
   171 
   172 IRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::Code bytecode)) {
   172 JRT_ENTRY(void, InterpreterRuntime::resolve_ldc(JavaThread* thread, Bytecodes::Code bytecode)) {
   173   assert(bytecode == Bytecodes::_ldc ||
   173   assert(bytecode == Bytecodes::_ldc ||
   174          bytecode == Bytecodes::_ldc_w ||
   174          bytecode == Bytecodes::_ldc_w ||
   175          bytecode == Bytecodes::_ldc2_w ||
   175          bytecode == Bytecodes::_ldc2_w ||
   176          bytecode == Bytecodes::_fast_aldc ||
   176          bytecode == Bytecodes::_fast_aldc ||
   177          bytecode == Bytecodes::_fast_aldc_w, "wrong bc");
   177          bytecode == Bytecodes::_fast_aldc_w, "wrong bc");
   217     intptr_t flags = ((as_TosState(type) << ConstantPoolCacheEntry::tos_state_shift)
   217     intptr_t flags = ((as_TosState(type) << ConstantPoolCacheEntry::tos_state_shift)
   218                       | (offset & ConstantPoolCacheEntry::field_index_mask));
   218                       | (offset & ConstantPoolCacheEntry::field_index_mask));
   219     thread->set_vm_result_2((Metadata*)flags);
   219     thread->set_vm_result_2((Metadata*)flags);
   220   }
   220   }
   221 }
   221 }
   222 IRT_END
   222 JRT_END
   223 
   223 
   224 
   224 
   225 //------------------------------------------------------------------------------------------------------------------------
   225 //------------------------------------------------------------------------------------------------------------------------
   226 // Allocation
   226 // Allocation
   227 
   227 
   228 IRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, ConstantPool* pool, int index))
   228 JRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, ConstantPool* pool, int index))
   229   Klass* k = pool->klass_at(index, CHECK);
   229   Klass* k = pool->klass_at(index, CHECK);
   230   InstanceKlass* klass = InstanceKlass::cast(k);
   230   InstanceKlass* klass = InstanceKlass::cast(k);
   231 
   231 
   232   // Make sure we are not instantiating an abstract klass
   232   // Make sure we are not instantiating an abstract klass
   233   klass->check_valid_for_instantiation(true, CHECK);
   233   klass->check_valid_for_instantiation(true, CHECK);
   249   //       Java).
   249   //       Java).
   250   //       If we have a breakpoint, then we don't rewrite
   250   //       If we have a breakpoint, then we don't rewrite
   251   //       because the _breakpoint bytecode would be lost.
   251   //       because the _breakpoint bytecode would be lost.
   252   oop obj = klass->allocate_instance(CHECK);
   252   oop obj = klass->allocate_instance(CHECK);
   253   thread->set_vm_result(obj);
   253   thread->set_vm_result(obj);
   254 IRT_END
   254 JRT_END
   255 
   255 
   256 
   256 
   257 IRT_ENTRY(void, InterpreterRuntime::newarray(JavaThread* thread, BasicType type, jint size))
   257 JRT_ENTRY(void, InterpreterRuntime::newarray(JavaThread* thread, BasicType type, jint size))
   258   oop obj = oopFactory::new_typeArray(type, size, CHECK);
   258   oop obj = oopFactory::new_typeArray(type, size, CHECK);
   259   thread->set_vm_result(obj);
   259   thread->set_vm_result(obj);
   260 IRT_END
   260 JRT_END
   261 
   261 
   262 
   262 
   263 IRT_ENTRY(void, InterpreterRuntime::anewarray(JavaThread* thread, ConstantPool* pool, int index, jint size))
   263 JRT_ENTRY(void, InterpreterRuntime::anewarray(JavaThread* thread, ConstantPool* pool, int index, jint size))
   264   Klass*    klass = pool->klass_at(index, CHECK);
   264   Klass*    klass = pool->klass_at(index, CHECK);
   265   objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK);
   265   objArrayOop obj = oopFactory::new_objArray(klass, size, CHECK);
   266   thread->set_vm_result(obj);
   266   thread->set_vm_result(obj);
   267 IRT_END
   267 JRT_END
   268 
   268 
   269 
   269 
   270 IRT_ENTRY(void, InterpreterRuntime::multianewarray(JavaThread* thread, jint* first_size_address))
   270 JRT_ENTRY(void, InterpreterRuntime::multianewarray(JavaThread* thread, jint* first_size_address))
   271   // We may want to pass in more arguments - could make this slightly faster
   271   // We may want to pass in more arguments - could make this slightly faster
   272   LastFrameAccessor last_frame(thread);
   272   LastFrameAccessor last_frame(thread);
   273   ConstantPool* constants = last_frame.method()->constants();
   273   ConstantPool* constants = last_frame.method()->constants();
   274   int          i = last_frame.get_index_u2(Bytecodes::_multianewarray);
   274   int          i = last_frame.get_index_u2(Bytecodes::_multianewarray);
   275   Klass* klass   = constants->klass_at(i, CHECK);
   275   Klass* klass   = constants->klass_at(i, CHECK);
   290     int n = Interpreter::local_offset_in_bytes(index)/jintSize;
   290     int n = Interpreter::local_offset_in_bytes(index)/jintSize;
   291     dims[index] = first_size_address[n];
   291     dims[index] = first_size_address[n];
   292   }
   292   }
   293   oop obj = ArrayKlass::cast(klass)->multi_allocate(nof_dims, dims, CHECK);
   293   oop obj = ArrayKlass::cast(klass)->multi_allocate(nof_dims, dims, CHECK);
   294   thread->set_vm_result(obj);
   294   thread->set_vm_result(obj);
   295 IRT_END
   295 JRT_END
   296 
   296 
   297 
   297 
   298 IRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
   298 JRT_ENTRY(void, InterpreterRuntime::register_finalizer(JavaThread* thread, oopDesc* obj))
   299   assert(oopDesc::is_oop(obj), "must be a valid oop");
   299   assert(oopDesc::is_oop(obj), "must be a valid oop");
   300   assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
   300   assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
   301   InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
   301   InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
   302 IRT_END
   302 JRT_END
   303 
   303 
   304 
   304 
   305 // Quicken instance-of and check-cast bytecodes
   305 // Quicken instance-of and check-cast bytecodes
   306 IRT_ENTRY(void, InterpreterRuntime::quicken_io_cc(JavaThread* thread))
   306 JRT_ENTRY(void, InterpreterRuntime::quicken_io_cc(JavaThread* thread))
   307   // Force resolving; quicken the bytecode
   307   // Force resolving; quicken the bytecode
   308   LastFrameAccessor last_frame(thread);
   308   LastFrameAccessor last_frame(thread);
   309   int which = last_frame.get_index_u2(Bytecodes::_checkcast);
   309   int which = last_frame.get_index_u2(Bytecodes::_checkcast);
   310   ConstantPool* cpool = last_frame.method()->constants();
   310   ConstantPool* cpool = last_frame.method()->constants();
   311   // We'd expect to assert that we're only here to quicken bytecodes, but in a multithreaded
   311   // We'd expect to assert that we're only here to quicken bytecodes, but in a multithreaded
   312   // program we might have seen an unquick'd bytecode in the interpreter but have another
   312   // program we might have seen an unquick'd bytecode in the interpreter but have another
   313   // thread quicken the bytecode before we get here.
   313   // thread quicken the bytecode before we get here.
   314   // assert( cpool->tag_at(which).is_unresolved_klass(), "should only come here to quicken bytecodes" );
   314   // assert( cpool->tag_at(which).is_unresolved_klass(), "should only come here to quicken bytecodes" );
   315   Klass* klass = cpool->klass_at(which, CHECK);
   315   Klass* klass = cpool->klass_at(which, CHECK);
   316   thread->set_vm_result_2(klass);
   316   thread->set_vm_result_2(klass);
   317 IRT_END
   317 JRT_END
   318 
   318 
   319 
   319 
   320 //------------------------------------------------------------------------------------------------------------------------
   320 //------------------------------------------------------------------------------------------------------------------------
   321 // Exceptions
   321 // Exceptions
   322 
   322 
   352   note_trap_inner(thread, reason, trap_method, trap_bci, THREAD);
   352   note_trap_inner(thread, reason, trap_method, trap_bci, THREAD);
   353 }
   353 }
   354 
   354 
   355 #ifdef CC_INTERP
   355 #ifdef CC_INTERP
   356 // As legacy note_trap, but we have more arguments.
   356 // As legacy note_trap, but we have more arguments.
   357 IRT_ENTRY(void, InterpreterRuntime::note_trap(JavaThread* thread, int reason, Method *method, int trap_bci))
   357 JRT_ENTRY(void, InterpreterRuntime::note_trap(JavaThread* thread, int reason, Method *method, int trap_bci))
   358   methodHandle trap_method(method);
   358   methodHandle trap_method(method);
   359   note_trap_inner(thread, reason, trap_method, trap_bci, THREAD);
   359   note_trap_inner(thread, reason, trap_method, trap_bci, THREAD);
   360 IRT_END
   360 JRT_END
   361 
   361 
   362 // Class Deoptimization is not visible in BytecodeInterpreter, so we need a wrapper
   362 // Class Deoptimization is not visible in BytecodeInterpreter, so we need a wrapper
   363 // for each exception.
   363 // for each exception.
   364 void InterpreterRuntime::note_nullCheck_trap(JavaThread* thread, Method *method, int trap_bci)
   364 void InterpreterRuntime::note_nullCheck_trap(JavaThread* thread, Method *method, int trap_bci)
   365   { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_null_check, method, trap_bci); }
   365   { if (ProfileTraps) note_trap(thread, Deoptimization::Reason_null_check, method, trap_bci); }
   392 
   392 
   393 // Special handling for stack overflow: since we don't have any (java) stack
   393 // Special handling for stack overflow: since we don't have any (java) stack
   394 // space left we use the pre-allocated & pre-initialized StackOverflowError
   394 // space left we use the pre-allocated & pre-initialized StackOverflowError
   395 // klass to create an stack overflow error instance.  We do not call its
   395 // klass to create an stack overflow error instance.  We do not call its
   396 // constructor for the same reason (it is empty, anyway).
   396 // constructor for the same reason (it is empty, anyway).
   397 IRT_ENTRY(void, InterpreterRuntime::throw_StackOverflowError(JavaThread* thread))
   397 JRT_ENTRY(void, InterpreterRuntime::throw_StackOverflowError(JavaThread* thread))
   398   Handle exception = get_preinitialized_exception(
   398   Handle exception = get_preinitialized_exception(
   399                                  SystemDictionary::StackOverflowError_klass(),
   399                                  SystemDictionary::StackOverflowError_klass(),
   400                                  CHECK);
   400                                  CHECK);
   401   // Increment counter for hs_err file reporting
   401   // Increment counter for hs_err file reporting
   402   Atomic::inc(&Exceptions::_stack_overflow_errors);
   402   Atomic::inc(&Exceptions::_stack_overflow_errors);
   403   THROW_HANDLE(exception);
   403   THROW_HANDLE(exception);
   404 IRT_END
   404 JRT_END
   405 
   405 
   406 IRT_ENTRY(void, InterpreterRuntime::throw_delayed_StackOverflowError(JavaThread* thread))
   406 JRT_ENTRY(void, InterpreterRuntime::throw_delayed_StackOverflowError(JavaThread* thread))
   407   Handle exception = get_preinitialized_exception(
   407   Handle exception = get_preinitialized_exception(
   408                                  SystemDictionary::StackOverflowError_klass(),
   408                                  SystemDictionary::StackOverflowError_klass(),
   409                                  CHECK);
   409                                  CHECK);
   410   java_lang_Throwable::set_message(exception(),
   410   java_lang_Throwable::set_message(exception(),
   411           Universe::delayed_stack_overflow_error_message());
   411           Universe::delayed_stack_overflow_error_message());
   412   // Increment counter for hs_err file reporting
   412   // Increment counter for hs_err file reporting
   413   Atomic::inc(&Exceptions::_stack_overflow_errors);
   413   Atomic::inc(&Exceptions::_stack_overflow_errors);
   414   THROW_HANDLE(exception);
   414   THROW_HANDLE(exception);
   415 IRT_END
   415 JRT_END
   416 
   416 
   417 IRT_ENTRY(void, InterpreterRuntime::create_exception(JavaThread* thread, char* name, char* message))
   417 JRT_ENTRY(void, InterpreterRuntime::create_exception(JavaThread* thread, char* name, char* message))
   418   // lookup exception klass
   418   // lookup exception klass
   419   TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
   419   TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
   420   if (ProfileTraps) {
   420   if (ProfileTraps) {
   421     if (s == vmSymbols::java_lang_ArithmeticException()) {
   421     if (s == vmSymbols::java_lang_ArithmeticException()) {
   422       note_trap(thread, Deoptimization::Reason_div0_check, CHECK);
   422       note_trap(thread, Deoptimization::Reason_div0_check, CHECK);
   425     }
   425     }
   426   }
   426   }
   427   // create exception
   427   // create exception
   428   Handle exception = Exceptions::new_exception(thread, s, message);
   428   Handle exception = Exceptions::new_exception(thread, s, message);
   429   thread->set_vm_result(exception());
   429   thread->set_vm_result(exception());
   430 IRT_END
   430 JRT_END
   431 
   431 
   432 
   432 
   433 IRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj))
   433 JRT_ENTRY(void, InterpreterRuntime::create_klass_exception(JavaThread* thread, char* name, oopDesc* obj))
   434   // Produce the error message first because note_trap can safepoint
   434   // Produce the error message first because note_trap can safepoint
   435   ResourceMark rm(thread);
   435   ResourceMark rm(thread);
   436   const char* klass_name = obj->klass()->external_name();
   436   const char* klass_name = obj->klass()->external_name();
   437   // lookup exception klass
   437   // lookup exception klass
   438   TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
   438   TempNewSymbol s = SymbolTable::new_symbol(name, CHECK);
   440     note_trap(thread, Deoptimization::Reason_class_check, CHECK);
   440     note_trap(thread, Deoptimization::Reason_class_check, CHECK);
   441   }
   441   }
   442   // create exception, with klass name as detail message
   442   // create exception, with klass name as detail message
   443   Handle exception = Exceptions::new_exception(thread, s, klass_name);
   443   Handle exception = Exceptions::new_exception(thread, s, klass_name);
   444   thread->set_vm_result(exception());
   444   thread->set_vm_result(exception());
   445 IRT_END
   445 JRT_END
   446 
   446 
   447 IRT_ENTRY(void, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException(JavaThread* thread, arrayOopDesc* a, jint index))
   447 JRT_ENTRY(void, InterpreterRuntime::throw_ArrayIndexOutOfBoundsException(JavaThread* thread, arrayOopDesc* a, jint index))
   448   // Produce the error message first because note_trap can safepoint
   448   // Produce the error message first because note_trap can safepoint
   449   ResourceMark rm(thread);
   449   ResourceMark rm(thread);
   450   stringStream ss;
   450   stringStream ss;
   451   ss.print("Index %d out of bounds for length %d", index, a->length());
   451   ss.print("Index %d out of bounds for length %d", index, a->length());
   452 
   452 
   453   if (ProfileTraps) {
   453   if (ProfileTraps) {
   454     note_trap(thread, Deoptimization::Reason_range_check, CHECK);
   454     note_trap(thread, Deoptimization::Reason_range_check, CHECK);
   455   }
   455   }
   456 
   456 
   457   THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
   457   THROW_MSG(vmSymbols::java_lang_ArrayIndexOutOfBoundsException(), ss.as_string());
   458 IRT_END
   458 JRT_END
   459 
   459 
   460 IRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException(
   460 JRT_ENTRY(void, InterpreterRuntime::throw_ClassCastException(
   461   JavaThread* thread, oopDesc* obj))
   461   JavaThread* thread, oopDesc* obj))
   462 
   462 
   463   // Produce the error message first because note_trap can safepoint
   463   // Produce the error message first because note_trap can safepoint
   464   ResourceMark rm(thread);
   464   ResourceMark rm(thread);
   465   char* message = SharedRuntime::generate_class_cast_message(
   465   char* message = SharedRuntime::generate_class_cast_message(
   469     note_trap(thread, Deoptimization::Reason_class_check, CHECK);
   469     note_trap(thread, Deoptimization::Reason_class_check, CHECK);
   470   }
   470   }
   471 
   471 
   472   // create exception
   472   // create exception
   473   THROW_MSG(vmSymbols::java_lang_ClassCastException(), message);
   473   THROW_MSG(vmSymbols::java_lang_ClassCastException(), message);
   474 IRT_END
   474 JRT_END
   475 
   475 
   476 // exception_handler_for_exception(...) returns the continuation address,
   476 // exception_handler_for_exception(...) returns the continuation address,
   477 // the exception oop (via TLS) and sets the bci/bcp for the continuation.
   477 // the exception oop (via TLS) and sets the bci/bcp for the continuation.
   478 // The exception oop is returned to make sure it is preserved over GC (it
   478 // The exception oop is returned to make sure it is preserved over GC (it
   479 // is only on the stack if the exception was thrown explicitly via athrow).
   479 // is only on the stack if the exception was thrown explicitly via athrow).
   480 // During this operation, the expression stack contains the values for the
   480 // During this operation, the expression stack contains the values for the
   481 // bci where the exception happened. If the exception was propagated back
   481 // bci where the exception happened. If the exception was propagated back
   482 // from a call, the expression stack contains the values for the bci at the
   482 // from a call, the expression stack contains the values for the bci at the
   483 // invoke w/o arguments (i.e., as if one were inside the call).
   483 // invoke w/o arguments (i.e., as if one were inside the call).
   484 IRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThread* thread, oopDesc* exception))
   484 JRT_ENTRY(address, InterpreterRuntime::exception_handler_for_exception(JavaThread* thread, oopDesc* exception))
   485 
   485 
   486   LastFrameAccessor last_frame(thread);
   486   LastFrameAccessor last_frame(thread);
   487   Handle             h_exception(thread, exception);
   487   Handle             h_exception(thread, exception);
   488   methodHandle       h_method   (thread, last_frame.method());
   488   methodHandle       h_method   (thread, last_frame.method());
   489   constantPoolHandle h_constants(thread, h_method->constants());
   489   constantPoolHandle h_constants(thread, h_method->constants());
   620     JvmtiExport::notice_unwind_due_to_exception(thread, h_method(), handler_pc, h_exception(), (handler_pc != NULL));
   620     JvmtiExport::notice_unwind_due_to_exception(thread, h_method(), handler_pc, h_exception(), (handler_pc != NULL));
   621   }
   621   }
   622 
   622 
   623   thread->set_vm_result(h_exception());
   623   thread->set_vm_result(h_exception());
   624   return continuation;
   624   return continuation;
   625 IRT_END
   625 JRT_END
   626 
   626 
   627 
   627 
   628 IRT_ENTRY(void, InterpreterRuntime::throw_pending_exception(JavaThread* thread))
   628 JRT_ENTRY(void, InterpreterRuntime::throw_pending_exception(JavaThread* thread))
   629   assert(thread->has_pending_exception(), "must only ne called if there's an exception pending");
   629   assert(thread->has_pending_exception(), "must only ne called if there's an exception pending");
   630   // nothing to do - eventually we should remove this code entirely (see comments @ call sites)
   630   // nothing to do - eventually we should remove this code entirely (see comments @ call sites)
   631 IRT_END
   631 JRT_END
   632 
   632 
   633 
   633 
   634 IRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodError(JavaThread* thread))
   634 JRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodError(JavaThread* thread))
   635   THROW(vmSymbols::java_lang_AbstractMethodError());
   635   THROW(vmSymbols::java_lang_AbstractMethodError());
   636 IRT_END
   636 JRT_END
   637 
   637 
   638 // This method is called from the "abstract_entry" of the interpreter.
   638 // This method is called from the "abstract_entry" of the interpreter.
   639 // At that point, the arguments have already been removed from the stack
   639 // At that point, the arguments have already been removed from the stack
   640 // and therefore we don't have the receiver object at our fingertips. (Though,
   640 // and therefore we don't have the receiver object at our fingertips. (Though,
   641 // on some platforms the receiver still resides in a register...). Thus,
   641 // on some platforms the receiver still resides in a register...). Thus,
   642 // we have no choice but print an error message not containing the receiver
   642 // we have no choice but print an error message not containing the receiver
   643 // type.
   643 // type.
   644 IRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodErrorWithMethod(JavaThread* thread,
   644 JRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodErrorWithMethod(JavaThread* thread,
   645                                                                         Method* missingMethod))
   645                                                                         Method* missingMethod))
   646   ResourceMark rm(thread);
   646   ResourceMark rm(thread);
   647   assert(missingMethod != NULL, "sanity");
   647   assert(missingMethod != NULL, "sanity");
   648   methodHandle m(thread, missingMethod);
   648   methodHandle m(thread, missingMethod);
   649   LinkResolver::throw_abstract_method_error(m, THREAD);
   649   LinkResolver::throw_abstract_method_error(m, THREAD);
   650 IRT_END
   650 JRT_END
   651 
   651 
   652 IRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodErrorVerbose(JavaThread* thread,
   652 JRT_ENTRY(void, InterpreterRuntime::throw_AbstractMethodErrorVerbose(JavaThread* thread,
   653                                                                      Klass* recvKlass,
   653                                                                      Klass* recvKlass,
   654                                                                      Method* missingMethod))
   654                                                                      Method* missingMethod))
   655   ResourceMark rm(thread);
   655   ResourceMark rm(thread);
   656   methodHandle mh = methodHandle(thread, missingMethod);
   656   methodHandle mh = methodHandle(thread, missingMethod);
   657   LinkResolver::throw_abstract_method_error(mh, recvKlass, THREAD);
   657   LinkResolver::throw_abstract_method_error(mh, recvKlass, THREAD);
   658 IRT_END
   658 JRT_END
   659 
   659 
   660 
   660 
   661 IRT_ENTRY(void, InterpreterRuntime::throw_IncompatibleClassChangeError(JavaThread* thread))
   661 JRT_ENTRY(void, InterpreterRuntime::throw_IncompatibleClassChangeError(JavaThread* thread))
   662   THROW(vmSymbols::java_lang_IncompatibleClassChangeError());
   662   THROW(vmSymbols::java_lang_IncompatibleClassChangeError());
   663 IRT_END
   663 JRT_END
   664 
   664 
   665 IRT_ENTRY(void, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose(JavaThread* thread,
   665 JRT_ENTRY(void, InterpreterRuntime::throw_IncompatibleClassChangeErrorVerbose(JavaThread* thread,
   666                                                                               Klass* recvKlass,
   666                                                                               Klass* recvKlass,
   667                                                                               Klass* interfaceKlass))
   667                                                                               Klass* interfaceKlass))
   668   ResourceMark rm(thread);
   668   ResourceMark rm(thread);
   669   char buf[1000];
   669   char buf[1000];
   670   buf[0] = '\0';
   670   buf[0] = '\0';
   671   jio_snprintf(buf, sizeof(buf),
   671   jio_snprintf(buf, sizeof(buf),
   672                "Class %s does not implement the requested interface %s",
   672                "Class %s does not implement the requested interface %s",
   673                recvKlass ? recvKlass->external_name() : "NULL",
   673                recvKlass ? recvKlass->external_name() : "NULL",
   674                interfaceKlass ? interfaceKlass->external_name() : "NULL");
   674                interfaceKlass ? interfaceKlass->external_name() : "NULL");
   675   THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   675   THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf);
   676 IRT_END
   676 JRT_END
   677 
   677 
   678 //------------------------------------------------------------------------------------------------------------------------
   678 //------------------------------------------------------------------------------------------------------------------------
   679 // Fields
   679 // Fields
   680 //
   680 //
   681 
   681 
   758 // The interpreter's synchronization code is factored out so that it can
   758 // The interpreter's synchronization code is factored out so that it can
   759 // be shared by method invocation and synchronized blocks.
   759 // be shared by method invocation and synchronized blocks.
   760 //%note synchronization_3
   760 //%note synchronization_3
   761 
   761 
   762 //%note monitor_1
   762 //%note monitor_1
   763 IRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* thread, BasicObjectLock* elem))
   763 JRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorenter(JavaThread* thread, BasicObjectLock* elem))
   764 #ifdef ASSERT
   764 #ifdef ASSERT
   765   thread->last_frame().interpreter_frame_verify_monitor(elem);
   765   thread->last_frame().interpreter_frame_verify_monitor(elem);
   766 #endif
   766 #endif
   767   if (PrintBiasedLockingStatistics) {
   767   if (PrintBiasedLockingStatistics) {
   768     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
   768     Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
   779   assert(Universe::heap()->is_in_reserved_or_null(elem->obj()),
   779   assert(Universe::heap()->is_in_reserved_or_null(elem->obj()),
   780          "must be NULL or an object");
   780          "must be NULL or an object");
   781 #ifdef ASSERT
   781 #ifdef ASSERT
   782   thread->last_frame().interpreter_frame_verify_monitor(elem);
   782   thread->last_frame().interpreter_frame_verify_monitor(elem);
   783 #endif
   783 #endif
   784 IRT_END
   784 JRT_END
   785 
   785 
   786 
   786 
   787 //%note monitor_1
   787 //%note monitor_1
   788 IRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorexit(JavaThread* thread, BasicObjectLock* elem))
   788 JRT_ENTRY_NO_ASYNC(void, InterpreterRuntime::monitorexit(JavaThread* thread, BasicObjectLock* elem))
   789 #ifdef ASSERT
   789 #ifdef ASSERT
   790   thread->last_frame().interpreter_frame_verify_monitor(elem);
   790   thread->last_frame().interpreter_frame_verify_monitor(elem);
   791 #endif
   791 #endif
   792   Handle h_obj(thread, elem->obj());
   792   Handle h_obj(thread, elem->obj());
   793   assert(Universe::heap()->is_in_reserved_or_null(h_obj()),
   793   assert(Universe::heap()->is_in_reserved_or_null(h_obj()),
   800   // exit. If it is not cleared, the exception handling code will try to unlock the monitor again.
   800   // exit. If it is not cleared, the exception handling code will try to unlock the monitor again.
   801   elem->set_obj(NULL);
   801   elem->set_obj(NULL);
   802 #ifdef ASSERT
   802 #ifdef ASSERT
   803   thread->last_frame().interpreter_frame_verify_monitor(elem);
   803   thread->last_frame().interpreter_frame_verify_monitor(elem);
   804 #endif
   804 #endif
   805 IRT_END
   805 JRT_END
   806 
   806 
   807 
   807 
   808 IRT_ENTRY(void, InterpreterRuntime::throw_illegal_monitor_state_exception(JavaThread* thread))
   808 JRT_ENTRY(void, InterpreterRuntime::throw_illegal_monitor_state_exception(JavaThread* thread))
   809   THROW(vmSymbols::java_lang_IllegalMonitorStateException());
   809   THROW(vmSymbols::java_lang_IllegalMonitorStateException());
   810 IRT_END
   810 JRT_END
   811 
   811 
   812 
   812 
   813 IRT_ENTRY(void, InterpreterRuntime::new_illegal_monitor_state_exception(JavaThread* thread))
   813 JRT_ENTRY(void, InterpreterRuntime::new_illegal_monitor_state_exception(JavaThread* thread))
   814   // Returns an illegal exception to install into the current thread. The
   814   // Returns an illegal exception to install into the current thread. The
   815   // pending_exception flag is cleared so normal exception handling does not
   815   // pending_exception flag is cleared so normal exception handling does not
   816   // trigger. Any current installed exception will be overwritten. This
   816   // trigger. Any current installed exception will be overwritten. This
   817   // method will be called during an exception unwind.
   817   // method will be called during an exception unwind.
   818 
   818 
   824     exception = get_preinitialized_exception(
   824     exception = get_preinitialized_exception(
   825                        SystemDictionary::IllegalMonitorStateException_klass(),
   825                        SystemDictionary::IllegalMonitorStateException_klass(),
   826                        CATCH);
   826                        CATCH);
   827   }
   827   }
   828   thread->set_vm_result(exception());
   828   thread->set_vm_result(exception());
   829 IRT_END
   829 JRT_END
   830 
   830 
   831 
   831 
   832 //------------------------------------------------------------------------------------------------------------------------
   832 //------------------------------------------------------------------------------------------------------------------------
   833 // Invokes
   833 // Invokes
   834 
   834 
   835 IRT_ENTRY(Bytecodes::Code, InterpreterRuntime::get_original_bytecode_at(JavaThread* thread, Method* method, address bcp))
   835 JRT_ENTRY(Bytecodes::Code, InterpreterRuntime::get_original_bytecode_at(JavaThread* thread, Method* method, address bcp))
   836   return method->orig_bytecode_at(method->bci_from(bcp));
   836   return method->orig_bytecode_at(method->bci_from(bcp));
   837 IRT_END
   837 JRT_END
   838 
   838 
   839 IRT_ENTRY(void, InterpreterRuntime::set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code))
   839 JRT_ENTRY(void, InterpreterRuntime::set_original_bytecode_at(JavaThread* thread, Method* method, address bcp, Bytecodes::Code new_code))
   840   method->set_orig_bytecode_at(method->bci_from(bcp), new_code);
   840   method->set_orig_bytecode_at(method->bci_from(bcp), new_code);
   841 IRT_END
   841 JRT_END
   842 
   842 
   843 IRT_ENTRY(void, InterpreterRuntime::_breakpoint(JavaThread* thread, Method* method, address bcp))
   843 JRT_ENTRY(void, InterpreterRuntime::_breakpoint(JavaThread* thread, Method* method, address bcp))
   844   JvmtiExport::post_raw_breakpoint(thread, method, bcp);
   844   JvmtiExport::post_raw_breakpoint(thread, method, bcp);
   845 IRT_END
   845 JRT_END
   846 
   846 
   847 void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode) {
   847 void InterpreterRuntime::resolve_invoke(JavaThread* thread, Bytecodes::Code bytecode) {
   848   Thread* THREAD = thread;
   848   Thread* THREAD = thread;
   849   LastFrameAccessor last_frame(thread);
   849   LastFrameAccessor last_frame(thread);
   850   // extract receiver from the outgoing argument list if necessary
   850   // extract receiver from the outgoing argument list if necessary
   996 }
   996 }
   997 
   997 
   998 // This function is the interface to the assembly code. It returns the resolved
   998 // This function is the interface to the assembly code. It returns the resolved
   999 // cpCache entry.  This doesn't safepoint, but the helper routines safepoint.
   999 // cpCache entry.  This doesn't safepoint, but the helper routines safepoint.
  1000 // This function will check for redefinition!
  1000 // This function will check for redefinition!
  1001 IRT_ENTRY(void, InterpreterRuntime::resolve_from_cache(JavaThread* thread, Bytecodes::Code bytecode)) {
  1001 JRT_ENTRY(void, InterpreterRuntime::resolve_from_cache(JavaThread* thread, Bytecodes::Code bytecode)) {
  1002   switch (bytecode) {
  1002   switch (bytecode) {
  1003   case Bytecodes::_getstatic:
  1003   case Bytecodes::_getstatic:
  1004   case Bytecodes::_putstatic:
  1004   case Bytecodes::_putstatic:
  1005   case Bytecodes::_getfield:
  1005   case Bytecodes::_getfield:
  1006   case Bytecodes::_putfield:
  1006   case Bytecodes::_putfield:
  1021   default:
  1021   default:
  1022     fatal("unexpected bytecode: %s", Bytecodes::name(bytecode));
  1022     fatal("unexpected bytecode: %s", Bytecodes::name(bytecode));
  1023     break;
  1023     break;
  1024   }
  1024   }
  1025 }
  1025 }
  1026 IRT_END
  1026 JRT_END
  1027 
  1027 
  1028 //------------------------------------------------------------------------------------------------------------------------
  1028 //------------------------------------------------------------------------------------------------------------------------
  1029 // Miscellaneous
  1029 // Miscellaneous
  1030 
  1030 
  1031 
  1031 
  1067   }
  1067   }
  1068 #endif
  1068 #endif
  1069   return nm;
  1069   return nm;
  1070 }
  1070 }
  1071 
  1071 
  1072 IRT_ENTRY(nmethod*,
  1072 JRT_ENTRY(nmethod*,
  1073           InterpreterRuntime::frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp))
  1073           InterpreterRuntime::frequency_counter_overflow_inner(JavaThread* thread, address branch_bcp))
  1074   // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
  1074   // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
  1075   // flag, in case this method triggers classloading which will call into Java.
  1075   // flag, in case this method triggers classloading which will call into Java.
  1076   UnlockFlagSaver fs(thread);
  1076   UnlockFlagSaver fs(thread);
  1077 
  1077 
  1111       }
  1111       }
  1112       BiasedLocking::revoke(objects_to_revoke);
  1112       BiasedLocking::revoke(objects_to_revoke);
  1113     }
  1113     }
  1114   }
  1114   }
  1115   return osr_nm;
  1115   return osr_nm;
  1116 IRT_END
  1116 JRT_END
  1117 
  1117 
  1118 IRT_LEAF(jint, InterpreterRuntime::bcp_to_di(Method* method, address cur_bcp))
  1118 JRT_LEAF(jint, InterpreterRuntime::bcp_to_di(Method* method, address cur_bcp))
  1119   assert(ProfileInterpreter, "must be profiling interpreter");
  1119   assert(ProfileInterpreter, "must be profiling interpreter");
  1120   int bci = method->bci_from(cur_bcp);
  1120   int bci = method->bci_from(cur_bcp);
  1121   MethodData* mdo = method->method_data();
  1121   MethodData* mdo = method->method_data();
  1122   if (mdo == NULL)  return 0;
  1122   if (mdo == NULL)  return 0;
  1123   return mdo->bci_to_di(bci);
  1123   return mdo->bci_to_di(bci);
  1124 IRT_END
  1124 JRT_END
  1125 
  1125 
  1126 IRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread))
  1126 JRT_ENTRY(void, InterpreterRuntime::profile_method(JavaThread* thread))
  1127   // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
  1127   // use UnlockFlagSaver to clear and restore the _do_not_unlock_if_synchronized
  1128   // flag, in case this method triggers classloading which will call into Java.
  1128   // flag, in case this method triggers classloading which will call into Java.
  1129   UnlockFlagSaver fs(thread);
  1129   UnlockFlagSaver fs(thread);
  1130 
  1130 
  1131   assert(ProfileInterpreter, "must be profiling interpreter");
  1131   assert(ProfileInterpreter, "must be profiling interpreter");
  1136   if (HAS_PENDING_EXCEPTION) {
  1136   if (HAS_PENDING_EXCEPTION) {
  1137     assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
  1137     assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
  1138     CLEAR_PENDING_EXCEPTION;
  1138     CLEAR_PENDING_EXCEPTION;
  1139     // and fall through...
  1139     // and fall through...
  1140   }
  1140   }
  1141 IRT_END
  1141 JRT_END
  1142 
  1142 
  1143 
  1143 
  1144 #ifdef ASSERT
  1144 #ifdef ASSERT
  1145 IRT_LEAF(void, InterpreterRuntime::verify_mdp(Method* method, address bcp, address mdp))
  1145 JRT_LEAF(void, InterpreterRuntime::verify_mdp(Method* method, address bcp, address mdp))
  1146   assert(ProfileInterpreter, "must be profiling interpreter");
  1146   assert(ProfileInterpreter, "must be profiling interpreter");
  1147 
  1147 
  1148   MethodData* mdo = method->method_data();
  1148   MethodData* mdo = method->method_data();
  1149   assert(mdo != NULL, "must not be null");
  1149   assert(mdo != NULL, "must not be null");
  1150 
  1150 
  1167     tty->print_cr("  actual bci is %d  expected bci %d", approx_bci, expected_approx_bci);
  1167     tty->print_cr("  actual bci is %d  expected bci %d", approx_bci, expected_approx_bci);
  1168     mdo->print_on(tty);
  1168     mdo->print_on(tty);
  1169     method->print_codes();
  1169     method->print_codes();
  1170   }
  1170   }
  1171   assert(mdp == mdp2, "wrong mdp");
  1171   assert(mdp == mdp2, "wrong mdp");
  1172 IRT_END
  1172 JRT_END
  1173 #endif // ASSERT
  1173 #endif // ASSERT
  1174 
  1174 
  1175 IRT_ENTRY(void, InterpreterRuntime::update_mdp_for_ret(JavaThread* thread, int return_bci))
  1175 JRT_ENTRY(void, InterpreterRuntime::update_mdp_for_ret(JavaThread* thread, int return_bci))
  1176   assert(ProfileInterpreter, "must be profiling interpreter");
  1176   assert(ProfileInterpreter, "must be profiling interpreter");
  1177   ResourceMark rm(thread);
  1177   ResourceMark rm(thread);
  1178   HandleMark hm(thread);
  1178   HandleMark hm(thread);
  1179   LastFrameAccessor last_frame(thread);
  1179   LastFrameAccessor last_frame(thread);
  1180   assert(last_frame.is_interpreted_frame(), "must come from interpreter");
  1180   assert(last_frame.is_interpreted_frame(), "must come from interpreter");
  1189   ProfileData* data = h_mdo->data_at(h_mdo->dp_to_di(last_frame.mdp()));
  1189   ProfileData* data = h_mdo->data_at(h_mdo->dp_to_di(last_frame.mdp()));
  1190   guarantee(data != NULL, "profile data must be valid");
  1190   guarantee(data != NULL, "profile data must be valid");
  1191   RetData* rdata = data->as_RetData();
  1191   RetData* rdata = data->as_RetData();
  1192   address new_mdp = rdata->fixup_ret(return_bci, h_mdo);
  1192   address new_mdp = rdata->fixup_ret(return_bci, h_mdo);
  1193   last_frame.set_mdp(new_mdp);
  1193   last_frame.set_mdp(new_mdp);
  1194 IRT_END
  1194 JRT_END
  1195 
  1195 
  1196 IRT_ENTRY(MethodCounters*, InterpreterRuntime::build_method_counters(JavaThread* thread, Method* m))
  1196 JRT_ENTRY(MethodCounters*, InterpreterRuntime::build_method_counters(JavaThread* thread, Method* m))
  1197   MethodCounters* mcs = Method::build_method_counters(m, thread);
  1197   MethodCounters* mcs = Method::build_method_counters(m, thread);
  1198   if (HAS_PENDING_EXCEPTION) {
  1198   if (HAS_PENDING_EXCEPTION) {
  1199     assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
  1199     assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
  1200     CLEAR_PENDING_EXCEPTION;
  1200     CLEAR_PENDING_EXCEPTION;
  1201   }
  1201   }
  1202   return mcs;
  1202   return mcs;
  1203 IRT_END
  1203 JRT_END
  1204 
  1204 
  1205 
  1205 
  1206 IRT_ENTRY(void, InterpreterRuntime::at_safepoint(JavaThread* thread))
  1206 JRT_ENTRY(void, InterpreterRuntime::at_safepoint(JavaThread* thread))
  1207   // We used to need an explict preserve_arguments here for invoke bytecodes. However,
  1207   // We used to need an explict preserve_arguments here for invoke bytecodes. However,
  1208   // stack traversal automatically takes care of preserving arguments for invoke, so
  1208   // stack traversal automatically takes care of preserving arguments for invoke, so
  1209   // this is no longer needed.
  1209   // this is no longer needed.
  1210 
  1210 
  1211   // IRT_END does an implicit safepoint check, hence we are guaranteed to block
  1211   // JRT_END does an implicit safepoint check, hence we are guaranteed to block
  1212   // if this is called during a safepoint
  1212   // if this is called during a safepoint
  1213 
  1213 
  1214   if (JvmtiExport::should_post_single_step()) {
  1214   if (JvmtiExport::should_post_single_step()) {
  1215     // We are called during regular safepoints and when the VM is
  1215     // We are called during regular safepoints and when the VM is
  1216     // single stepping. If any thread is marked for single stepping,
  1216     // single stepping. If any thread is marked for single stepping,
  1217     // then we may have JVMTI work to do.
  1217     // then we may have JVMTI work to do.
  1218     LastFrameAccessor last_frame(thread);
  1218     LastFrameAccessor last_frame(thread);
  1219     JvmtiExport::at_single_stepping_point(thread, last_frame.method(), last_frame.bcp());
  1219     JvmtiExport::at_single_stepping_point(thread, last_frame.method(), last_frame.bcp());
  1220   }
  1220   }
  1221 IRT_END
  1221 JRT_END
  1222 
  1222 
  1223 IRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj,
  1223 JRT_ENTRY(void, InterpreterRuntime::post_field_access(JavaThread *thread, oopDesc* obj,
  1224 ConstantPoolCacheEntry *cp_entry))
  1224 ConstantPoolCacheEntry *cp_entry))
  1225 
  1225 
  1226   // check the access_flags for the field in the klass
  1226   // check the access_flags for the field in the klass
  1227 
  1227 
  1228   InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass());
  1228   InstanceKlass* ik = InstanceKlass::cast(cp_entry->f1_as_klass());
  1239   }
  1239   }
  1240   InstanceKlass* cp_entry_f1 = InstanceKlass::cast(cp_entry->f1_as_klass());
  1240   InstanceKlass* cp_entry_f1 = InstanceKlass::cast(cp_entry->f1_as_klass());
  1241   jfieldID fid = jfieldIDWorkaround::to_jfieldID(cp_entry_f1, cp_entry->f2_as_index(), is_static);
  1241   jfieldID fid = jfieldIDWorkaround::to_jfieldID(cp_entry_f1, cp_entry->f2_as_index(), is_static);
  1242   LastFrameAccessor last_frame(thread);
  1242   LastFrameAccessor last_frame(thread);
  1243   JvmtiExport::post_field_access(thread, last_frame.method(), last_frame.bcp(), cp_entry_f1, h_obj, fid);
  1243   JvmtiExport::post_field_access(thread, last_frame.method(), last_frame.bcp(), cp_entry_f1, h_obj, fid);
  1244 IRT_END
  1244 JRT_END
  1245 
  1245 
  1246 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
  1246 JRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
  1247   oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
  1247   oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
  1248 
  1248 
  1249   Klass* k = cp_entry->f1_as_klass();
  1249   Klass* k = cp_entry->f1_as_klass();
  1250 
  1250 
  1251   // check the access_flags for the field in the klass
  1251   // check the access_flags for the field in the klass
  1296   }
  1296   }
  1297 
  1297 
  1298   LastFrameAccessor last_frame(thread);
  1298   LastFrameAccessor last_frame(thread);
  1299   JvmtiExport::post_raw_field_modification(thread, last_frame.method(), last_frame.bcp(), ik, h_obj,
  1299   JvmtiExport::post_raw_field_modification(thread, last_frame.method(), last_frame.bcp(), ik, h_obj,
  1300                                            fid, sig_type, &fvalue);
  1300                                            fid, sig_type, &fvalue);
  1301 IRT_END
  1301 JRT_END
  1302 
  1302 
  1303 IRT_ENTRY(void, InterpreterRuntime::post_method_entry(JavaThread *thread))
  1303 JRT_ENTRY(void, InterpreterRuntime::post_method_entry(JavaThread *thread))
  1304   LastFrameAccessor last_frame(thread);
  1304   LastFrameAccessor last_frame(thread);
  1305   JvmtiExport::post_method_entry(thread, last_frame.method(), last_frame.get_frame());
  1305   JvmtiExport::post_method_entry(thread, last_frame.method(), last_frame.get_frame());
  1306 IRT_END
  1306 JRT_END
  1307 
  1307 
  1308 
  1308 
  1309 IRT_ENTRY(void, InterpreterRuntime::post_method_exit(JavaThread *thread))
  1309 JRT_ENTRY(void, InterpreterRuntime::post_method_exit(JavaThread *thread))
  1310   LastFrameAccessor last_frame(thread);
  1310   LastFrameAccessor last_frame(thread);
  1311   JvmtiExport::post_method_exit(thread, last_frame.method(), last_frame.get_frame());
  1311   JvmtiExport::post_method_exit(thread, last_frame.method(), last_frame.get_frame());
  1312 IRT_END
  1312 JRT_END
  1313 
  1313 
  1314 IRT_LEAF(int, InterpreterRuntime::interpreter_contains(address pc))
  1314 JRT_LEAF(int, InterpreterRuntime::interpreter_contains(address pc))
  1315 {
  1315 {
  1316   return (Interpreter::contains(pc) ? 1 : 0);
  1316   return (Interpreter::contains(pc) ? 1 : 0);
  1317 }
  1317 }
  1318 IRT_END
  1318 JRT_END
  1319 
  1319 
  1320 
  1320 
  1321 // Implementation of SignatureHandlerLibrary
  1321 // Implementation of SignatureHandlerLibrary
  1322 
  1322 
  1323 #ifndef SHARING_FAST_NATIVE_FINGERPRINTS
  1323 #ifndef SHARING_FAST_NATIVE_FINGERPRINTS
  1506 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL;
  1506 GrowableArray<uint64_t>* SignatureHandlerLibrary::_fingerprints = NULL;
  1507 GrowableArray<address>*  SignatureHandlerLibrary::_handlers     = NULL;
  1507 GrowableArray<address>*  SignatureHandlerLibrary::_handlers     = NULL;
  1508 address                  SignatureHandlerLibrary::_buffer       = NULL;
  1508 address                  SignatureHandlerLibrary::_buffer       = NULL;
  1509 
  1509 
  1510 
  1510 
  1511 IRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, Method* method))
  1511 JRT_ENTRY(void, InterpreterRuntime::prepare_native_call(JavaThread* thread, Method* method))
  1512   methodHandle m(thread, method);
  1512   methodHandle m(thread, method);
  1513   assert(m->is_native(), "sanity check");
  1513   assert(m->is_native(), "sanity check");
  1514   // lookup native function entry point if it doesn't exist
  1514   // lookup native function entry point if it doesn't exist
  1515   bool in_base_library;
  1515   bool in_base_library;
  1516   if (!m->has_native_function()) {
  1516   if (!m->has_native_function()) {
  1520   SignatureHandlerLibrary::add(m);
  1520   SignatureHandlerLibrary::add(m);
  1521   // The interpreter entry point checks the signature handler first,
  1521   // The interpreter entry point checks the signature handler first,
  1522   // before trying to fetch the native entry point and klass mirror.
  1522   // before trying to fetch the native entry point and klass mirror.
  1523   // We must set the signature handler last, so that multiple processors
  1523   // We must set the signature handler last, so that multiple processors
  1524   // preparing the same method will be sure to see non-null entry & mirror.
  1524   // preparing the same method will be sure to see non-null entry & mirror.
  1525 IRT_END
  1525 JRT_END
  1526 
  1526 
  1527 #if defined(IA32) || defined(AMD64) || defined(ARM)
  1527 #if defined(IA32) || defined(AMD64) || defined(ARM)
  1528 IRT_LEAF(void, InterpreterRuntime::popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address))
  1528 JRT_LEAF(void, InterpreterRuntime::popframe_move_outgoing_args(JavaThread* thread, void* src_address, void* dest_address))
  1529   if (src_address == dest_address) {
  1529   if (src_address == dest_address) {
  1530     return;
  1530     return;
  1531   }
  1531   }
  1532   ResetNoHandleMark rnm; // In a LEAF entry.
  1532   ResetNoHandleMark rnm; // In a LEAF entry.
  1533   HandleMark hm;
  1533   HandleMark hm;
  1539   Bytecode_invoke invoke(mh, bci);
  1539   Bytecode_invoke invoke(mh, bci);
  1540   ArgumentSizeComputer asc(invoke.signature());
  1540   ArgumentSizeComputer asc(invoke.signature());
  1541   int size_of_arguments = (asc.size() + (invoke.has_receiver() ? 1 : 0)); // receiver
  1541   int size_of_arguments = (asc.size() + (invoke.has_receiver() ? 1 : 0)); // receiver
  1542   Copy::conjoint_jbytes(src_address, dest_address,
  1542   Copy::conjoint_jbytes(src_address, dest_address,
  1543                        size_of_arguments * Interpreter::stackElementSize);
  1543                        size_of_arguments * Interpreter::stackElementSize);
  1544 IRT_END
  1544 JRT_END
  1545 #endif
  1545 #endif
  1546 
  1546 
  1547 #if INCLUDE_JVMTI
  1547 #if INCLUDE_JVMTI
  1548 // This is a support of the JVMTI PopFrame interface.
  1548 // This is a support of the JVMTI PopFrame interface.
  1549 // Make sure it is an invokestatic of a polymorphic intrinsic that has a member_name argument
  1549 // Make sure it is an invokestatic of a polymorphic intrinsic that has a member_name argument
  1550 // and return it as a vm_result so that it can be reloaded in the list of invokestatic parameters.
  1550 // and return it as a vm_result so that it can be reloaded in the list of invokestatic parameters.
  1551 // The member_name argument is a saved reference (in local#0) to the member_name.
  1551 // The member_name argument is a saved reference (in local#0) to the member_name.
  1552 // For backward compatibility with some JDK versions (7, 8) it can also be a direct method handle.
  1552 // For backward compatibility with some JDK versions (7, 8) it can also be a direct method handle.
  1553 // FIXME: remove DMH case after j.l.i.InvokerBytecodeGenerator code shape is updated.
  1553 // FIXME: remove DMH case after j.l.i.InvokerBytecodeGenerator code shape is updated.
  1554 IRT_ENTRY(void, InterpreterRuntime::member_name_arg_or_null(JavaThread* thread, address member_name,
  1554 JRT_ENTRY(void, InterpreterRuntime::member_name_arg_or_null(JavaThread* thread, address member_name,
  1555                                                             Method* method, address bcp))
  1555                                                             Method* method, address bcp))
  1556   Bytecodes::Code code = Bytecodes::code_at(method, bcp);
  1556   Bytecodes::Code code = Bytecodes::code_at(method, bcp);
  1557   if (code != Bytecodes::_invokestatic) {
  1557   if (code != Bytecodes::_invokestatic) {
  1558     return;
  1558     return;
  1559   }
  1559   }
  1570     }
  1570     }
  1571     thread->set_vm_result(member_name_oop);
  1571     thread->set_vm_result(member_name_oop);
  1572   } else {
  1572   } else {
  1573     thread->set_vm_result(NULL);
  1573     thread->set_vm_result(NULL);
  1574   }
  1574   }
  1575 IRT_END
  1575 JRT_END
  1576 #endif // INCLUDE_JVMTI
  1576 #endif // INCLUDE_JVMTI
  1577 
  1577 
  1578 #ifndef PRODUCT
  1578 #ifndef PRODUCT
  1579 // This must be a IRT_LEAF function because the interpreter must save registers on x86 to
  1579 // This must be a JRT_LEAF function because the interpreter must save registers on x86 to
  1580 // call this, which changes rsp and makes the interpreter's expression stack not walkable.
  1580 // call this, which changes rsp and makes the interpreter's expression stack not walkable.
  1581 // The generated code still uses call_VM because that will set up the frame pointer for
  1581 // The generated code still uses call_VM because that will set up the frame pointer for
  1582 // bcp and method.
  1582 // bcp and method.
  1583 IRT_LEAF(intptr_t, InterpreterRuntime::trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2))
  1583 JRT_LEAF(intptr_t, InterpreterRuntime::trace_bytecode(JavaThread* thread, intptr_t preserve_this_value, intptr_t tos, intptr_t tos2))
  1584   LastFrameAccessor last_frame(thread);
  1584   LastFrameAccessor last_frame(thread);
  1585   assert(last_frame.is_interpreted_frame(), "must be an interpreted frame");
  1585   assert(last_frame.is_interpreted_frame(), "must be an interpreted frame");
  1586   methodHandle mh(thread, last_frame.method());
  1586   methodHandle mh(thread, last_frame.method());
  1587   BytecodeTracer::trace(mh, last_frame.bcp(), tos, tos2);
  1587   BytecodeTracer::trace(mh, last_frame.bcp(), tos, tos2);
  1588   return preserve_this_value;
  1588   return preserve_this_value;
  1589 IRT_END
  1589 JRT_END
  1590 #endif // !PRODUCT
  1590 #endif // !PRODUCT