8207252: C1 still does eden allocations when TLAB is enabled

Only do eden allocations when TLAB is disabled

Reviewed-by: kbarrett, jrose, tschatzl, iveresov
This commit is contained in:
Jean Christophe Beyler 2018-07-22 20:00:39 -07:00 committed by Jean Christophe Beyler
parent 16dcca2c40
commit 39cd4bdd52
4 changed files with 28 additions and 17 deletions

View File

@ -687,8 +687,11 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
__ 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 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
}
#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;

View File

@ -546,9 +546,10 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
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 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
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

View File

@ -407,8 +407,11 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
__ 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;

View File

@ -1013,7 +1013,10 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
__ 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 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
}
#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 @@ OopMapSet* Runtime1::generate_code_for(StubID id, StubAssembler* sasm) {
}
#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;