8144573: TLABWasteIncrement=max_jint fires an assert on SPARC for non-G1 GC mode
Summary: Changed to use set64 if TLABWasteIncrement is larger than 4095 before add
Reviewed-by: tschatzl, iveresov
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Mon Jan 11 09:14:01 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp Thu Jan 07 16:19:41 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3400,10 +3400,20 @@
// Retain tlab and allocate object in shared space if
// the amount free in the tlab is too large to discard.
cmp(t1, t2);
+
brx(Assembler::lessEqual, false, Assembler::pt, discard_tlab);
-
// increment waste limit to prevent getting stuck on this slow path
- delayed()->add(t2, ThreadLocalAllocBuffer::refill_waste_limit_increment(), t2);
+ if (Assembler::is_simm13(ThreadLocalAllocBuffer::refill_waste_limit_increment())) {
+ delayed()->add(t2, ThreadLocalAllocBuffer::refill_waste_limit_increment(), t2);
+ } else {
+ delayed()->nop();
+ // set64 does not use the temp register if the given constant is 32 bit. So
+ // we can just use any register; using G0 results in ignoring of the upper 32 bit
+ // of that value.
+ set64(ThreadLocalAllocBuffer::refill_waste_limit_increment(), t3, G0);
+ add(t2, t3, t2);
+ }
+
st_ptr(t2, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
if (TLABStats) {
// increment number of slow_allocations
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Mon Jan 11 09:14:01 2016 +0100
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp Thu Jan 07 16:19:41 2016 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -3356,7 +3356,15 @@
__ cmp_and_brx_short(RtlabWasteLimitValue, RfreeValue, Assembler::greaterEqualUnsigned, Assembler::pt, slow_case); // tlab waste is small
// increment waste limit to prevent getting stuck on this slow path
- __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
+ if (Assembler::is_simm13(ThreadLocalAllocBuffer::refill_waste_limit_increment())) {
+ __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
+ } else {
+ // set64 does not use the temp register if the given constant is 32 bit. So
+ // we can just use any register; using G0 results in ignoring of the upper 32 bit
+ // of that value.
+ __ set64(ThreadLocalAllocBuffer::refill_waste_limit_increment(), G4_scratch, G0);
+ __ add(RtlabWasteLimitValue, G4_scratch, RtlabWasteLimitValue);
+ }
__ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
} else {
// No allocation in the shared eden.