Mercurial > hg > graal-jvmci-8
comparison src/share/vm/graal/graalCompiler.cpp @ 3011:f00918f35c7f
inlining and runtime interface related changes:
added codeSize() and compilerStorage() to RiMethod
HotSpotMethodResolved uses reflective methods instead of vmIds and survives compilations
HotSpotResolvedType.isInitialized not represented as field (can change)
inlining stores graphs into method objects and reuses them
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Thu, 16 Jun 2011 20:36:17 +0200 |
parents | b78b4ae0757c |
children | 9fed07e4a375 |
comparison
equal
deleted
inserted
replaced
2993:3671e31615c9 | 3011:f00918f35c7f |
---|---|
109 | 109 |
110 TRACE_graal_2("GraalCompiler::compile_method"); | 110 TRACE_graal_2("GraalCompiler::compile_method"); |
111 | 111 |
112 CompilerThread::current()->set_compiling(true); | 112 CompilerThread::current()->set_compiling(true); |
113 methodOop method = (methodOop) target->get_oop(); | 113 methodOop method = (methodOop) target->get_oop(); |
114 VMExits::compileMethod(VmIds::add<methodOop>(method), VmIds::toString<Handle>(method->name(), THREAD), entry_bci); | 114 Handle name = VmIds::toString<Handle>(method->name(), CHECK); |
115 Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, name, CHECK); | |
116 VMExits::compileMethod(hotspot_method, entry_bci); | |
115 CompilerThread::current()->set_compiling(false); | 117 CompilerThread::current()->set_compiling(false); |
116 | 118 |
117 VmIds::cleanupLocalObjects(); | 119 VmIds::cleanupLocalObjects(); |
118 TRACE_graal_2("GraalCompiler::compile_method exit"); | 120 TRACE_graal_2("GraalCompiler::compile_method exit"); |
119 } | 121 } |
180 HotSpotTypeResolved::set_isArrayClass(obj, true); | 182 HotSpotTypeResolved::set_isArrayClass(obj, true); |
181 HotSpotTypeResolved::set_componentType(obj, NULL); | 183 HotSpotTypeResolved::set_componentType(obj, NULL); |
182 } else { | 184 } else { |
183 HotSpotTypeResolved::set_isArrayClass(obj, false); | 185 HotSpotTypeResolved::set_isArrayClass(obj, false); |
184 HotSpotTypeResolved::set_componentType(obj, NULL); | 186 HotSpotTypeResolved::set_componentType(obj, NULL); |
185 HotSpotTypeResolved::set_isInitialized(obj, instanceKlass::cast(klass())->is_initialized()); | |
186 HotSpotTypeResolved::set_instanceSize(obj, instanceKlass::cast(klass())->size_helper() * HeapWordSize); | 187 HotSpotTypeResolved::set_instanceSize(obj, instanceKlass::cast(klass())->size_helper() * HeapWordSize); |
187 HotSpotTypeResolved::set_hasFinalizer(obj, klass->has_finalizer()); | 188 HotSpotTypeResolved::set_hasFinalizer(obj, klass->has_finalizer()); |
188 } | 189 } |
189 | 190 |
190 // TODO replace these with correct values | 191 // TODO replace these with correct values |
191 HotSpotTypeResolved::set_hasSubclass(obj, false); | 192 HotSpotTypeResolved::set_hasSubclass(obj, false); |
192 HotSpotTypeResolved::set_hasFinalizableSubclass(obj, false); | 193 HotSpotTypeResolved::set_hasFinalizableSubclass(obj, false); |
193 | 194 |
194 klass->set_graal_mirror(obj()); | 195 klass->set_graal_mirror(obj()); |
195 | 196 |
197 return obj(); | |
198 } | |
199 | |
200 oop GraalCompiler::createHotSpotMethodResolved(methodHandle method, Handle name, TRAPS) { | |
201 if (method->graal_mirror() != NULL) { | |
202 assert(method->graal_mirror()->is_a(HotSpotMethodResolved::klass()), "unexpected class..."); | |
203 return method->graal_mirror(); | |
204 } | |
205 | |
206 instanceKlass::cast(HotSpotMethodResolved::klass())->initialize(CHECK_NULL); | |
207 Handle obj = instanceKlass::cast(HotSpotMethodResolved::klass())->allocate_instance(CHECK_NULL); | |
208 assert(obj() != NULL, "must succeed in allocating instance"); | |
209 | |
210 HotSpotMethodResolved::set_compiler(obj, VMExits::compilerInstance()()); | |
211 oop reflected = getReflectedMethod(method(), CHECK_NULL); | |
212 HotSpotMethodResolved::set_javaMirror(obj, reflected); | |
213 HotSpotMethodResolved::set_name(obj, name()); | |
214 | |
215 KlassHandle klass = method->method_holder(); | |
216 Handle holder_name = VmIds::toString<Handle>(klass->name(), CHECK_NULL); | |
217 oop holder = GraalCompiler::createHotSpotTypeResolved(klass, holder_name, CHECK_NULL); | |
218 HotSpotMethodResolved::set_holder(obj, holder); | |
219 | |
220 HotSpotMethodResolved::set_codeSize(obj, method->code_size()); | |
221 HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int()); | |
222 HotSpotMethodResolved::set_maxLocals(obj, method->max_locals()); | |
223 HotSpotMethodResolved::set_maxStackSize(obj, method->max_stack()); | |
224 HotSpotMethodResolved::set_invocationCount(obj, method->invocation_count()); | |
225 | |
226 method->set_graal_mirror(obj()); | |
196 return obj(); | 227 return obj(); |
197 } | 228 } |
198 | 229 |
199 BasicType GraalCompiler::kindToBasicType(jchar ch) { | 230 BasicType GraalCompiler::kindToBasicType(jchar ch) { |
200 switch(ch) { | 231 switch(ch) { |