< prev index next >

src/hotspot/cpu/arm/c1_MacroAssembler_arm.cpp

Print this page

140                                         Register klass, Label& slow_case) {
141   assert_different_registers(obj, tmp1, tmp2, tmp3, klass, Rtemp);
142   assert(header_size >= 0 && object_size >= header_size, "illegal sizes");
143   const int object_size_in_bytes = object_size * BytesPerWord;
144 
145   const Register obj_end = tmp1;
146   const Register len = noreg;
147 
148   if (Assembler::is_arith_imm_in_range(object_size_in_bytes)) {
149     try_allocate(obj, obj_end, tmp2, tmp3, object_size_in_bytes, slow_case);
150   } else {
151     // Rtemp should be free at c1 LIR level
152     mov_slow(Rtemp, object_size_in_bytes);
153     try_allocate(obj, obj_end, tmp2, tmp3, Rtemp, slow_case);
154   }
155   initialize_object(obj, obj_end, klass, len, tmp2, tmp3, instanceOopDesc::header_size() * HeapWordSize, object_size_in_bytes, /* is_tlab_allocated */ UseTLAB);
156 }
157 
158 void C1_MacroAssembler::allocate_array(Register obj, Register len,
159                                        Register tmp1, Register tmp2, Register tmp3,
160                                        int header_size, int element_size,
161                                        Register klass, Label& slow_case) {
162   assert_different_registers(obj, len, tmp1, tmp2, tmp3, klass, Rtemp);
163   const int header_size_in_bytes = header_size * BytesPerWord;
164   const int scale_shift = exact_log2(element_size);
165   const Register obj_size = Rtemp; // Rtemp should be free at c1 LIR level
166 
167   cmp_32(len, max_array_allocation_length);
168   b(slow_case, hs);
169 
170   bool align_header = ((header_size_in_bytes | element_size) & MinObjAlignmentInBytesMask) != 0;
171   assert(align_header || ((header_size_in_bytes & MinObjAlignmentInBytesMask) == 0), "must be");
172   assert(align_header || ((element_size & MinObjAlignmentInBytesMask) == 0), "must be");
173 
174   mov(obj_size, header_size_in_bytes + (align_header ? (MinObjAlignmentInBytes - 1) : 0));
175   add_ptr_scaled_int32(obj_size, obj_size, len, scale_shift);
176 
177   if (align_header) {
178     align_reg(obj_size, obj_size, MinObjAlignmentInBytes);
179   }
180 
181   try_allocate(obj, tmp1, tmp2, tmp3, obj_size, slow_case);
182   initialize_object(obj, tmp1, klass, len, tmp2, tmp3, header_size_in_bytes, -1, /* is_tlab_allocated */ UseTLAB);
183 }

140                                         Register klass, Label& slow_case) {
141   assert_different_registers(obj, tmp1, tmp2, tmp3, klass, Rtemp);
142   assert(header_size >= 0 && object_size >= header_size, "illegal sizes");
143   const int object_size_in_bytes = object_size * BytesPerWord;
144 
145   const Register obj_end = tmp1;
146   const Register len = noreg;
147 
148   if (Assembler::is_arith_imm_in_range(object_size_in_bytes)) {
149     try_allocate(obj, obj_end, tmp2, tmp3, object_size_in_bytes, slow_case);
150   } else {
151     // Rtemp should be free at c1 LIR level
152     mov_slow(Rtemp, object_size_in_bytes);
153     try_allocate(obj, obj_end, tmp2, tmp3, Rtemp, slow_case);
154   }
155   initialize_object(obj, obj_end, klass, len, tmp2, tmp3, instanceOopDesc::header_size() * HeapWordSize, object_size_in_bytes, /* is_tlab_allocated */ UseTLAB);
156 }
157 
158 void C1_MacroAssembler::allocate_array(Register obj, Register len,
159                                        Register tmp1, Register tmp2, Register tmp3,
160                                        int header_size_in_bytes, int element_size,
161                                        Register klass, Label& slow_case) {
162   assert_different_registers(obj, len, tmp1, tmp2, tmp3, klass, Rtemp);

163   const int scale_shift = exact_log2(element_size);
164   const Register obj_size = Rtemp; // Rtemp should be free at c1 LIR level
165 
166   cmp_32(len, max_array_allocation_length);
167   b(slow_case, hs);
168 
169   bool align_header = ((header_size_in_bytes | element_size) & MinObjAlignmentInBytesMask) != 0;
170   assert(align_header || ((header_size_in_bytes & MinObjAlignmentInBytesMask) == 0), "must be");
171   assert(align_header || ((element_size & MinObjAlignmentInBytesMask) == 0), "must be");
172 
173   mov(obj_size, header_size_in_bytes + (align_header ? (MinObjAlignmentInBytes - 1) : 0));
174   add_ptr_scaled_int32(obj_size, obj_size, len, scale_shift);
175 
176   if (align_header) {
177     align_reg(obj_size, obj_size, MinObjAlignmentInBytes);
178   }
179 
180   try_allocate(obj, tmp1, tmp2, tmp3, obj_size, slow_case);
181   initialize_object(obj, tmp1, klass, len, tmp2, tmp3, header_size_in_bytes, -1, /* is_tlab_allocated */ UseTLAB);
182 }
< prev index next >