< prev index next >
src/share/vm/prims/jvmtiExport.cpp
Print this page
@@ -265,18 +265,18 @@
jobject _protection_domain;
jclass _class_being_redefined;
public:
JvmtiClassFileLoadEventMark(JavaThread *thread, Symbol* name,
- Handle class_loader, Handle prot_domain, KlassHandle *class_being_redefined) : JvmtiThreadEventMark(thread) {
+ Handle class_loader, Handle prot_domain, Klass* class_being_redefined) : JvmtiThreadEventMark(thread) {
_class_name = name != NULL? name->as_utf8() : NULL;
_jloader = (jobject)to_jobject(class_loader());
_protection_domain = (jobject)to_jobject(prot_domain());
if (class_being_redefined == NULL) {
_class_being_redefined = NULL;
} else {
- _class_being_redefined = (jclass)to_jclass((*class_being_redefined)());
+ _class_being_redefined = (jclass)to_jclass(class_being_redefined);
}
};
const char *class_name() {
return _class_name;
}
@@ -733,11 +733,11 @@
jint _curr_len;
unsigned char * _curr_data;
JvmtiEnv * _curr_env;
JvmtiCachedClassFileData ** _cached_class_file_ptr;
JvmtiThreadState * _state;
- KlassHandle * _h_class_being_redefined;
+ Klass* _class_being_redefined;
JvmtiClassLoadKind _load_kind;
bool _has_been_modified;
public:
inline JvmtiClassFileLoadHookPoster(Symbol* h_name, Handle class_loader,
@@ -756,13 +756,13 @@
_cached_class_file_ptr = cache_ptr;
_has_been_modified = false;
_state = _thread->jvmti_thread_state();
if (_state != NULL) {
- _h_class_being_redefined = _state->get_class_being_redefined();
+ _class_being_redefined = _state->get_class_being_redefined();
_load_kind = _state->get_class_load_kind();
- Klass* klass = (_h_class_being_redefined == NULL) ? NULL : (*_h_class_being_redefined)();
+ Klass* klass = (_class_being_redefined == NULL) ? NULL : _class_being_redefined;
if (_load_kind != jvmti_class_load_kind_load && klass != NULL) {
ModuleEntry* module_entry = InstanceKlass::cast(klass)->module();
assert(module_entry != NULL, "module_entry should always be set");
if (module_entry->is_named() &&
module_entry->module() != NULL &&
@@ -781,11 +781,11 @@
// from regular class file load could have this stale redefined
// class handle info.
_state->clear_class_being_redefined();
} else {
// redefine and retransform will always set the thread state
- _h_class_being_redefined = (KlassHandle *) NULL;
+ _class_being_redefined = NULL;
_load_kind = jvmti_class_load_kind_load;
}
}
void post() {
@@ -826,11 +826,11 @@
}
unsigned char *new_data = NULL;
jint new_len = 0;
JvmtiClassFileLoadEventMark jem(_thread, _h_name, _class_loader,
_h_protection_domain,
- _h_class_being_redefined);
+ _class_being_redefined);
JvmtiJavaThreadEventTransition jet(_thread);
jvmtiEventClassFileLoadHook callback = env->callbacks()->ClassFileLoadHook;
if (callback != NULL) {
(*callback)(env->jvmti_external(), jem.jni_env(),
jem.class_being_redefined(),
@@ -1153,11 +1153,10 @@
void JvmtiExport::post_class_load(JavaThread *thread, Klass* klass) {
if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) {
return;
}
HandleMark hm(thread);
- KlassHandle kh(thread, klass);
EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Trg Class Load triggered",
JvmtiTrace::safe_get_thread_name(thread)));
JvmtiThreadState* state = thread->jvmti_thread_state();
if (state == NULL) {
@@ -1170,12 +1169,12 @@
if (env->phase() == JVMTI_PHASE_PRIMORDIAL) {
continue;
}
EVT_TRACE(JVMTI_EVENT_CLASS_LOAD, ("[%s] Evt Class Load sent %s",
JvmtiTrace::safe_get_thread_name(thread),
- kh()==NULL? "NULL" : kh()->external_name() ));
- JvmtiClassEventMark jem(thread, kh());
+ klass==NULL? "NULL" : klass->external_name() ));
+ JvmtiClassEventMark jem(thread, klass);
JvmtiJavaThreadEventTransition jet(thread);
jvmtiEventClassLoad callback = env->callbacks()->ClassLoad;
if (callback != NULL) {
(*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(), jem.jni_class());
}
@@ -1187,11 +1186,10 @@
void JvmtiExport::post_class_prepare(JavaThread *thread, Klass* klass) {
if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) {
return;
}
HandleMark hm(thread);
- KlassHandle kh(thread, klass);
EVT_TRIG_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("[%s] Trg Class Prepare triggered",
JvmtiTrace::safe_get_thread_name(thread)));
JvmtiThreadState* state = thread->jvmti_thread_state();
if (state == NULL) {
@@ -1204,12 +1202,12 @@
if (env->phase() == JVMTI_PHASE_PRIMORDIAL) {
continue;
}
EVT_TRACE(JVMTI_EVENT_CLASS_PREPARE, ("[%s] Evt Class Prepare sent %s",
JvmtiTrace::safe_get_thread_name(thread),
- kh()==NULL? "NULL" : kh()->external_name() ));
- JvmtiClassEventMark jem(thread, kh());
+ klass==NULL? "NULL" : klass->external_name() ));
+ JvmtiClassEventMark jem(thread, klass);
JvmtiJavaThreadEventTransition jet(thread);
jvmtiEventClassPrepare callback = env->callbacks()->ClassPrepare;
if (callback != NULL) {
(*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(), jem.jni_class());
}
@@ -1221,11 +1219,10 @@
if (JvmtiEnv::get_phase() < JVMTI_PHASE_PRIMORDIAL) {
return;
}
Thread *thread = Thread::current();
HandleMark hm(thread);
- KlassHandle kh(thread, klass);
EVT_TRIG_TRACE(EXT_EVENT_CLASS_UNLOAD, ("[?] Trg Class Unload triggered" ));
if (JvmtiEventController::is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) {
assert(thread->is_VM_thread(), "wrong thread");
@@ -1242,16 +1239,16 @@
if (env->phase() == JVMTI_PHASE_PRIMORDIAL) {
continue;
}
if (env->is_enabled((jvmtiEvent)EXT_EVENT_CLASS_UNLOAD)) {
EVT_TRACE(EXT_EVENT_CLASS_UNLOAD, ("[?] Evt Class Unload sent %s",
- kh()==NULL? "NULL" : kh()->external_name() ));
+ klass==NULL? "NULL" : klass->external_name() ));
// do everything manually, since this is a proxy - needs special care
JNIEnv* jni_env = real_thread->jni_environment();
jthread jt = (jthread)JNIHandles::make_local(real_thread, real_thread->threadObj());
- jclass jk = (jclass)JNIHandles::make_local(real_thread, kh()->java_mirror());
+ jclass jk = (jclass)JNIHandles::make_local(real_thread, klass->java_mirror());
// Before we call the JVMTI agent, we have to set the state in the
// thread for which we are proxying.
JavaThreadState prev_state = real_thread->thread_state();
assert(((Thread *)real_thread)->is_ConcurrentGC_thread() ||
@@ -1593,11 +1590,11 @@
current_method = st.method();
current_mh = methodHandle(thread, current_method);
current_bci = st.bci();
do {
should_repeat = false;
- KlassHandle eh_klass(thread, exception_handle()->klass());
+ Klass* eh_klass = exception_handle()->klass();
current_bci = Method::fast_exception_handler_bci_for(
current_mh, eh_klass, current_bci, THREAD);
if (HAS_PENDING_EXCEPTION) {
exception_handle = Handle(thread, PENDING_EXCEPTION);
CLEAR_PENDING_EXCEPTION;
@@ -1741,25 +1738,24 @@
if (!valid_fieldID) return;
// field accesses are not watched so bail
if (!fd.is_field_access_watched()) return;
HandleMark hm(thread);
- KlassHandle h_klass(thread, klass);
Handle h_obj;
if (!is_static) {
// non-static field accessors have an object, but we need a handle
assert(obj != NULL, "non-static needs an object");
h_obj = Handle(thread, obj);
}
post_field_access(thread,
thread->last_frame().interpreter_frame_method(),
thread->last_frame().interpreter_frame_bcp(),
- h_klass, h_obj, fieldID);
+ klass, h_obj, fieldID);
}
void JvmtiExport::post_field_access(JavaThread *thread, Method* method,
- address location, KlassHandle field_klass, Handle object, jfieldID field) {
+ address location, Klass* field_klass, Handle object, jfieldID field) {
HandleMark hm(thread);
methodHandle mh(thread, method);
JvmtiThreadState *state = thread->jvmti_thread_state();
@@ -1777,11 +1773,11 @@
(mh() == NULL) ? "NULL" : mh()->name()->as_C_string(),
location - mh()->code_base() ));
JvmtiEnv *env = ets->get_env();
JvmtiLocationEventMark jem(thread, mh, location);
- jclass field_jclass = jem.to_jclass(field_klass());
+ jclass field_jclass = jem.to_jclass(field_klass);
jobject field_jobject = jem.to_jobject(object());
JvmtiJavaThreadEventTransition jet(thread);
jvmtiEventFieldAccess callback = env->callbacks()->FieldAccess;
if (callback != NULL) {
(*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(),
@@ -1845,26 +1841,25 @@
if (!is_static) {
// non-static field accessors have an object, but we need a handle
assert(obj != NULL, "non-static needs an object");
h_obj = Handle(thread, obj);
}
- KlassHandle h_klass(thread, klass);
post_field_modification(thread,
thread->last_frame().interpreter_frame_method(),
thread->last_frame().interpreter_frame_bcp(),
- h_klass, h_obj, fieldID, sig_type, value);
+ klass, h_obj, fieldID, sig_type, value);
}
void JvmtiExport::post_raw_field_modification(JavaThread *thread, Method* method,
- address location, KlassHandle field_klass, Handle object, jfieldID field,
+ address location, Klass* field_klass, Handle object, jfieldID field,
char sig_type, jvalue *value) {
if (sig_type == 'I' || sig_type == 'Z' || sig_type == 'B' || sig_type == 'C' || sig_type == 'S') {
// 'I' instructions are used for byte, char, short and int.
// determine which it really is, and convert
fieldDescriptor fd;
- bool found = JvmtiEnv::get_field_descriptor(field_klass(), field, &fd);
+ bool found = JvmtiEnv::get_field_descriptor(field_klass, field, &fd);
// should be found (if not, leave as is)
if (found) {
jint ival = value->i;
// convert value from int to appropriate type
switch (fd.field_type()) {
@@ -1915,11 +1910,11 @@
JNIHandles::destroy_local(value->l);
}
}
void JvmtiExport::post_field_modification(JavaThread *thread, Method* method,
- address location, KlassHandle field_klass, Handle object, jfieldID field,
+ address location, Klass* field_klass, Handle object, jfieldID field,
char sig_type, jvalue *value_ptr) {
HandleMark hm(thread);
methodHandle mh(thread, method);
@@ -1941,11 +1936,11 @@
(mh() == NULL) ? "NULL" : mh()->name()->as_C_string(),
location - mh()->code_base() ));
JvmtiEnv *env = ets->get_env();
JvmtiLocationEventMark jem(thread, mh, location);
- jclass field_jclass = jem.to_jclass(field_klass());
+ jclass field_jclass = jem.to_jclass(field_klass);
jobject field_jobject = jem.to_jobject(object());
JvmtiJavaThreadEventTransition jet(thread);
jvmtiEventFieldModification callback = env->callbacks()->FieldModification;
if (callback != NULL) {
(*callback)(env->jvmti_external(), jem.jni_env(), jem.jni_thread(),
< prev index next >