Mercurial > hg > graal-compiler
diff 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 |
line wrap: on
line diff
--- a/src/share/vm/graal/graalCompiler.cpp Thu Jun 16 12:09:54 2011 +0200 +++ b/src/share/vm/graal/graalCompiler.cpp Thu Jun 16 20:36:17 2011 +0200 @@ -111,7 +111,9 @@ CompilerThread::current()->set_compiling(true); methodOop method = (methodOop) target->get_oop(); - VMExits::compileMethod(VmIds::add<methodOop>(method), VmIds::toString<Handle>(method->name(), THREAD), entry_bci); + Handle name = VmIds::toString<Handle>(method->name(), CHECK); + Handle hotspot_method = GraalCompiler::createHotSpotMethodResolved(method, name, CHECK); + VMExits::compileMethod(hotspot_method, entry_bci); CompilerThread::current()->set_compiling(false); VmIds::cleanupLocalObjects(); @@ -182,7 +184,6 @@ } else { HotSpotTypeResolved::set_isArrayClass(obj, false); HotSpotTypeResolved::set_componentType(obj, NULL); - HotSpotTypeResolved::set_isInitialized(obj, instanceKlass::cast(klass())->is_initialized()); HotSpotTypeResolved::set_instanceSize(obj, instanceKlass::cast(klass())->size_helper() * HeapWordSize); HotSpotTypeResolved::set_hasFinalizer(obj, klass->has_finalizer()); } @@ -196,6 +197,36 @@ return obj(); } +oop GraalCompiler::createHotSpotMethodResolved(methodHandle method, Handle name, TRAPS) { + if (method->graal_mirror() != NULL) { + assert(method->graal_mirror()->is_a(HotSpotMethodResolved::klass()), "unexpected class..."); + return method->graal_mirror(); + } + + instanceKlass::cast(HotSpotMethodResolved::klass())->initialize(CHECK_NULL); + Handle obj = instanceKlass::cast(HotSpotMethodResolved::klass())->allocate_instance(CHECK_NULL); + assert(obj() != NULL, "must succeed in allocating instance"); + + HotSpotMethodResolved::set_compiler(obj, VMExits::compilerInstance()()); + oop reflected = getReflectedMethod(method(), CHECK_NULL); + HotSpotMethodResolved::set_javaMirror(obj, reflected); + HotSpotMethodResolved::set_name(obj, name()); + + KlassHandle klass = method->method_holder(); + Handle holder_name = VmIds::toString<Handle>(klass->name(), CHECK_NULL); + oop holder = GraalCompiler::createHotSpotTypeResolved(klass, holder_name, CHECK_NULL); + HotSpotMethodResolved::set_holder(obj, holder); + + HotSpotMethodResolved::set_codeSize(obj, method->code_size()); + HotSpotMethodResolved::set_accessFlags(obj, method->access_flags().as_int()); + HotSpotMethodResolved::set_maxLocals(obj, method->max_locals()); + HotSpotMethodResolved::set_maxStackSize(obj, method->max_stack()); + HotSpotMethodResolved::set_invocationCount(obj, method->invocation_count()); + + method->set_graal_mirror(obj()); + return obj(); +} + BasicType GraalCompiler::kindToBasicType(jchar ch) { switch(ch) { case 'z': return T_BOOLEAN;