--- old/src/hotspot/share/opto/graphKit.cpp 2018-07-04 16:48:45.857121616 +0200 +++ new/src/hotspot/share/opto/graphKit.cpp 2018-07-04 16:48:45.477121621 +0200 @@ -1772,13 +1772,21 @@ arg = vt->allocate(this)->get_oop(); } } else if (t->is_valuetypeptr()) { - // Constant null passed for a value type argument - assert(arg->bottom_type()->remove_speculative() == TypePtr::NULL_PTR, "Anything other than null?"); ciMethod* declared_method = method()->get_method_at_bci(bci()); - int arg_size = declared_method->signature()->arg_size_for_bc(java_bc()); - inc_sp(arg_size); // restore arguments - uncommon_trap(Deoptimization::Reason_null_check, Deoptimization::Action_none); - return; + if (arg->is_ValueTypePtr()) { + // We are calling an Object method with a value type receiver + ValueTypePtrNode* vt = arg->isa_ValueTypePtr(); + assert(i == TypeFunc::Parms && !declared_method->is_static(), "argument must be receiver"); + assert(vt->is_allocated(&gvn()), "argument must be allocated"); + arg = vt->get_oop(); + } else { + // Constant null passed for a value type argument + assert(arg->bottom_type()->remove_speculative() == TypePtr::NULL_PTR, "Anything other than null?"); + int arg_size = declared_method->signature()->arg_size_for_bc(java_bc()); + inc_sp(arg_size); // restore arguments + uncommon_trap(Deoptimization::Reason_null_check, Deoptimization::Action_none); + return; + } } call->init_req(idx, arg); idx++; @@ -3411,6 +3419,14 @@ assert(dead_locals_are_killed(), "should kill locals before sync. point"); + // We cannot lock on a value type + if (obj->is_ValueTypeBase()) { + inc_sp(1); + uncommon_trap(Deoptimization::Reason_class_check, Deoptimization::Action_none); + dec_sp(1); + return NULL; + } + // Box the stack location Node* box = _gvn.transform(new BoxLockNode(next_monitor())); Node* mem = reset_memory(); @@ -3478,6 +3494,7 @@ map()->pop_monitor(); // Kill monitor from debug info return; } + assert(!obj->is_ValueTypeBase(), "should not unlock on value type"); // Memory barrier to avoid floating things down past the locked region insert_mem_bar(Op_MemBarReleaseLock);