Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8242210: [lworld] TestCallingConvention::test36 spuriously fails #13

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -189,7 +189,6 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
// Can we store original value in the thread's buffer?
// Is index == 0?
// (The index field is typed as size_t.)

__ movptr(tmp, index); // tmp := *index_adr
__ cmpptr(tmp, 0); // tmp == 0?
__ jcc(Assembler::equal, runtime); // If yes, goto runtime
@@ -203,14 +202,10 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
__ jmp(done);

__ bind(runtime);
// save the live input values
if(tosca_live) __ push(rax);

if (obj != noreg && obj != rax)
__ push(obj);

if (pre_val != rax)
__ push(pre_val);
// FIXME
// Barriers might be emitted when converting between (scalarized) calling conventions for inline
// types. Save all registers until JDK-8232094 is fixed to avoid overwriting argument registers.
__ pusha();

// Calling the runtime using the regular call_VM_leaf mechanism generates
// code (generated by InterpreterMacroAssember::call_VM_leaf_base)
@@ -224,8 +219,6 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
// So when we do not have have a full interpreter frame on the stack
// expand_call should be passed true.

NOT_LP64( __ push(thread); )

if (expand_call) {
LP64_ONLY( assert(pre_val != c_rarg1, "smashed arg"); )
#ifdef _LP64
@@ -244,17 +237,7 @@ void G1BarrierSetAssembler::g1_write_barrier_pre(MacroAssembler* masm,
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_pre_entry), pre_val, thread);
}

NOT_LP64( __ pop(thread); )

// save the live input values
if (pre_val != rax)
__ pop(pre_val);

if (obj != noreg && obj != rax)
__ pop(obj);

if(tosca_live) __ pop(rax);

__ popa();
__ bind(done);
}

@@ -329,26 +312,20 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm,
__ jmp(done);

__ bind(runtime);
// save the live input values
__ push(store_addr);
__ push(new_val);
// Save caller saved registers until JDK-8232094 is fixed (TODO).
__ push(rax);
__ push(rcx);
__ push(rdx);
// FIXME
// Barriers might be emitted when converting between (scalarized) calling conventions for inline
// types. Save all registers until JDK-8232094 is fixed to avoid overwriting argument registers.
__ pusha();

#ifdef _LP64
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, r15_thread);
#else
__ push(thread);
__ call_VM_leaf(CAST_FROM_FN_PTR(address, G1BarrierSetRuntime::write_ref_field_post_entry), card_addr, thread);
__ pop(thread);
#endif
__ pop(rdx);
__ pop(rcx);
__ pop(rax);
__ pop(new_val);
__ pop(store_addr);

__ popa();
__ bind(done);
}

@@ -852,8 +852,7 @@ class CompileReplay : public StackObj {
break;
}
case T_VALUETYPE: {
SignatureStream ss(fd->signature(), false);
ValueKlass* vk = ss.as_value_klass(fd->field_holder());
ValueKlass* vk = ValueKlass::cast(fd->field_holder()->get_value_field_klass(fd->index()));
if (fd->is_flattened()) {
int field_offset = fd->offset() - vk->first_field_offset();
oop obj = (oop)(cast_from_oop<address>(_vt) + field_offset);
@@ -224,7 +224,12 @@ static bool eliminate_allocations(JavaThread* thread, int exec_mode, CompiledMet
if (TraceDeoptimization) {
ttyLocker ttyl;
tty->print_cr("REALLOC OBJECTS in thread " INTPTR_FORMAT, p2i(thread));
Deoptimization::print_objects(objects, realloc_failures);
if (objects != NULL) {
Deoptimization::print_objects(objects, realloc_failures);
} else {
Handle obj = realloc_failures ? Handle() : return_oops.first();
Deoptimization::print_object(vk, obj, realloc_failures);
}
}
#endif
}
@@ -1404,25 +1409,26 @@ void Deoptimization::relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaT
// print information about reallocated objects
void Deoptimization::print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures) {
fieldDescriptor fd;

for (int i = 0; i < objects->length(); i++) {
ObjectValue* sv = (ObjectValue*) objects->at(i);
Klass* k = java_lang_Class::as_Klass(sv->klass()->as_ConstantOopReadValue()->value()());
Handle obj = sv->value();
print_object(k, sv->value(), realloc_failures);
}
}

tty->print(" object <" INTPTR_FORMAT "> of type ", p2i(sv->value()()));
k->print_value();
assert(obj.not_null() || realloc_failures, "reallocation was missed");
if (obj.is_null()) {
tty->print(" allocation failed");
} else {
tty->print(" allocated (%d bytes)", obj->size() * HeapWordSize);
}
tty->cr();
void Deoptimization::print_object(Klass* k, Handle obj, bool realloc_failures) {
tty->print(" object <" INTPTR_FORMAT "> of type ", p2i(obj()));
k->print_value();
assert(obj.not_null() || realloc_failures, "reallocation was missed");
if (obj.is_null()) {
tty->print(" allocation failed");
} else {
tty->print(" allocated (%d bytes)", obj->size() * HeapWordSize);
}
tty->cr();

if (Verbose && !obj.is_null()) {
k->oop_print_on(obj(), tty);
}
if (Verbose && !obj.is_null()) {
k->oop_print_on(obj(), tty);
}
}
#endif
@@ -172,7 +172,10 @@ class Deoptimization : AllStatic {
static void reassign_fields(frame* fr, RegisterMap* reg_map, GrowableArray<ScopeValue*>* objects, bool realloc_failures, bool skip_internal, TRAPS);
static void relock_objects(GrowableArray<MonitorInfo*>* monitors, JavaThread* thread, bool realloc_failures);
static void pop_frames_failed_reallocs(JavaThread* thread, vframeArray* array);
NOT_PRODUCT(static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);)
#ifndef PRODUCT
static void print_objects(GrowableArray<ScopeValue*>* objects, bool realloc_failures);
static void print_object(Klass* k, Handle obj, bool realloc_failures);
#endif
#endif // COMPILER2_OR_JVMCI

public:
@@ -31,7 +31,7 @@
#include "oops/instanceKlass.hpp"
#include "oops/oop.inline.hpp"
#include "oops/fieldStreams.inline.hpp"
#include "oops/valueKlass.hpp"
#include "oops/valueKlass.inline.hpp"
#include "runtime/fieldDescriptor.inline.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/signature.hpp"
@@ -190,41 +190,26 @@ void fieldDescriptor::print_on_for(outputStream* st, oop obj) {
as_int = obj->bool_field(offset());
st->print(" %s", obj->bool_field(offset()) ? "true" : "false");
break;
case T_ARRAY:
st->print(" ");
NOT_LP64(as_int = obj->int_field(offset()));
if (obj->obj_field(offset()) != NULL) {
obj->obj_field(offset())->print_value_on(st);
} else {
st->print_cr("NULL");
}
break;
case T_OBJECT:
st->print(" ");
NOT_LP64(as_int = obj->int_field(offset()));
if (obj->obj_field(offset()) != NULL) {
obj->obj_field(offset())->print_value_on(st);
} else {
st->print_cr("NULL");
}
break;
case T_VALUETYPE:
if (is_flattened()) {
// Resolve klass of flattened value type field
ResourceMark rm(Thread::current());
SignatureStream ss(signature(), false);
ValueKlass* vk = ss.as_value_klass(field_holder());
// Print fields of flattened value type field
ValueKlass* vk = ValueKlass::cast(field_holder()->get_value_field_klass(index()));
int field_offset = offset() - vk->first_field_offset();
obj = (oop)(cast_from_oop<address>(obj) + field_offset);
// Print flattened fields of the value type field
st->print_cr("Flattened value type '%s':", vk->name()->as_C_string());
FieldPrinter print_field(st, obj);
vk->do_nonstatic_fields(&print_field);
return; // Do not print underlying representation
} else {
st->print(" ");
NOT_LP64(as_int = obj->int_field(offset()));
}
// Non-flattened field, fall through
case T_ARRAY:
case T_OBJECT:
st->print(" ");
NOT_LP64(as_int = obj->int_field(offset()));
if (obj->obj_field(offset()) != NULL) {
obj->obj_field(offset())->print_value_on(st);
} else {
st->print_cr("NULL");
}
break;
default:
@@ -50,7 +50,7 @@ private static void assertDeoptimizedByC2(Method m) {
CompLevel_full_profile = 3, // C1, invocation & backedge counters + mdo
CompLevel_full_optimization = 4; // C2 or JVMCI

if (USE_COMPILER && !XCOMP && WHITE_BOX.isMethodCompiled(m, false) &&
if (USE_COMPILER && !XCOMP && !STRESS_CC && WHITE_BOX.isMethodCompiled(m, false) &&
WHITE_BOX.getMethodCompilationLevel(m, false) >= CompLevel_full_optimization) {
throw new RuntimeException("Type check should have caused it to deoptimize");
}
@@ -877,7 +877,7 @@ static boolean compile_and_run_again_if_deoptimized(boolean warmup, String test)
if (!warmup) {
Method m = tests.get(test);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false)) {
if (!ValueTypeArrayFlatten && !XCOMP) {
if (!ValueTypeArrayFlatten && !XCOMP && !STRESS_CC) {
throw new RuntimeException("Unexpected deoptimization");
}
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
@@ -973,7 +973,7 @@ public void test38_verifier(boolean warmup) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
test38(src, dst);
verify(dst, src);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1022,7 +1022,7 @@ public void test40_verifier(boolean warmup) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
test40(src, dst);
verify(dst, src);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1066,7 +1066,7 @@ public void test42_verifier(boolean warmup) {
verify(src, dst);
if (!warmup) {
Method m = tests.get("TestArrays::test42");
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1154,7 +1154,7 @@ public void test46_verifier(boolean warmup) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
test46(src, dst);
verify(dst, src);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1201,7 +1201,7 @@ public void test48_verifier(boolean warmup) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
test48(src, dst);
verify(dst, src);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1243,7 +1243,7 @@ public void test50_verifier(boolean warmup) {
verify(src, dst);
if (!warmup) {
Method m = tests.get("TestArrays::test50");
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -2324,7 +2324,7 @@ public void test93_verifier(boolean warmup) {
}
}
boolean compiled = isCompiledByC2(m);
Asserts.assertTrue(!USE_COMPILER || XCOMP || TEST_C1 || compiled || (j != extra-1));
Asserts.assertTrue(!USE_COMPILER || XCOMP || STRESS_CC || TEST_C1 || compiled || (j != extra-1));
if (!compiled) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
}
@@ -355,12 +355,10 @@ public void test14_verifier(boolean warmup) {
deopt = true;
}
}
if (!TieredCompilation && (deopt && (UseArrayLoadStoreProfile || TypeProfileLevel == 222))) {
if (!TieredCompilation && !STRESS_CC && (deopt && (UseArrayLoadStoreProfile || TypeProfileLevel == 222))) {
throw new RuntimeException("Monomorphic array check should rely on profiling and be accurate");
}

}

}

// null free array profiling
@@ -1079,7 +1079,7 @@ static boolean compile_and_run_again_if_deoptimized(boolean warmup, String test)
if (!warmup) {
Method m = tests.get(test);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false)) {
if (!ValueTypeArrayFlatten && !XCOMP) {
if (!ValueTypeArrayFlatten && !XCOMP && !STRESS_CC) {
throw new RuntimeException("Unexpected deoptimization");
}
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
@@ -1175,7 +1175,7 @@ public void test38_verifier(boolean warmup) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
test38(src, dst);
verify(dst, src);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1224,7 +1224,7 @@ public void test40_verifier(boolean warmup) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
test40(src, dst);
verify(dst, src);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1268,7 +1268,7 @@ public void test42_verifier(boolean warmup) {
verify(src, dst);
if (!warmup) {
Method m = tests.get("TestNullableArrays::test42");
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1356,7 +1356,7 @@ public void test46_verifier(boolean warmup) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
test46(src, dst);
verify(dst, src);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1403,7 +1403,7 @@ public void test48_verifier(boolean warmup) {
enqueueMethodForCompilation(m, COMP_LEVEL_FULL_OPTIMIZATION);
test48(src, dst);
verify(dst, src);
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}
@@ -1445,7 +1445,7 @@ public void test50_verifier(boolean warmup) {
verify(src, dst);
if (!warmup) {
Method m = tests.get("TestNullableArrays::test50");
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP) {
if (USE_COMPILER && !WHITE_BOX.isMethodCompiled(m, false) && !XCOMP && !STRESS_CC) {
throw new RuntimeException("unexpected deoptimization");
}
}