changeset 1689:5bb8386e5bc2

2009-02-26 Andrew Haley <aph@redhat.com> * patches/openjdk/hotspot/src/share/vm/prims/jvmtiEnv.cpp: New file. * Makefile.am (ICEDTEA_PATCHES): Add icedtea-jvmtiEnv.patch. * ports/hotspot/src/share/vm/shark/sharkFunction.cpp (SharkFunction::initialize): Use real name, not "func". Pass "none" to "-debug-only=". Register generated code for profiling, etc. * ports/hotspot/src/share/vm/shark/sharkEntry.hpp (class SharkEntry): Remove #ifndef PRODUCT. * ports/hotspot/src/share/vm/shark/sharkBuilder.hpp (SharkBuilder::CreateFunction): Use real name, not "func". * ports/hotspot/src/share/vm/shark/sharkBuilder.cpp (SharkBuilder::CreateFunction): Use real name, not "func". (MyJITMemoryManager::endFunctionBody): Remove #ifndef PRODUCT.
author Andrew Haley <aph@redhat.com>
date Thu, 26 Feb 2009 18:49:20 +0000
parents 39e3afb50b61
children ecbd78fe74dc
files Makefile.am patches/icedtea-jvmtiEnv.patch ports/hotspot/src/share/vm/shark/sharkBuilder.cpp ports/hotspot/src/share/vm/shark/sharkBuilder.hpp ports/hotspot/src/share/vm/shark/sharkEntry.hpp ports/hotspot/src/share/vm/shark/sharkFunction.cpp
diffstat 6 files changed, 28 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Thu Feb 26 18:48:53 2009 +0000
+++ b/Makefile.am	Thu Feb 26 18:49:20 2009 +0000
@@ -541,7 +541,8 @@
 	patches/icedtea-sunsrc.patch \
 	patches/icedtea-libraries.patch \
 	patches/icedtea-javafiles.patch \
-	patches/icedtea-core-build.patch
+	patches/icedtea-core-build.patch \
+	patches/icedtea-jvmtiEnv.patch
 
 if WITH_ALT_HSBUILD
 ICEDTEA_PATCHES += \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/patches/icedtea-jvmtiEnv.patch	Thu Feb 26 18:49:20 2009 +0000
@@ -0,0 +1,12 @@
+--- openjdk/hotspot/src/share/vm/prims/jvmtiEnv.cpp.old	2009-02-26 17:18:35.000000000 +0000
++++ openjdk/hotspot/src/share/vm/prims/jvmtiEnv.cpp	2009-02-26 17:16:59.000000000 +0000
+@@ -2702,6 +2702,9 @@
+   (*entry_count_ptr) = num_entries;
+   (*table_ptr) = jvmti_table;
+ 
++  if (num_entries == 0)
++    return JVMTI_ERROR_ABSENT_INFORMATION;
++
+   return JVMTI_ERROR_NONE;
+ } /* end GetLineNumberTable */
+ 
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp	Thu Feb 26 18:48:53 2009 +0000
+++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.cpp	Thu Feb 26 18:49:20 2009 +0000
@@ -97,12 +97,12 @@
     module()->getOrInsertFunction("llvm.memory.barrier", type));
 }
 
-Function *SharkBuilder::CreateFunction()
+Function *SharkBuilder::CreateFunction(const char *name)
 {
   Function *function = Function::Create(
       SharkType::entry_point_type(),
       GlobalVariable::InternalLinkage,
-      "func");
+      name);
   module()->getFunctionList().push_back(function);
   return function;
 }
@@ -180,13 +180,12 @@
 
 void SharkBuilder::MyJITMemoryManager::endFunctionBody
   (const llvm::Function *F, unsigned char *FunctionStart,
-   unsigned char *FunctionEnd) 
+   unsigned char *FunctionEnd)
 {
   mm->endFunctionBody(F, FunctionStart, FunctionEnd);
-#ifndef PRODUCT
+
   SharkEntry *e = sharkEntry[F];
   if (e)
     e->setBounds(FunctionStart, FunctionEnd);
-#endif // !PRODUCT
 }
 
--- a/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp	Thu Feb 26 18:48:53 2009 +0000
+++ b/ports/hotspot/src/share/vm/shark/sharkBuilder.hpp	Thu Feb 26 18:49:20 2009 +0000
@@ -109,7 +109,7 @@
 
   // Function creation
  public:
-  llvm::Function *CreateFunction();
+  llvm::Function *CreateFunction(const char *name = "func");
 
   // Helpers for accessing structures and arrays
  public:
--- a/ports/hotspot/src/share/vm/shark/sharkEntry.hpp	Thu Feb 26 18:48:53 2009 +0000
+++ b/ports/hotspot/src/share/vm/shark/sharkEntry.hpp	Thu Feb 26 18:49:20 2009 +0000
@@ -46,8 +46,6 @@
  public:
   void print_statistics(const char* name) const PRODUCT_RETURN;
 
-#ifndef PRODUCT
- private:
   address code_start() const
   {
     return start;
@@ -66,6 +64,4 @@
     start = (address)FunctionStart;
     limit = (address)FunctionEnd;
   }
-
-#endif // !PRODUCT
 };
--- a/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Thu Feb 26 18:48:53 2009 +0000
+++ b/ports/hotspot/src/share/vm/shark/sharkFunction.cpp	Thu Feb 26 18:49:20 2009 +0000
@@ -37,7 +37,7 @@
   masm()->advance(sizeof(SharkEntry));
 
   // Create the function
-  _function = builder()->CreateFunction();
+  _function = builder()->CreateFunction(name());
   entry->set_llvm_function(function());
 #ifndef PRODUCT
   // FIXME: there should be a mutex when updating sharkEntry in case
@@ -142,7 +142,7 @@
 	// target-specific.
 	Args.push_back("-debug-only=" "x86-emitter");
       else
-	Args.push_back("-debug-only=");
+	Args.push_back("-debug-only=" "none");
       Args.push_back(0);  // Null terminator.
       cl::ParseCommandLineOptions(Args.size()-1, (char**)&Args[0]);
 #endif
@@ -150,6 +150,13 @@
 
   // Compile to native code
   void *code = builder()->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());
+  }
+
   entry->set_entry_point((ZeroEntry::method_entry_t) code);
   if (SharkTraceInstalls)
     entry->print_statistics(name());