< prev index next >

src/hotspot/share/prims/unsafe.cpp

Print this page
@@ -351,11 +351,11 @@
  
  ////// Allocation requests
  
  UNSAFE_ENTRY(jobject, Unsafe_AllocateInstance(JNIEnv *env, jobject unsafe, jclass cls)) {
    JvmtiVMObjectAllocEventCollector oam;
-   instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(cls), CHECK_NULL);
+   instanceOop i = InstanceKlass::allocate_instance(JNIHandles::resolve_non_null(cls), "unsafe", CHECK_NULL);
    return JNIHandles::make_local(THREAD, i);
  } UNSAFE_END
  
  UNSAFE_LEAF(jlong, Unsafe_AllocateMemory0(JNIEnv *env, jobject unsafe, jlong size)) {
    size_t sz = (size_t)size;

@@ -557,10 +557,15 @@
  
    oop mirror = JNIHandles::resolve_non_null(clazz);
  
    Klass* klass = java_lang_Class::as_Klass(mirror);
    if (klass != nullptr && klass->should_be_initialized()) {
+     if (RecordTraining) {
+       InstanceKlass* k = InstanceKlass::cast(klass);
+       k->record_initialization_touch("ensure", nullptr, nullptr, nullptr,
+                                      "unsafe", CHECK);
+     }
      InstanceKlass* k = InstanceKlass::cast(klass);
      k->initialize(CHECK);
    }
  }
  UNSAFE_END
< prev index next >