hotspot/src/share/vm/interpreter/interpreterRuntime.cpp
changeset 46329 53ccc37bda19
parent 42664 29142a56c193
child 46424 2dfc07162b35
equal deleted inserted replaced
46328:6061df52d610 46329:53ccc37bda19
     1 /*
     1 /*
     2  * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
   136 
   136 
   137 //------------------------------------------------------------------------------------------------------------------------
   137 //------------------------------------------------------------------------------------------------------------------------
   138 // Allocation
   138 // Allocation
   139 
   139 
   140 IRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, ConstantPool* pool, int index))
   140 IRT_ENTRY(void, InterpreterRuntime::_new(JavaThread* thread, ConstantPool* pool, int index))
   141   Klass* k_oop = pool->klass_at(index, CHECK);
   141   Klass* k = pool->klass_at(index, CHECK);
   142   instanceKlassHandle klass (THREAD, k_oop);
   142   InstanceKlass* klass = InstanceKlass::cast(k);
   143 
   143 
   144   // Make sure we are not instantiating an abstract klass
   144   // Make sure we are not instantiating an abstract klass
   145   klass->check_valid_for_instantiation(true, CHECK);
   145   klass->check_valid_for_instantiation(true, CHECK);
   146 
   146 
   147   // Make sure klass is initialized
   147   // Make sure klass is initialized
   459 //     }
   459 //     }
   460     // for AbortVMOnException flag
   460     // for AbortVMOnException flag
   461     Exceptions::debug_check_abort(h_exception);
   461     Exceptions::debug_check_abort(h_exception);
   462 
   462 
   463     // exception handler lookup
   463     // exception handler lookup
   464     KlassHandle h_klass(THREAD, h_exception->klass());
   464     Klass* klass = h_exception->klass();
   465     handler_bci = Method::fast_exception_handler_bci_for(h_method, h_klass, current_bci, THREAD);
   465     handler_bci = Method::fast_exception_handler_bci_for(h_method, klass, current_bci, THREAD);
   466     if (HAS_PENDING_EXCEPTION) {
   466     if (HAS_PENDING_EXCEPTION) {
   467       // We threw an exception while trying to find the exception handler.
   467       // We threw an exception while trying to find the exception handler.
   468       // Transfer the new exception to the exception handle which will
   468       // Transfer the new exception to the exception handle which will
   469       // be set into thread local storage, and do another lookup for an
   469       // be set into thread local storage, and do another lookup for an
   470       // exception handler for this exception, this time starting at the
   470       // exception handler for this exception, this time starting at the
  1068   Handle h_obj;
  1068   Handle h_obj;
  1069   if (!is_static) {
  1069   if (!is_static) {
  1070     // non-static field accessors have an object, but we need a handle
  1070     // non-static field accessors have an object, but we need a handle
  1071     h_obj = Handle(thread, obj);
  1071     h_obj = Handle(thread, obj);
  1072   }
  1072   }
  1073   instanceKlassHandle h_cp_entry_f1(thread, (Klass*)cp_entry->f1_as_klass());
  1073   InstanceKlass* cp_entry_f1 = InstanceKlass::cast(cp_entry->f1_as_klass());
  1074   jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_cp_entry_f1, cp_entry->f2_as_index(), is_static);
  1074   jfieldID fid = jfieldIDWorkaround::to_jfieldID(cp_entry_f1, cp_entry->f2_as_index(), is_static);
  1075   JvmtiExport::post_field_access(thread, method(thread), bcp(thread), h_cp_entry_f1, h_obj, fid);
  1075   JvmtiExport::post_field_access(thread, method(thread), bcp(thread), cp_entry_f1, h_obj, fid);
  1076 IRT_END
  1076 IRT_END
  1077 
  1077 
  1078 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
  1078 IRT_ENTRY(void, InterpreterRuntime::post_field_modification(JavaThread *thread,
  1079   oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
  1079   oopDesc* obj, ConstantPoolCacheEntry *cp_entry, jvalue *value))
  1080 
  1080 
  1081   Klass* k = (Klass*)cp_entry->f1_as_klass();
  1081   Klass* k = cp_entry->f1_as_klass();
  1082 
  1082 
  1083   // check the access_flags for the field in the klass
  1083   // check the access_flags for the field in the klass
  1084   InstanceKlass* ik = InstanceKlass::cast(k);
  1084   InstanceKlass* ik = InstanceKlass::cast(k);
  1085   int index = cp_entry->field_index();
  1085   int index = cp_entry->field_index();
  1086   // bail out if field modifications are not watched
  1086   // bail out if field modifications are not watched
  1101     default:  ShouldNotReachHere(); return;
  1101     default:  ShouldNotReachHere(); return;
  1102   }
  1102   }
  1103   bool is_static = (obj == NULL);
  1103   bool is_static = (obj == NULL);
  1104 
  1104 
  1105   HandleMark hm(thread);
  1105   HandleMark hm(thread);
  1106   instanceKlassHandle h_klass(thread, k);
  1106   jfieldID fid = jfieldIDWorkaround::to_jfieldID(ik, cp_entry->f2_as_index(), is_static);
  1107   jfieldID fid = jfieldIDWorkaround::to_jfieldID(h_klass, cp_entry->f2_as_index(), is_static);
       
  1108   jvalue fvalue;
  1107   jvalue fvalue;
  1109 #ifdef _LP64
  1108 #ifdef _LP64
  1110   fvalue = *value;
  1109   fvalue = *value;
  1111 #else
  1110 #else
  1112   // Long/double values are stored unaligned and also noncontiguously with
  1111   // Long/double values are stored unaligned and also noncontiguously with
  1126   if (!is_static) {
  1125   if (!is_static) {
  1127     // non-static field accessors have an object, but we need a handle
  1126     // non-static field accessors have an object, but we need a handle
  1128     h_obj = Handle(thread, obj);
  1127     h_obj = Handle(thread, obj);
  1129   }
  1128   }
  1130 
  1129 
  1131   JvmtiExport::post_raw_field_modification(thread, method(thread), bcp(thread), h_klass, h_obj,
  1130   JvmtiExport::post_raw_field_modification(thread, method(thread), bcp(thread), ik, h_obj,
  1132                                            fid, sig_type, &fvalue);
  1131                                            fid, sig_type, &fvalue);
  1133 IRT_END
  1132 IRT_END
  1134 
  1133 
  1135 IRT_ENTRY(void, InterpreterRuntime::post_method_entry(JavaThread *thread))
  1134 IRT_ENTRY(void, InterpreterRuntime::post_method_entry(JavaThread *thread))
  1136   JvmtiExport::post_method_entry(thread, InterpreterRuntime::method(thread), InterpreterRuntime::last_frame(thread));
  1135   JvmtiExport::post_method_entry(thread, InterpreterRuntime::method(thread), InterpreterRuntime::last_frame(thread));