859 if (factor > 0) { |
859 if (factor > 0) { |
860 size -= size/factor; |
860 size -= size/factor; |
861 } |
861 } |
862 size = align_object_size(size); |
862 size = align_object_size(size); |
863 |
863 |
864 const size_t min_int_array_size = typeArrayOopDesc::header_size(T_INT); |
864 const size_t array_header_size = typeArrayOopDesc::header_size(T_INT); |
865 if (size >= min_int_array_size) { |
865 if (size >= (size_t)align_object_size(array_header_size)) { |
866 size_t length = (size - min_int_array_size) * (HeapWordSize / sizeof(jint)); |
866 size_t length = (size - array_header_size) * (HeapWordSize / sizeof(jint)); |
867 // allocate uninitialized int array |
867 // allocate uninitialized int array |
868 typeArrayOop t = (typeArrayOop) allocate(size); |
868 typeArrayOop t = (typeArrayOop) allocate(size); |
869 assert(t != NULL, "allocation should succeed"); |
869 assert(t != NULL, "allocation should succeed"); |
870 t->set_mark(markOopDesc::prototype()); |
870 t->set_mark(markOopDesc::prototype()); |
871 t->set_klass(Universe::intArrayKlassObj()); |
871 t->set_klass(Universe::intArrayKlassObj()); |
872 t->set_length((int)length); |
872 t->set_length((int)length); |
873 } else { |
873 } else { |
874 assert((int) size == instanceOopDesc::header_size(), |
874 assert(size == CollectedHeap::min_fill_size(), |
875 "size for smallest fake object doesn't match"); |
875 "size for smallest fake object doesn't match"); |
876 instanceOop obj = (instanceOop) allocate(size); |
876 instanceOop obj = (instanceOop) allocate(size); |
877 obj->set_mark(markOopDesc::prototype()); |
877 obj->set_mark(markOopDesc::prototype()); |
878 obj->set_klass_gap(0); |
878 obj->set_klass_gap(0); |
879 obj->set_klass(SystemDictionary::Object_klass()); |
879 obj->set_klass(SystemDictionary::Object_klass()); |