8207252: C1 still does eden allocations when TLAB is enabled
Summary: Only do eden allocations when TLAB is disabled
Reviewed-by: kbarrett, jrose, tschatzl, iveresov
Contributed-by: jcbeyler@google.com
--- a/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp Mon Jul 23 10:02:10 2018 +0800
+++ b/src/hotspot/cpu/aarch64/c1_Runtime1_aarch64.cpp Sun Jul 22 20:00:39 2018 -0700
@@ -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;
--- a/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp Mon Jul 23 10:02:10 2018 +0800
+++ b/src/hotspot/cpu/arm/c1_Runtime1_arm.cpp Sun Jul 22 20:00:39 2018 -0700
@@ -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
--- a/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp Mon Jul 23 10:02:10 2018 +0800
+++ b/src/hotspot/cpu/sparc/c1_Runtime1_sparc.cpp Sun Jul 22 20:00:39 2018 -0700
@@ -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;
--- a/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp Mon Jul 23 10:02:10 2018 +0800
+++ b/src/hotspot/cpu/x86/c1_Runtime1_x86.cpp Sun Jul 22 20:00:39 2018 -0700
@@ -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;