< prev index next >
src/hotspot/cpu/sparc/templateTable_sparc.cpp
Print this page
rev 47680 : [mq]: x86_tlab
rev 47682 : [mq]: sparc2
@@ -3256,15 +3256,22 @@
// make sure klass does not have has_finalizer, or is abstract, or interface or java/lang/Class
__ btst(Klass::_lh_instance_slow_path_bit, Roffset);
__ br(Assembler::notZero, false, Assembler::pn, slow_case);
__ delayed()->nop();
- // allocate the instance
- // 1) Try to allocate in the TLAB
- // 2) if fail, and the TLAB is not full enough to discard, allocate in the shared Eden
- // 3) if the above fails (or is not applicable), go to a slow case
- // (creates a new TLAB, etc.)
+ // Allocate the instance:
+ // 1) If TLAB is enabled:
+ // a) Try to allocate in the TLAB
+ // b) If fails, go to the slow path.
+ // 2) Else TLAB is disabled:
+ // a) If inline contiguous allocations are enabled:
+ // i) Try to allocate in eden
+ // ii) If fails due to heap end, go to slow path.
+ // 3) If TLAB is enabled OR inline contiguous is enabled:
+ // a) Initialize the allocation
+ // b) Exit.
+ // 4) If neither 1 OR 2 are applicable, go to slow path.
const bool allow_shared_alloc =
Universe::heap()->supports_inline_contig_alloc();
if(UseTLAB) {
@@ -3288,34 +3295,13 @@
// initialize both the header and fields
__ brx(Assembler::lessEqualUnsigned, true, Assembler::pt, initialize_object);
}
__ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset()));
- if (allow_shared_alloc) {
- // Check if tlab should be discarded (refill_waste_limit >= free)
- __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
- __ sub(RendValue, RoldTopValue, RfreeValue);
- __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
- __ 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
- 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.
+ // Allocation does not fit in the TLAB.
__ ba_short(slow_case);
- }
- }
-
+ } else {
// Allocation in the shared Eden
if (allow_shared_alloc) {
Register RoldTopValue = G1_scratch;
Register RtopAddr = G3_scratch;
Register RnewTopValue = RallocatedObject;
@@ -3341,12 +3327,15 @@
// bump total bytes allocated by this thread
// RoldTopValue and RtopAddr are dead, so can use G1 and G3
__ incr_allocated_bytes(Roffset, G1_scratch, G3_scratch);
}
+ }
- if (UseTLAB || Universe::heap()->supports_inline_contig_alloc()) {
+ // If UseTLAB or allow_shared_alloc are true, the object is created above and
+ // there is an initialize need. Otherwise, skip and go to the slow path.
+ if (UseTLAB || allow_shared_alloc) {
// clear object fields
__ bind(initialize_object);
__ deccc(Roffset, sizeof(oopDesc));
__ br(Assembler::zero, false, Assembler::pt, initialize_header);
__ delayed()->add(RallocatedObject, sizeof(oopDesc), G3_scratch);
< prev index next >