Mercurial > hg > icedtea7
changeset 1906:3d97a22bbdab
2009-06-19 Gary Benson <gbenson@redhat.com>
* ports/hotspot/src/share/vm/shark/sharkCompiler.hpp
(SharkCompiler::compile): Removed.
* ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
(SharkCompiler::compile_method): Moved all non-IR-emission
code from SharkFunction::initialize, and the IR-to-native
code from SharkCompiler::compile, here. Also changed all
debug options that take a method name to use fnmatch.
(SharkCompiler::compile): Removed.
* ports/hotspot/src/share/vm/shark/sharkFunction.hpp
(SharkFunction::_name): Removed.
(SharkFunction::_name): Likewise.
(SharkFunction::initialize): Receive name in argument.
(SharkFunction::SharkFunction): Updated.
(SharkFunction::build): New method.
* ports/hotspot/src/share/vm/shark/sharkFunction.cpp
(SharkFunction::initialize): Receive name in argument,
and moved all code not relating to emitting the function's
IR to SharkCompiler::compile_method.
* ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
(SharkBuilder::CreateFunction): Removed.
* ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
(SharkBuilder::CreateFunction): Likewise.
* ports/hotspot/src/share/vm/shark/sharkInvariants.hpp
(SharkCompileInvariants::memory_manager): Removed.
author | Gary Benson <gbenson@redhat.com> |
---|---|
date | Fri, 19 Jun 2009 06:03:31 -0400 |
parents | 6690b58a6c66 |
children | d8dac70fb1fa |
files | ChangeLog ports/hotspot/src/share/vm/shark/sharkBuilder.cpp ports/hotspot/src/share/vm/shark/sharkBuilder.hpp ports/hotspot/src/share/vm/shark/sharkCompiler.cpp ports/hotspot/src/share/vm/shark/sharkCompiler.hpp ports/hotspot/src/share/vm/shark/sharkFunction.cpp ports/hotspot/src/share/vm/shark/sharkFunction.hpp ports/hotspot/src/share/vm/shark/sharkInvariants.hpp |
diffstat | 8 files changed, 88 insertions(+), 85 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Fri Jun 19 03:59:26 2009 -0400 +++ b/ChangeLog Fri Jun 19 06:03:31 2009 -0400 @@ -1,3 +1,33 @@ +2009-06-19 Gary Benson <gbenson@redhat.com> + + * ports/hotspot/src/share/vm/shark/sharkCompiler.hpp + (SharkCompiler::compile): Removed. + * ports/hotspot/src/share/vm/shark/sharkCompiler.cpp + (SharkCompiler::compile_method): Moved all non-IR-emission + code from SharkFunction::initialize, and the IR-to-native + code from SharkCompiler::compile, here. Also changed all + debug options that take a method name to use fnmatch. + (SharkCompiler::compile): Removed. + + * ports/hotspot/src/share/vm/shark/sharkFunction.hpp + (SharkFunction::_name): Removed. + (SharkFunction::_name): Likewise. + (SharkFunction::initialize): Receive name in argument. + (SharkFunction::SharkFunction): Updated. + (SharkFunction::build): New method. + * ports/hotspot/src/share/vm/shark/sharkFunction.cpp + (SharkFunction::initialize): Receive name in argument, + and moved all code not relating to emitting the function's + IR to SharkCompiler::compile_method. + + * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp + (SharkBuilder::CreateFunction): Removed. + * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp + (SharkBuilder::CreateFunction): Likewise. + + * ports/hotspot/src/share/vm/shark/sharkInvariants.hpp + (SharkCompileInvariants::memory_manager): Removed. + 2009-06-19 Gary Benson <gbenson@redhat.com> * ports/hotspot/src/share/vm/shark/sharkEntry.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp Fri Jun 19 06:03:31 2009 -0400 @@ -176,16 +176,6 @@ set_llvm_pow_fn(module()->getOrInsertFunction("llvm.pow.f64", type)); } -Function *SharkBuilder::CreateFunction(const char *name) -{ - Function *function = Function::Create( - SharkType::entry_point_type(), - GlobalVariable::InternalLinkage, - name); - module()->getFunctionList().push_back(function); - return function; -} - CallInst* SharkBuilder::CreateDump(llvm::Value* value) { Constant *const_name;
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp Fri Jun 19 06:03:31 2009 -0400 @@ -46,10 +46,6 @@ return compiler()->execution_engine(); } - // Function creation - public: - llvm::Function *CreateFunction(const char *name = "func"); - // Helpers for creating basic blocks // NB don't use unless SharkFunction::CreateBlock is unavailable public:
--- a/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp Fri Jun 19 06:03:31 2009 -0400 @@ -91,7 +91,7 @@ #endif // !PRODUCT if (SharkOnlyCompile != NULL) { - if (strcmp(SharkOnlyCompile, name)) { + if (fnmatch(SharkOnlyCompile, name, 0)) { env->record_method_not_compilable("does not match SharkOnlyCompile"); return; } @@ -102,8 +102,7 @@ if (env->failing()) return; if (SharkPrintTypeflowOf != NULL) { - if (!strcmp(SharkPrintTypeflowOf, name) || - !strcmp(SharkPrintTypeflowOf, "*")) + if (!fnmatch(SharkPrintTypeflowOf, name, 0)) flow->print_on(tty); } @@ -119,12 +118,46 @@ SharkCodeBuffer cb(env->oop_recorder()); builder()->set_code_buffer(&cb); - // Compile the method - SharkFunction function(this, env, flow, name); + // Emit the entry point + SharkEntry *entry = (SharkEntry *) cb.malloc(sizeof(SharkEntry)); + + // Build the LLVM IR for the method + Function *function = SharkFunction::build(this, env, flow, name); + if (SharkPrintBitcodeOf != NULL) { + if (!fnmatch(SharkPrintBitcodeOf, name, 0)) + function->dump(); + } // Unhook the code buffer builder()->set_code_buffer(NULL); + // Compile to native code +#ifndef PRODUCT +#ifdef X86 + if (SharkPrintAsmOf != NULL) { + std::vector<const char*> args; + args.push_back(""); // program name + if (!fnmatch(SharkPrintAsmOf, name, 0)) + args.push_back("-debug-only=x86-emitter"); + else + args.push_back("-debug-only=none"); + args.push_back(0); // terminator + cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]); + } +#endif // X86 +#endif // !PRODUCT + memory_manager()->set_entry_for_function(function, entry); + module()->getFunctionList().push_back(function); + entry->set_entry_point( + (ZeroEntry::method_entry_t) + execution_engine()->getPointerToFunction(function)); + + // Register generated code for profiling, etc + if (JvmtiExport::should_post_dynamic_code_generated()) { + JvmtiExport::post_dynamic_code_generated( + name, entry->code_start(), entry->code_limit()); + } + // Install the method into the VM CodeOffsets offsets; offsets.set_value(CodeOffsets::Deopt, 0); @@ -148,31 +181,10 @@ env->comp_level(), false, false); -} - -ZeroEntry::method_entry_t SharkCompiler::compile(const char* name, - Function* function) -{ - // Dump the generated code, if requested -#ifndef PRODUCT -#ifdef X86 - if (SharkPrintAsmOf != NULL) { - std::vector<const char*> args; - args.push_back(""); // program name - if (!fnmatch(SharkPrintAsmOf, name, 0)) - args.push_back("-debug-only=x86-emitter"); - else - args.push_back("-debug-only=none"); - args.push_back(0); // terminator - cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]); - } -#endif // X86 -#endif // !PRODUCT - - // Compile to native code - return (ZeroEntry::method_entry_t) - execution_engine()->getPointerToFunction(function); + // Print statistics, if requested + if (SharkTraceInstalls) + entry->print_statistics(name); } const char* SharkCompiler::methodname(const ciMethod* target)
--- a/ports/hotspot/src/share/vm/shark/sharkCompiler.hpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkCompiler.hpp Fri Jun 19 06:03:31 2009 -0400 @@ -72,9 +72,6 @@ return _execution_engine; } - public: - ZeroEntry::method_entry_t compile(const char* name, llvm::Function* func); - // Helper private: static const char* methodname(const ciMethod* target);
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp Fri Jun 19 06:03:31 2009 -0400 @@ -26,19 +26,15 @@ #include "incls/_precompiled.incl" #include "incls/_sharkFunction.cpp.incl" -#include <fnmatch.h> - using namespace llvm; -void SharkFunction::initialize() +void SharkFunction::initialize(const char *name) { - // Emit the entry point - SharkEntry *entry = - (SharkEntry *) builder()->code_buffer()->malloc(sizeof(SharkEntry)); - // Create the function - _function = builder()->CreateFunction(name()); - memory_manager()->set_entry_for_function(function(), entry); + _function = Function::Create( + SharkType::entry_point_type(), + GlobalVariable::InternalLinkage, + name); // Get our arguments Function::arg_iterator ai = function()->arg_begin(); @@ -118,25 +114,6 @@ block(i)->emit_IR(); } do_deferred_zero_checks(); - - // Dump the bitcode, if requested - if (SharkPrintBitcodeOf != NULL) { - if (!fnmatch(SharkPrintBitcodeOf, name(), 0)) - function()->dump(); - } - - // Compile to native code - entry->set_entry_point(compiler()->compile(name(), function())); - - // Register generated code for profiling, etc - if (JvmtiExport::should_post_dynamic_code_generated()) { - JvmtiExport::post_dynamic_code_generated( - name(), entry->code_start(), entry->code_limit()); - } - - // Print statistics, if requested - if (SharkTraceInstalls) - entry->print_statistics(name()); } void SharkFunction::CreateInitZeroStack()
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.hpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkFunction.hpp Fri Jun 19 06:03:31 2009 -0400 @@ -28,26 +28,31 @@ class SharkFunction : public SharkTargetInvariants { public: + static llvm::Function* build(SharkCompiler* compiler, + ciEnv* env, + ciTypeFlow* flow, + const char* name) + { + SharkFunction function(compiler, env, flow, name); + return function.function(); + } + + private: SharkFunction(SharkCompiler* compiler, ciEnv* env, ciTypeFlow* flow, const char* name) - : SharkTargetInvariants(compiler, env, flow), _name(name) { initialize(); } + : SharkTargetInvariants(compiler, env, flow) { initialize(name); } private: - void initialize(); + void initialize(const char* name); private: - const char* _name; llvm::Function* _function; SharkTopLevelBlock** _blocks; GrowableArray<DeferredZeroCheck*> _deferred_zero_checks; public: - const char* name() const - { - return _name; - } llvm::Function* function() const { return _function;
--- a/ports/hotspot/src/share/vm/shark/sharkInvariants.hpp Fri Jun 19 03:59:26 2009 -0400 +++ b/ports/hotspot/src/share/vm/shark/sharkInvariants.hpp Fri Jun 19 06:03:31 2009 -0400 @@ -93,10 +93,6 @@ { return compiler()->builder(); } - SharkMemoryManager* memory_manager() const - { - return compiler()->memory_manager(); - } DebugInformationRecorder* debug_info() const { return env()->debug_info();