# HG changeset patch # User jcbeyler # Date 1532100541 25200 # Fri Jul 20 08:29:01 2018 -0700 # Node ID dc9b18d57bd81e21c3921f359fba138b6dbc97f8 # Parent 4e98b465d706c1fee9e63811805af555a7fa8739 8207252: C1 still does eden allocations when TLAB is enabled Summary: Only do eden allocations when TLAB is disabled Reviewed-by: kbarrett, jrose, tschatzl Contributed-by: jcbeyler@google.com diff --git a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp --- a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp @@ -687,8 +687,11 @@ __ set_info("fast new_instance init check", dont_gc_arguments); } + // If TLAB is disabled, see if there is support for inlining contiguous + // allocations. + // Otherwise, just go to the slow path. if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) && - UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { + !UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { Label slow_path; Register obj_size = r2; Register t1 = r19; @@ -799,7 +802,10 @@ } #endif // ASSERT - if (UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { + // If TLAB is disabled, see if there is support for inlining contiguous + // allocations. + // Otherwise, just go to the slow path. + if (!UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { Register arr_size = r4; Register t1 = r2; Register t2 = r5; diff --git a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp --- a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp +++ b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp @@ -546,9 +546,10 @@ const Register result = R0; const Register klass = R1; - if (UseTLAB && Universe::heap()->supports_inline_contig_alloc() && id != new_instance_id) { - // We come here when TLAB allocation failed. - // In this case we try to allocate directly from eden. + // If TLAB is disabled, see if there is support for inlining contiguous + // allocations. + // Otherwise, just go to the slow path. + if (!UseTLAB && Universe::heap()->supports_inline_contig_alloc() && id != new_instance_id) { Label slow_case, slow_case_no_pop; // Make sure the class is fully initialized @@ -616,9 +617,10 @@ const Register klass = R1; const Register length = R2; - if (UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { - // We come here when TLAB allocation failed. - // In this case we try to allocate directly from eden. + // If TLAB is disabled, see if there is support for inlining contiguous + // allocations. + // Otherwise, just go to the slow path. + if (!UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { Label slow_case, slow_case_no_pop; #ifdef AARCH64 diff --git a/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp b/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp --- a/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp +++ b/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp @@ -407,8 +407,11 @@ __ set_info("fast new_instance init check", dont_gc_arguments); } + // If TLAB is disabled, see if there is support for inlining contiguous + // allocations. + // Otherwise, just go to the slow path. if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) && - UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { + !UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { Label slow_path; Register G1_obj_size = G1; Register G3_t1 = G3; diff --git a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp --- a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp +++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp @@ -1013,7 +1013,10 @@ __ set_info("fast new_instance init check", dont_gc_arguments); } - if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) && UseTLAB + // If TLAB is disabled, see if there is support for inlining contiguous + // allocations. + // Otherwise, just go to the slow path. + if ((id == fast_new_instance_id || id == fast_new_instance_init_check_id) && !UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { Label slow_path; Register obj_size = rcx; @@ -1046,13 +1049,9 @@ } #endif // ASSERT - // if we got here then the TLAB allocation failed, so try - // refilling the TLAB or allocating directly from eden. - Label retry_tlab, try_eden; const Register thread = NOT_LP64(rdi) LP64_ONLY(r15_thread); NOT_LP64(__ get_thread(thread)); - __ bind(try_eden); // get the instance size (size is postive so movl is fine for 64bit) __ movl(obj_size, Address(klass, Klass::layout_helper_offset())); @@ -1133,9 +1132,10 @@ } #endif // ASSERT - // If we got here, the TLAB allocation failed, so try allocating from - // eden if inline contiguous allocations are supported. - if (UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { + // If TLAB is disabled, see if there is support for inlining contiguous + // allocations. + // Otherwise, just go to the slow path. + if (!UseTLAB && Universe::heap()->supports_inline_contig_alloc()) { Register arr_size = rsi; Register t1 = rcx; // must be rcx for use as shift count Register t2 = rdi;