--- old/src/share/vm/opto/library_call.cpp 2016-04-08 18:54:01.000000000 +0300 +++ new/src/share/vm/opto/library_call.cpp 2016-04-08 18:54:01.000000000 +0300 @@ -247,7 +247,6 @@ typedef enum { Relaxed, Opaque, Volatile, Acquire, Release } AccessKind; bool inline_unsafe_access(bool is_native_ptr, bool is_store, BasicType type, AccessKind kind, bool is_unaligned); - static bool klass_needs_init_guard(Node* kls); bool inline_unsafe_allocate(); bool inline_unsafe_newArray(bool uninitialized); bool inline_unsafe_copyMemory(); @@ -3122,19 +3121,6 @@ } } -bool LibraryCallKit::klass_needs_init_guard(Node* kls) { - if (!kls->is_Con()) { - return true; - } - const TypeKlassPtr* klsptr = kls->bottom_type()->isa_klassptr(); - if (klsptr == NULL) { - return true; - } - ciInstanceKlass* ik = klsptr->klass()->as_instance_klass(); - // don't need a guard for a klass that is already initialized - return !ik->is_initialized(); -} - //----------------------------inline_unsafe_allocate--------------------------- // public native Object Unsafe.allocateInstance(Class cls); bool LibraryCallKit::inline_unsafe_allocate() { @@ -3148,21 +3134,7 @@ kls = null_check(kls); if (stopped()) return true; // argument was like int.class - Node* test = NULL; - if (LibraryCallKit::klass_needs_init_guard(kls)) { - // Note: The argument might still be an illegal value like - // Serializable.class or Object[].class. The runtime will handle it. - // But we must make an explicit check for initialization. - Node* insp = basic_plus_adr(kls, in_bytes(InstanceKlass::init_state_offset())); - // Use T_BOOLEAN for InstanceKlass::_init_state so the compiler - // can generate code to load it as unsigned byte. - Node* inst = make_load(NULL, insp, TypeInt::UBYTE, T_BOOLEAN, MemNode::unordered); - Node* bits = intcon(InstanceKlass::fully_initialized); - test = _gvn.transform(new SubINode(inst, bits)); - // The 'test' is non-zero if we need to take a slow path. - } - - Node* obj = new_instance(kls, test); + Node* obj = new_instance(kls); set_result(obj); return true; } @@ -3736,9 +3708,9 @@ // Branch around if the kls is an oop array (Object[] or subtype) // // Like generate_guard, adds a new path onto the region. - jint layout_con = 0; + jint layout_con = Klass::_lh_neutral_value; Node* layout_val = get_layout_helper(kls, layout_con); - if (layout_val == NULL) { + if (layout_con != Klass::_lh_neutral_value) { bool query = (obj_array ? Klass::layout_helper_is_objArray(layout_con) : Klass::layout_helper_is_array(layout_con)); @@ -4712,7 +4684,7 @@ // Need to deoptimize on exception from allocation since Object.clone intrinsic // is reexecuted if deoptimization occurs and there could be problems when merging // exception state between multiple Object.clone versions (reexecute=true vs reexecute=false). - Node* alloc_obj = new_instance(obj_klass, NULL, &obj_size, /*deoptimize_on_exception=*/true); + Node* alloc_obj = new_instance(obj_klass, &obj_size, /*deoptimize_on_exception=*/true); copy_to_clone(obj, alloc_obj, obj_size, false, !use_ReduceInitialCardMarks());