1 /* |
1 /* |
2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
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 |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. |
7 * published by the Free Software Foundation. |
139 void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, Label& slow_case) { |
139 void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register t1, Register t2, Label& slow_case) { |
140 if (UseTLAB) { |
140 if (UseTLAB) { |
141 tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case); |
141 tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, t2, slow_case); |
142 } else { |
142 } else { |
143 eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case); |
143 eden_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case); |
|
144 incr_allocated_bytes(noreg, var_size_in_bytes, con_size_in_bytes, t1); |
144 } |
145 } |
145 } |
146 } |
146 |
147 |
147 |
148 |
148 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) { |
149 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) { |
232 } |
233 } |
233 |
234 |
234 |
235 |
235 void C1_MacroAssembler::allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case) { |
236 void C1_MacroAssembler::allocate_object(Register obj, Register t1, Register t2, int header_size, int object_size, Register klass, Label& slow_case) { |
236 assert(obj == rax, "obj must be in rax, for cmpxchg"); |
237 assert(obj == rax, "obj must be in rax, for cmpxchg"); |
237 assert(obj != t1 && obj != t2 && t1 != t2, "registers must be different"); // XXX really? |
238 assert_different_registers(obj, t1, t2); // XXX really? |
238 assert(header_size >= 0 && object_size >= header_size, "illegal sizes"); |
239 assert(header_size >= 0 && object_size >= header_size, "illegal sizes"); |
239 |
240 |
240 try_allocate(obj, noreg, object_size * BytesPerWord, t1, t2, slow_case); |
241 try_allocate(obj, noreg, object_size * BytesPerWord, t1, t2, slow_case); |
241 |
242 |
242 initialize_object(obj, klass, noreg, object_size * HeapWordSize, t1, t2); |
243 initialize_object(obj, klass, noreg, object_size * HeapWordSize, t1, t2); |