1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
3339 if(ZeroTLAB) {
3340 // the fields have already been cleared
3341 __ brx(Assembler::lessEqualUnsigned, true, Assembler::pt, initialize_header);
3342 } else {
3343 // initialize both the header and fields
3344 __ brx(Assembler::lessEqualUnsigned, true, Assembler::pt, initialize_object);
3345 }
3346 __ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset()));
3347
3348 if (allow_shared_alloc) {
3349 // Check if tlab should be discarded (refill_waste_limit >= free)
3350 __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
3351 __ sub(RendValue, RoldTopValue, RfreeValue);
3352 #ifdef _LP64
3353 __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
3354 #else
3355 __ srl(RfreeValue, LogHeapWordSize, RfreeValue);
3356 #endif
3357 __ cmp_and_brx_short(RtlabWasteLimitValue, RfreeValue, Assembler::greaterEqualUnsigned, Assembler::pt, slow_case); // tlab waste is small
3358
3359 // increment waste limit to prevent getting stuck on this slow path
3360 __ add(RtlabWasteLimitValue, ThreadLocalAllocBuffer::refill_waste_limit_increment(), RtlabWasteLimitValue);
3361 __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
3362 } else {
3363 // No allocation in the shared eden.
3364 __ ba_short(slow_case);
3365 }
3366 }
3367
3368 // Allocation in the shared Eden
3369 if (allow_shared_alloc) {
3370 Register RoldTopValue = G1_scratch;
3371 Register RtopAddr = G3_scratch;
3372 Register RnewTopValue = RallocatedObject;
3373 Register RendValue = Rscratch;
3374
3375 __ set((intptr_t)Universe::heap()->top_addr(), RtopAddr);
3376
3377 Label retry;
3378 __ bind(retry);
3379 __ set((intptr_t)Universe::heap()->end_addr(), RendValue);
3380 __ ld_ptr(RendValue, 0, RendValue);
|
1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
3339 if(ZeroTLAB) {
3340 // the fields have already been cleared
3341 __ brx(Assembler::lessEqualUnsigned, true, Assembler::pt, initialize_header);
3342 } else {
3343 // initialize both the header and fields
3344 __ brx(Assembler::lessEqualUnsigned, true, Assembler::pt, initialize_object);
3345 }
3346 __ delayed()->st_ptr(RnewTopValue, G2_thread, in_bytes(JavaThread::tlab_top_offset()));
3347
3348 if (allow_shared_alloc) {
3349 // Check if tlab should be discarded (refill_waste_limit >= free)
3350 __ ld_ptr(G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()), RtlabWasteLimitValue);
3351 __ sub(RendValue, RoldTopValue, RfreeValue);
3352 #ifdef _LP64
3353 __ srlx(RfreeValue, LogHeapWordSize, RfreeValue);
3354 #else
3355 __ srl(RfreeValue, LogHeapWordSize, RfreeValue);
3356 #endif
3357 __ cmp_and_brx_short(RtlabWasteLimitValue, RfreeValue, Assembler::greaterEqualUnsigned, Assembler::pt, slow_case); // tlab waste is small
3358
3359 // set64 does not use the temp register if the given constant is 32 bit. So
3360 // we can just use any register; using G0 results in ignoring of the upper 32 bit
3361 // of that value.
3362 __ set64(ThreadLocalAllocBuffer::refill_waste_limit_increment(), G4_scratch, G0);
3363 // increment waste limit to prevent getting stuck on this slow path
3364 __ add(RtlabWasteLimitValue, G4_scratch, RtlabWasteLimitValue);
3365 __ st_ptr(RtlabWasteLimitValue, G2_thread, in_bytes(JavaThread::tlab_refill_waste_limit_offset()));
3366 } else {
3367 // No allocation in the shared eden.
3368 __ ba_short(slow_case);
3369 }
3370 }
3371
3372 // Allocation in the shared Eden
3373 if (allow_shared_alloc) {
3374 Register RoldTopValue = G1_scratch;
3375 Register RtopAddr = G3_scratch;
3376 Register RnewTopValue = RallocatedObject;
3377 Register RendValue = Rscratch;
3378
3379 __ set((intptr_t)Universe::heap()->top_addr(), RtopAddr);
3380
3381 Label retry;
3382 __ bind(retry);
3383 __ set((intptr_t)Universe::heap()->end_addr(), RendValue);
3384 __ ld_ptr(RendValue, 0, RendValue);
|