Mercurial > hg > truffle
comparison src/share/vm/graal/graalCompiler.cpp @ 3653:6aef50c6d967
Handlize to fix GC issue.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Thu, 17 Nov 2011 00:01:56 +0100 |
parents | a31028282e3e |
children | 221133c5ed6c |
comparison
equal
deleted
inserted
replaced
3652:aac12c75f805 | 3653:6aef50c6d967 |
---|---|
137 // Print compilation timers and statistics | 137 // Print compilation timers and statistics |
138 void GraalCompiler::print_timers() { | 138 void GraalCompiler::print_timers() { |
139 TRACE_graal_1("GraalCompiler::print_timers"); | 139 TRACE_graal_1("GraalCompiler::print_timers"); |
140 } | 140 } |
141 | 141 |
142 oop GraalCompiler::get_RiType(Symbol* klass_name, TRAPS) { | 142 Handle GraalCompiler::get_RiType(Symbol* klass_name, TRAPS) { |
143 return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(klass_name, THREAD), THREAD); | 143 return VMExits::createRiTypeUnresolved(VmIds::toString<Handle>(klass_name, THREAD), THREAD); |
144 } | 144 } |
145 | 145 |
146 oop GraalCompiler::get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { | 146 Handle GraalCompiler::get_RiTypeFromSignature(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { |
147 | 147 |
148 Symbol* signature = cp->symbol_at(index); | 148 Symbol* signature = cp->symbol_at(index); |
149 BasicType field_type = FieldType::basic_type(signature); | 149 BasicType field_type = FieldType::basic_type(signature); |
150 // If the field is a pointer type, get the klass of the | 150 // If the field is a pointer type, get the klass of the |
151 // field. | 151 // field. |
159 } else { | 159 } else { |
160 return VMExits::createRiTypePrimitive(field_type, CHECK_NULL); | 160 return VMExits::createRiTypePrimitive(field_type, CHECK_NULL); |
161 } | 161 } |
162 } | 162 } |
163 | 163 |
164 oop GraalCompiler::get_RiType(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { | 164 Handle GraalCompiler::get_RiType(constantPoolHandle cp, int index, KlassHandle loading_klass, TRAPS) { |
165 bool is_accessible = false; | 165 bool is_accessible = false; |
166 | 166 |
167 KlassHandle klass = GraalEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); | 167 KlassHandle klass = GraalEnv::get_klass_by_index(cp, index, is_accessible, loading_klass); |
168 oop catch_class = NULL; | 168 oop catch_class = NULL; |
169 if (klass.is_null()) { | 169 if (klass.is_null()) { |
187 } else { | 187 } else { |
188 return GraalCompiler::get_RiType(klass, CHECK_NULL); | 188 return GraalCompiler::get_RiType(klass, CHECK_NULL); |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
192 oop GraalCompiler::get_RiType(KlassHandle klass, TRAPS) { | 192 Handle GraalCompiler::get_RiType(KlassHandle klass, TRAPS) { |
193 Handle name = VmIds::toString<Handle>(klass->name(), THREAD); | 193 Handle name = VmIds::toString<Handle>(klass->name(), THREAD); |
194 return createHotSpotTypeResolved(klass, name, CHECK_NULL); | 194 return createHotSpotTypeResolved(klass, name, CHECK_NULL); |
195 } | 195 } |
196 | 196 |
197 oop GraalCompiler::get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS) { | 197 Handle GraalCompiler::get_RiField(int offset, int flags, Symbol* field_name, Handle field_holder, Handle field_type, Bytecodes::Code byteCode, TRAPS) { |
198 Handle name = VmIds::toString<Handle>(field_name, CHECK_NULL); | 198 Handle name = VmIds::toString<Handle>(field_name, CHECK_NULL); |
199 return VMExits::createRiField(field_holder, name, field_type, offset, flags, CHECK_NULL); | 199 return VMExits::createRiField(field_holder, name, field_type, offset, flags, CHECK_NULL); |
200 } | 200 } |
201 | 201 |
202 oop GraalCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) { | 202 Handle GraalCompiler::createHotSpotTypeResolved(KlassHandle klass, Handle name, TRAPS) { |
203 if (klass->graal_mirror() != NULL) { | 203 if (klass->graal_mirror() != NULL) { |
204 return klass->graal_mirror(); | 204 return klass->graal_mirror(); |
205 } | 205 } |
206 | 206 |
207 instanceKlass::cast(HotSpotTypeResolved::klass())->initialize(CHECK_NULL); | 207 instanceKlass::cast(HotSpotTypeResolved::klass())->initialize(CHECK_NULL); |
237 HotSpotTypeResolved::set_hasSubclass(obj, false); | 237 HotSpotTypeResolved::set_hasSubclass(obj, false); |
238 HotSpotTypeResolved::set_hasFinalizableSubclass(obj, false); | 238 HotSpotTypeResolved::set_hasFinalizableSubclass(obj, false); |
239 | 239 |
240 klass->set_graal_mirror(obj()); | 240 klass->set_graal_mirror(obj()); |
241 | 241 |
242 return obj(); | 242 return obj; |
243 } | 243 } |
244 | 244 |
245 oop GraalCompiler::createHotSpotMethodResolved(methodHandle method, TRAPS) { | 245 Handle GraalCompiler::createHotSpotMethodResolved(methodHandle method, TRAPS) { |
246 if (method->graal_mirror() != NULL) { | 246 if (method->graal_mirror() != NULL) { |
247 assert(method->graal_mirror()->is_a(HotSpotMethodResolved::klass()), "unexpected class..."); | 247 assert(method->graal_mirror()->is_a(HotSpotMethodResolved::klass()), "unexpected class..."); |
248 return method->graal_mirror(); | 248 return method->graal_mirror(); |
249 } | 249 } |
250 | 250 |
260 HotSpotMethodResolved::set_javaMirror(obj, method()); | 260 HotSpotMethodResolved::set_javaMirror(obj, method()); |
261 HotSpotMethodResolved::set_name(obj, name()); | 261 HotSpotMethodResolved::set_name(obj, name()); |
262 | 262 |
263 KlassHandle klass = method->method_holder(); | 263 KlassHandle klass = method->method_holder(); |
264 Handle holder_name = VmIds::toString<Handle>(klass->name(), CHECK_NULL); | 264 Handle holder_name = VmIds::toString<Handle>(klass->name(), CHECK_NULL); |
265 oop holder = GraalCompiler::createHotSpotTypeResolved(klass, holder_name, CHECK_NULL); | 265 Handle holder = GraalCompiler::createHotSpotTypeResolved(klass, holder_name, CHECK_NULL); |
266 HotSpotMethodResolved::set_holder(obj, holder); | 266 HotSpotMethodResolved::set_holder(obj, holder()); |
267 | 267 |
268 HotSpotMethodResolved::set_codeSize(obj, method->code_size()); | 268 HotSpotMethodResolved::set_codeSize(obj, method->code_size()); |
269 HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int()); | 269 HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int()); |
270 HotSpotMethodResolved::set_maxLocals(obj, method->max_locals()); | 270 HotSpotMethodResolved::set_maxLocals(obj, method->max_locals()); |
271 HotSpotMethodResolved::set_maxStackSize(obj, method->max_stack()); | 271 HotSpotMethodResolved::set_maxStackSize(obj, method->max_stack()); |