src/share/vm/opto/library_call.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File
*** old/src/share/vm/opto/library_call.cpp Tue Apr 12 21:44:32 2016
--- new/src/share/vm/opto/library_call.cpp Tue Apr 12 21:44:32 2016
*** 246,255 ****
--- 246,256 ----
void insert_pre_barrier(Node* base_oop, Node* offset, Node* pre_val, bool need_mem_bar);
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);
+ Node* make_init_guard(Node* kls);
bool inline_unsafe_allocate();
bool inline_unsafe_newArray(bool uninitialized);
bool inline_unsafe_copyMemory();
bool inline_native_currentThread();
*** 3139,3175 ****
--- 3140,3170 ----
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() {
if (callee()->is_static()) return false; // caller must have the capability!
null_check_receiver(); // null-check, then ignore
Node* cls = null_check(argument(1));
if (stopped()) return true;
Node* kls = load_klass_from_mirror(cls, false, NULL, 0);
kls = null_check(kls);
if (stopped()) return true; // argument was like int.class
+ Node* LibraryCallKit::make_init_guard(Node* kls) {
! if (!klass_needs_init_guard(kls)) return NULL;
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.
}
+ // The test is non-zero if we need to take a slow path.
+ return _gvn.transform(new SubINode(inst, bits));
+
+ }
+
+ //----------------------------inline_unsafe_allocate---------------------------
+ // public native Object Unsafe.allocateInstance0(Class<?> cls) throws InstantiationException;
+ bool LibraryCallKit::inline_unsafe_allocate() {
+ null_check_receiver(); // null-check, then ignore
+ Node* cls = null_check(argument(1));
+ Node* kls = load_klass_from_mirror(cls, false, NULL, 0);
+ Node* test = make_init_guard(kls);
Node* obj = new_instance(kls, test);
set_result(obj);
return true;
}
src/share/vm/opto/library_call.cpp
Index
Unified diffs
Context diffs
Sdiffs
Patch
New
Old
Previous File
Next File