< prev index next >

src/hotspot/share/prims/jvmtiExport.cpp

Print this page

1120 
1121 static inline Klass* oop_to_klass(oop obj) {
1122   Klass* k = obj->klass();
1123 
1124   // if the object is a java.lang.Class then return the java mirror
1125   if (k == vmClasses::Class_klass()) {
1126     if (!java_lang_Class::is_primitive(obj)) {
1127       k = java_lang_Class::as_Klass(obj);
1128       assert(k != nullptr, "class for non-primitive mirror must exist");
1129     }
1130   }
1131   return k;
1132 }
1133 
1134 class JvmtiObjectAllocEventMark : public JvmtiClassEventMark  {
1135  private:
1136    jobject _jobj;
1137    jlong    _size;
1138  public:
1139    JvmtiObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klass(obj)) {
1140      _jobj = (jobject)to_jobject(obj);
1141      _size = obj->size() * wordSize;
1142    };
1143    jobject jni_jobject() { return _jobj; }
1144    jlong size() { return _size; }
1145 };
1146 
1147 class JvmtiCompiledMethodLoadEventMark : public JvmtiMethodEventMark {
1148  private:
1149   jint _code_size;
1150   const void *_code_data;
1151   jint _map_length;
1152   jvmtiAddrLocationMap *_map;
1153   const void *_compile_info;
1154  public:
1155   JvmtiCompiledMethodLoadEventMark(JavaThread *thread, nmethod *nm, void* compile_info_ptr = nullptr)
1156           : JvmtiMethodEventMark(thread,methodHandle(thread, nm->method())) {
1157     _code_data = nm->code_begin();
1158     _code_size = nm->code_size();
1159     _compile_info = compile_info_ptr; // Set void pointer of compiledMethodLoad Event. Default value is null.
1160     JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);

1120 
1121 static inline Klass* oop_to_klass(oop obj) {
1122   Klass* k = obj->klass();
1123 
1124   // if the object is a java.lang.Class then return the java mirror
1125   if (k == vmClasses::Class_klass()) {
1126     if (!java_lang_Class::is_primitive(obj)) {
1127       k = java_lang_Class::as_Klass(obj);
1128       assert(k != nullptr, "class for non-primitive mirror must exist");
1129     }
1130   }
1131   return k;
1132 }
1133 
1134 class JvmtiObjectAllocEventMark : public JvmtiClassEventMark  {
1135  private:
1136    jobject _jobj;
1137    jlong    _size;
1138  public:
1139    JvmtiObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klass(obj)) {
1140      _jobj = obj->is_inline() ? nullptr : (jobject)to_jobject(obj); // nullptr for non-identity objects
1141      _size = obj->size() * wordSize;
1142    };
1143    jobject jni_jobject() { return _jobj; }
1144    jlong size() { return _size; }
1145 };
1146 
1147 class JvmtiCompiledMethodLoadEventMark : public JvmtiMethodEventMark {
1148  private:
1149   jint _code_size;
1150   const void *_code_data;
1151   jint _map_length;
1152   jvmtiAddrLocationMap *_map;
1153   const void *_compile_info;
1154  public:
1155   JvmtiCompiledMethodLoadEventMark(JavaThread *thread, nmethod *nm, void* compile_info_ptr = nullptr)
1156           : JvmtiMethodEventMark(thread,methodHandle(thread, nm->method())) {
1157     _code_data = nm->code_begin();
1158     _code_size = nm->code_size();
1159     _compile_info = compile_info_ptr; // Set void pointer of compiledMethodLoad Event. Default value is null.
1160     JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
< prev index next >