< prev index next >

src/hotspot/share/interpreter/interpreterRuntime.cpp

Print this page
*** 217,11 ***
  
    // Make sure we are not instantiating an abstract klass
    klass->check_valid_for_instantiation(true, CHECK);
  
    // Make sure klass is initialized
!   klass->initialize(CHECK);
  
    oop obj = klass->allocate_instance(CHECK);
    current->set_vm_result_oop(obj);
  JRT_END
  
--- 217,11 ---
  
    // Make sure we are not instantiating an abstract klass
    klass->check_valid_for_instantiation(true, CHECK);
  
    // Make sure klass is initialized
!   klass->initialize_preemptable(CHECK_AND_CLEAR_PREEMPTED);
  
    oop obj = klass->allocate_instance(CHECK);
    current->set_vm_result_oop(obj);
  JRT_END
  

*** 645,30 ***
  //------------------------------------------------------------------------------------------------------------------------
  // Fields
  //
  
  void InterpreterRuntime::resolve_get_put(JavaThread* current, Bytecodes::Code bytecode) {
    LastFrameAccessor last_frame(current);
    constantPoolHandle pool(current, last_frame.method()->constants());
    methodHandle m(current, last_frame.method());
  
!   resolve_get_put(bytecode, last_frame.get_index_u2(bytecode), m, pool, true /*initialize_holder*/, current);
  }
  
  void InterpreterRuntime::resolve_get_put(Bytecodes::Code bytecode, int field_index,
                                           methodHandle& m,
                                           constantPoolHandle& pool,
!                                          bool initialize_holder, TRAPS) {
    fieldDescriptor info;
    bool is_put    = (bytecode == Bytecodes::_putfield  || bytecode == Bytecodes::_nofast_putfield ||
                      bytecode == Bytecodes::_putstatic);
    bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
  
    {
      JvmtiHideSingleStepping jhss(THREAD);
      LinkResolver::resolve_field_access(info, pool, field_index,
!                                        m, bytecode, initialize_holder, CHECK);
    } // end JvmtiHideSingleStepping
  
    // check if link resolution caused cpCache to be updated
    if (pool->resolved_field_entry_at(field_index)->is_resolved(bytecode)) return;
  
--- 645,31 ---
  //------------------------------------------------------------------------------------------------------------------------
  // Fields
  //
  
  void InterpreterRuntime::resolve_get_put(JavaThread* current, Bytecodes::Code bytecode) {
+   JavaThread* THREAD = current;
    LastFrameAccessor last_frame(current);
    constantPoolHandle pool(current, last_frame.method()->constants());
    methodHandle m(current, last_frame.method());
  
!   resolve_get_put(bytecode, last_frame.get_index_u2(bytecode), m, pool, StaticMode::initialize_klass_preemptable, CHECK_AND_CLEAR_PREEMPTED);
  }
  
  void InterpreterRuntime::resolve_get_put(Bytecodes::Code bytecode, int field_index,
                                           methodHandle& m,
                                           constantPoolHandle& pool,
!                                          StaticMode static_mode, TRAPS) {
    fieldDescriptor info;
    bool is_put    = (bytecode == Bytecodes::_putfield  || bytecode == Bytecodes::_nofast_putfield ||
                      bytecode == Bytecodes::_putstatic);
    bool is_static = (bytecode == Bytecodes::_getstatic || bytecode == Bytecodes::_putstatic);
  
    {
      JvmtiHideSingleStepping jhss(THREAD);
      LinkResolver::resolve_field_access(info, pool, field_index,
!                                        m, bytecode, static_mode, CHECK);
    } // end JvmtiHideSingleStepping
  
    // check if link resolution caused cpCache to be updated
    if (pool->resolved_field_entry_at(field_index)->is_resolved(bytecode)) return;
  

*** 823,19 ***
    {
      JvmtiHideSingleStepping jhss(current);
      JavaThread* THREAD = current; // For exception macros.
      LinkResolver::resolve_invoke(info, receiver, pool,
                                   method_index, bytecode,
!                                  THREAD);
  
      if (HAS_PENDING_EXCEPTION) {
        if (ProfileTraps && PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_NullPointerException()) {
          // Preserve the original exception across the call to note_trap()
          PreserveExceptionMark pm(current);
          // Recording the trap will help the compiler to potentially recognize this exception as "hot"
          note_trap(current, Deoptimization::Reason_null_check);
        }
        return;
      }
  
      resolved_method = methodHandle(current, info.resolved_method());
    } // end JvmtiHideSingleStepping
--- 824,20 ---
    {
      JvmtiHideSingleStepping jhss(current);
      JavaThread* THREAD = current; // For exception macros.
      LinkResolver::resolve_invoke(info, receiver, pool,
                                   method_index, bytecode,
!                                  StaticMode::initialize_klass_preemptable, THREAD);
  
      if (HAS_PENDING_EXCEPTION) {
        if (ProfileTraps && PENDING_EXCEPTION->klass()->name() == vmSymbols::java_lang_NullPointerException()) {
          // Preserve the original exception across the call to note_trap()
          PreserveExceptionMark pm(current);
          // Recording the trap will help the compiler to potentially recognize this exception as "hot"
          note_trap(current, Deoptimization::Reason_null_check);
        }
+       CLEAR_PENDING_PREEMPTED_EXCEPTION;
        return;
      }
  
      resolved_method = methodHandle(current, info.resolved_method());
    } // end JvmtiHideSingleStepping

*** 1521,5 ***
--- 1523,13 ---
    methodHandle mh(current, last_frame.method());
    BytecodeTracer::trace_interpreter(mh, last_frame.bcp(), tos, tos2);
    return preserve_this_value;
  JRT_END
  #endif // !PRODUCT
+ 
+ #ifdef ASSERT
+ bool InterpreterRuntime::is_preemptable_call(address entry_point) {
+   return entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::monitorenter) ||
+          entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::resolve_from_cache) ||
+          entry_point == CAST_FROM_FN_PTR(address, InterpreterRuntime::_new);
+ }
+ #endif // ASSERT
< prev index next >