1 /*
2 * Copyright (c) 1999, 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 *
256 cmp_and_brx_short(t1, var_size_in_bytes, Assembler::equal, Assembler::pt, ok);
257 } else {
258 cmp_and_brx_short(t1, con_size_in_bytes, Assembler::equal, Assembler::pt, ok);
259 }
260 stop("bad size in initialize_object");
261 should_not_reach_here();
262
263 bind(ok);
264 }
265
266 #endif
267
268 if (!(UseTLAB && ZeroTLAB && is_tlab_allocated)) {
269 // initialize body
270 const int threshold = 5 * HeapWordSize; // approximate break even point for code size
271 if (var_size_in_bytes != noreg) {
272 // use a loop
273 add(obj, hdr_size_in_bytes, t1); // compute address of first element
274 sub(var_size_in_bytes, hdr_size_in_bytes, t2); // compute size of body
275 initialize_body(t1, t2);
276 #ifndef _LP64
277 } else if (con_size_in_bytes < threshold * 2) {
278 // on v9 we can do double word stores to fill twice as much space.
279 assert(hdr_size_in_bytes % 8 == 0, "double word aligned");
280 assert(con_size_in_bytes % 8 == 0, "double word aligned");
281 for (int i = hdr_size_in_bytes; i < con_size_in_bytes; i += 2 * HeapWordSize) stx(G0, obj, i);
282 #endif
283 } else if (con_size_in_bytes <= threshold) {
284 // use explicit NULL stores
285 for (int i = hdr_size_in_bytes; i < con_size_in_bytes; i += HeapWordSize) st_ptr(G0, obj, i);
286 } else if (con_size_in_bytes > hdr_size_in_bytes) {
287 // use a loop
288 const Register base = t1;
289 const Register index = t2;
290 add(obj, hdr_size_in_bytes, base); // compute address of first element
291 // compute index = number of words to clear
292 set(con_size_in_bytes - hdr_size_in_bytes, index);
293 initialize_body(base, index);
294 }
295 }
296
297 if (CURRENT_ENV->dtrace_alloc_probes()) {
298 assert(obj == O0, "must be");
299 call(CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)),
300 relocInfo::runtime_call_type);
301 delayed()->nop();
302 }
|
1 /*
2 * Copyright (c) 1999, 2017, 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 *
256 cmp_and_brx_short(t1, var_size_in_bytes, Assembler::equal, Assembler::pt, ok);
257 } else {
258 cmp_and_brx_short(t1, con_size_in_bytes, Assembler::equal, Assembler::pt, ok);
259 }
260 stop("bad size in initialize_object");
261 should_not_reach_here();
262
263 bind(ok);
264 }
265
266 #endif
267
268 if (!(UseTLAB && ZeroTLAB && is_tlab_allocated)) {
269 // initialize body
270 const int threshold = 5 * HeapWordSize; // approximate break even point for code size
271 if (var_size_in_bytes != noreg) {
272 // use a loop
273 add(obj, hdr_size_in_bytes, t1); // compute address of first element
274 sub(var_size_in_bytes, hdr_size_in_bytes, t2); // compute size of body
275 initialize_body(t1, t2);
276 } else if (con_size_in_bytes <= threshold) {
277 // use explicit NULL stores
278 for (int i = hdr_size_in_bytes; i < con_size_in_bytes; i += HeapWordSize) st_ptr(G0, obj, i);
279 } else if (con_size_in_bytes > hdr_size_in_bytes) {
280 // use a loop
281 const Register base = t1;
282 const Register index = t2;
283 add(obj, hdr_size_in_bytes, base); // compute address of first element
284 // compute index = number of words to clear
285 set(con_size_in_bytes - hdr_size_in_bytes, index);
286 initialize_body(base, index);
287 }
288 }
289
290 if (CURRENT_ENV->dtrace_alloc_probes()) {
291 assert(obj == O0, "must be");
292 call(CAST_FROM_FN_PTR(address, Runtime1::entry_for(Runtime1::dtrace_object_alloc_id)),
293 relocInfo::runtime_call_type);
294 delayed()->nop();
295 }
|