changeset in /hg/icedtea6: 2009-06-19 Gary Benson <gbenson at red...

Gary Benson gbenson at redhat.com
Fri Jun 19 03:05:48 PDT 2009


changeset 2bd8742661b3 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=2bd8742661b3
description:
	2009-06-19  Gary Benson  <gbenson at 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.

diffstat:

8 files changed, 94 insertions(+), 91 deletions(-)
ChangeLog                                            |   30 +++++++
ports/hotspot/src/share/vm/shark/sharkBuilder.cpp    |   10 --
ports/hotspot/src/share/vm/shark/sharkBuilder.hpp    |    4 -
ports/hotspot/src/share/vm/shark/sharkCompiler.cpp   |   72 ++++++++++--------
ports/hotspot/src/share/vm/shark/sharkCompiler.hpp   |    3 
ports/hotspot/src/share/vm/shark/sharkFunction.cpp   |   35 +-------
ports/hotspot/src/share/vm/shark/sharkFunction.hpp   |   27 ++++--
ports/hotspot/src/share/vm/shark/sharkInvariants.hpp |    4 -

diffs (306 lines):

diff -r 94d99ead66a4 -r 2bd8742661b3 ChangeLog
--- 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 at redhat
+2009-06-19  Gary Benson  <gbenson at 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 at redhat.com>
 
 	* ports/hotspot/src/share/vm/shark/sharkEntry.hpp
diff -r 94d99ead66a4 -r 2bd8742661b3 ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
--- 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 @@ void SharkBuilder::init_external_functio
   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;
diff -r 94d99ead66a4 -r 2bd8742661b3 ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
--- 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
@@ -45,10 +45,6 @@ class SharkBuilder : public llvm::IRBuil
   {
     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
diff -r 94d99ead66a4 -r 2bd8742661b3 ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
--- 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 @@ void SharkCompiler::compile_method(ciEnv
 #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 @@ void SharkCompiler::compile_method(ciEnv
   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 @@ void SharkCompiler::compile_method(ciEnv
   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 @@ void SharkCompiler::compile_method(ciEnv
                        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)
diff -r 94d99ead66a4 -r 2bd8742661b3 ports/hotspot/src/share/vm/shark/sharkCompiler.hpp
--- 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 @@ class SharkCompiler : public AbstractCom
     return _execution_engine;
   }
 
- public:
-  ZeroEntry::method_entry_t compile(const char* name, llvm::Function* func);
-
   // Helper
  private:
   static const char* methodname(const ciMethod* target);
diff -r 94d99ead66a4 -r 2bd8742661b3 ports/hotspot/src/share/vm/shark/sharkFunction.cpp
--- 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()
-{
-  // Emit the entry point
-  SharkEntry *entry =
-    (SharkEntry *) builder()->code_buffer()->malloc(sizeof(SharkEntry));
-
+void SharkFunction::initialize(const char *name)
+{
   // 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 @@ void SharkFunction::initialize()
     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()
diff -r 94d99ead66a4 -r 2bd8742661b3 ports/hotspot/src/share/vm/shark/sharkFunction.hpp
--- 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 DeferredZeroCheck;
 
 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(); }
-
- private:
-  void initialize();
-
- private:
-  const char*                       _name;
+    : SharkTargetInvariants(compiler, env, flow) { initialize(name); }
+
+ private:
+  void initialize(const char* name);
+
+ private:
   llvm::Function*                   _function;
   SharkTopLevelBlock**              _blocks;
   GrowableArray<DeferredZeroCheck*> _deferred_zero_checks;
 
  public:
-  const char* name() const
-  {
-    return _name;
-  }  
   llvm::Function* function() const
   {
     return _function;
diff -r 94d99ead66a4 -r 2bd8742661b3 ports/hotspot/src/share/vm/shark/sharkInvariants.hpp
--- 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 @@ class SharkCompileInvariants : public Re
   {
     return compiler()->builder();
   }
-  SharkMemoryManager* memory_manager() const
-  {
-    return compiler()->memory_manager();
-  }  
   DebugInformationRecorder* debug_info() const
   {
     return env()->debug_info();



More information about the distro-pkg-dev mailing list