1.1 --- a/src/share/vm/memory/oopFactory.cpp Fri Aug 31 16:39:35 2012 -0700 1.2 +++ b/src/share/vm/memory/oopFactory.cpp Sat Sep 01 13:25:18 2012 -0400 1.3 @@ -31,17 +31,8 @@ 1.4 #include "memory/oopFactory.hpp" 1.5 #include "memory/resourceArea.hpp" 1.6 #include "memory/universe.inline.hpp" 1.7 -#include "oops/compiledICHolderKlass.hpp" 1.8 -#include "oops/constMethodKlass.hpp" 1.9 -#include "oops/constantPoolKlass.hpp" 1.10 -#include "oops/cpCacheKlass.hpp" 1.11 #include "oops/instanceKlass.hpp" 1.12 -#include "oops/instanceKlassKlass.hpp" 1.13 #include "oops/instanceOop.hpp" 1.14 -#include "oops/klassKlass.hpp" 1.15 -#include "oops/klassOop.hpp" 1.16 -#include "oops/methodDataKlass.hpp" 1.17 -#include "oops/methodKlass.hpp" 1.18 #include "oops/objArrayOop.hpp" 1.19 #include "oops/oop.inline.hpp" 1.20 1.21 @@ -55,135 +46,45 @@ 1.22 return result; 1.23 } 1.24 1.25 -typeArrayOop oopFactory::new_permanent_charArray(int length, TRAPS) { 1.26 - return typeArrayKlass::cast(Universe::charArrayKlassObj())->allocate_permanent(length, THREAD); 1.27 +typeArrayOop oopFactory::new_tenured_charArray(int length, TRAPS) { 1.28 + return typeArrayKlass::cast(Universe::charArrayKlassObj())->allocate(length, THREAD); 1.29 } 1.30 1.31 -typeArrayOop oopFactory::new_permanent_byteArray(int length, TRAPS) { 1.32 - return typeArrayKlass::cast(Universe::byteArrayKlassObj())->allocate_permanent(length, THREAD); 1.33 +typeArrayOop oopFactory::new_typeArray(BasicType type, int length, TRAPS) { 1.34 + Klass* type_asKlassOop = Universe::typeArrayKlassObj(type); 1.35 + typeArrayKlass* type_asArrayKlass = typeArrayKlass::cast(type_asKlassOop); 1.36 + typeArrayOop result = type_asArrayKlass->allocate(length, THREAD); 1.37 + return result; 1.38 } 1.39 1.40 - 1.41 -typeArrayOop oopFactory::new_permanent_shortArray(int length, TRAPS) { 1.42 - return typeArrayKlass::cast(Universe::shortArrayKlassObj())->allocate_permanent(length, THREAD); 1.43 -} 1.44 - 1.45 - 1.46 -typeArrayOop oopFactory::new_permanent_intArray(int length, TRAPS) { 1.47 - return typeArrayKlass::cast(Universe::intArrayKlassObj())->allocate_permanent(length, THREAD); 1.48 -} 1.49 - 1.50 - 1.51 -typeArrayOop oopFactory::new_typeArray(BasicType type, int length, TRAPS) { 1.52 - klassOop type_asKlassOop = Universe::typeArrayKlassObj(type); 1.53 +// Create a Java array that points to metadata. 1.54 +// As far as Java code is concerned, a metaData array is either an array of 1.55 +// int or long depending on pointer size. Only a few things use this, like 1.56 +// stack trace elements in Throwable. They cast Method* into this type. 1.57 +// Note:can't point to symbols because there's no way to unreference count 1.58 +// them when this object goes away. 1.59 +typeArrayOop oopFactory::new_metaDataArray(int length, TRAPS) { 1.60 + BasicType type = LP64_ONLY(T_LONG) NOT_LP64(T_INT); 1.61 + Klass* type_asKlassOop = Universe::typeArrayKlassObj(type); 1.62 typeArrayKlass* type_asArrayKlass = typeArrayKlass::cast(type_asKlassOop); 1.63 typeArrayOop result = type_asArrayKlass->allocate_common(length, true, THREAD); 1.64 return result; 1.65 } 1.66 1.67 typeArrayOop oopFactory::new_typeArray_nozero(BasicType type, int length, TRAPS) { 1.68 - klassOop type_asKlassOop = Universe::typeArrayKlassObj(type); 1.69 + Klass* type_asKlassOop = Universe::typeArrayKlassObj(type); 1.70 typeArrayKlass* type_asArrayKlass = typeArrayKlass::cast(type_asKlassOop); 1.71 typeArrayOop result = type_asArrayKlass->allocate_common(length, false, THREAD); 1.72 return result; 1.73 } 1.74 1.75 1.76 -objArrayOop oopFactory::new_objArray(klassOop klass, int length, TRAPS) { 1.77 +objArrayOop oopFactory::new_objArray(Klass* klass, int length, TRAPS) { 1.78 assert(klass->is_klass(), "must be instance class"); 1.79 - if (klass->klass_part()->oop_is_array()) { 1.80 - return ((arrayKlass*)klass->klass_part())->allocate_arrayArray(1, length, THREAD); 1.81 + if (klass->oop_is_array()) { 1.82 + return ((arrayKlass*)klass)->allocate_arrayArray(1, length, THREAD); 1.83 } else { 1.84 - assert (klass->klass_part()->oop_is_instance(), "new object array with klass not an instanceKlass"); 1.85 - return ((instanceKlass*)klass->klass_part())->allocate_objArray(1, length, THREAD); 1.86 + assert (klass->oop_is_instance(), "new object array with klass not an InstanceKlass"); 1.87 + return ((InstanceKlass*)klass)->allocate_objArray(1, length, THREAD); 1.88 } 1.89 } 1.90 - 1.91 -objArrayOop oopFactory::new_system_objArray(int length, TRAPS) { 1.92 - int size = objArrayOopDesc::object_size(length); 1.93 - KlassHandle klass (THREAD, Universe::systemObjArrayKlassObj()); 1.94 - objArrayOop o = (objArrayOop) 1.95 - Universe::heap()->permanent_array_allocate(klass, size, length, CHECK_NULL); 1.96 - // initialization not needed, allocated cleared 1.97 - return o; 1.98 -} 1.99 - 1.100 - 1.101 -constantPoolOop oopFactory::new_constantPool(int length, 1.102 - bool is_conc_safe, 1.103 - TRAPS) { 1.104 - constantPoolKlass* ck = constantPoolKlass::cast(Universe::constantPoolKlassObj()); 1.105 - return ck->allocate(length, is_conc_safe, CHECK_NULL); 1.106 -} 1.107 - 1.108 - 1.109 -constantPoolCacheOop oopFactory::new_constantPoolCache(int length, 1.110 - TRAPS) { 1.111 - constantPoolCacheKlass* ck = constantPoolCacheKlass::cast(Universe::constantPoolCacheKlassObj()); 1.112 - return ck->allocate(length, CHECK_NULL); 1.113 -} 1.114 - 1.115 - 1.116 -klassOop oopFactory::new_instanceKlass(Symbol* name, int vtable_len, int itable_len, 1.117 - int static_field_size, 1.118 - unsigned int nonstatic_oop_map_count, 1.119 - AccessFlags access_flags, 1.120 - ReferenceType rt, 1.121 - KlassHandle host_klass, TRAPS) { 1.122 - instanceKlassKlass* ikk = instanceKlassKlass::cast(Universe::instanceKlassKlassObj()); 1.123 - return ikk->allocate_instance_klass(name, vtable_len, itable_len, 1.124 - static_field_size, nonstatic_oop_map_count, 1.125 - access_flags, rt, host_klass, CHECK_NULL); 1.126 -} 1.127 - 1.128 - 1.129 -constMethodOop oopFactory::new_constMethod(int byte_code_size, 1.130 - int compressed_line_number_size, 1.131 - int localvariable_table_length, 1.132 - int exception_table_length, 1.133 - int checked_exceptions_length, 1.134 - bool is_conc_safe, 1.135 - TRAPS) { 1.136 - klassOop cmkObj = Universe::constMethodKlassObj(); 1.137 - constMethodKlass* cmk = constMethodKlass::cast(cmkObj); 1.138 - return cmk->allocate(byte_code_size, compressed_line_number_size, 1.139 - localvariable_table_length, exception_table_length, 1.140 - checked_exceptions_length, is_conc_safe, 1.141 - CHECK_NULL); 1.142 -} 1.143 - 1.144 - 1.145 -methodOop oopFactory::new_method(int byte_code_size, AccessFlags access_flags, 1.146 - int compressed_line_number_size, 1.147 - int localvariable_table_length, 1.148 - int exception_table_length, 1.149 - int checked_exceptions_length, 1.150 - bool is_conc_safe, 1.151 - TRAPS) { 1.152 - methodKlass* mk = methodKlass::cast(Universe::methodKlassObj()); 1.153 - assert(!access_flags.is_native() || byte_code_size == 0, 1.154 - "native methods should not contain byte codes"); 1.155 - constMethodOop cm = new_constMethod(byte_code_size, 1.156 - compressed_line_number_size, 1.157 - localvariable_table_length, 1.158 - exception_table_length, 1.159 - checked_exceptions_length, 1.160 - is_conc_safe, CHECK_NULL); 1.161 - constMethodHandle rw(THREAD, cm); 1.162 - return mk->allocate(rw, access_flags, CHECK_NULL); 1.163 -} 1.164 - 1.165 - 1.166 -methodDataOop oopFactory::new_methodData(methodHandle method, TRAPS) { 1.167 - methodDataKlass* mdk = methodDataKlass::cast(Universe::methodDataKlassObj()); 1.168 - return mdk->allocate(method, CHECK_NULL); 1.169 -} 1.170 - 1.171 - 1.172 -compiledICHolderOop oopFactory::new_compiledICHolder(methodHandle method, KlassHandle klass, TRAPS) { 1.173 - compiledICHolderKlass* ck = (compiledICHolderKlass*) Universe::compiledICHolderKlassObj()->klass_part(); 1.174 - compiledICHolderOop c = ck->allocate(CHECK_NULL); 1.175 - c->set_holder_method(method()); 1.176 - c->set_holder_klass(klass()); 1.177 - return c; 1.178 -}