[patch] rfc: -XX:SharkPrintAsmOf llvm2.7 api update

View: New views
5 Messages — Rating Filter:   Alert me  

[patch] rfc: -XX:SharkPrintAsmOf llvm2.7 api update

by Xerxes Rånby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

In llvm2.7 svn trunk Chris Lattner added a new API on Aph's request that
would enable and disable debugging output more vigorously.
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091026/089863.html
- new api for us, yay!
The attached patch in this mail makes Shark use this new API for the
-XX:SharkPrintAsmOf debug option.

Unfortunally there was a small namespaces bug in the implementation of
this new LLVM API and I am waiting for response from Chris reguarding
this issue:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091109/090682.html 
- correspondence
You have to apply the patch on llvm in this correspondence in-order to
build the new patch for icedtea6.

Should i remove the old pre LLVM2.7 support for -XX:SharkPrintAsmOf ?
Currently you need a special patched llvm version to make the option
work at all on older LLVM versions.

Cheers and have a great day!
Xerxes





Index: icedtea6/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
===================================================================
--- icedtea6.orig/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp 2009-11-03 13:56:31.000000000 +0100
+++ icedtea6/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp 2009-11-09 11:20:58.000000000 +0100
@@ -132,6 +132,7 @@
 
   // Compile to native code
 #ifndef PRODUCT
+#if SHARK_LLVM_VERSION < 27
 #ifdef X86
   if (SharkPrintAsmOf != NULL) {
     std::vector<const char*> args;
@@ -144,6 +145,21 @@
     cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]);
   }
 #endif // X86
+#endif
+#if SHARK_LLVM_VERSION >= 27
+  if (SharkPrintAsmOf != NULL) {
+    if (!fnmatch(SharkPrintAsmOf, name, 0))
+#ifdef X86
+      llvm::SetCurrentDebugType("x86-emitter");
+#else
+      llvm::SetCurrentDebugType("jit");
+#endif
+      llvm::DebugFlag=true;
+    else
+      llvm::SetCurrentDebugType("");
+      llvm::DebugFlag=false;
+  }
+#endif
 #endif // !PRODUCT
   memory_manager()->set_entry_for_function(function, entry);
   module()->getFunctionList().push_back(function);
Index: icedtea6/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp
===================================================================
--- icedtea6.orig/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp 2009-10-30 10:41:30.000000000 +0100
+++ icedtea6/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp 2009-11-09 09:32:14.000000000 +0100
@@ -44,7 +44,12 @@
 #endif
 #include <llvm/Type.h>
 #include <llvm/ExecutionEngine/JITMemoryManager.h>
+#if SHARK_LLVM_VERSION < 27
 #include <llvm/Support/CommandLine.h>
+#endif
+#if SHARK_LLVM_VERSION >= 27
+#include <llvm/Support/Debug.h>
+#endif
 
 #include <map>
 

Re: [patch] rfc: -XX:SharkPrintAsmOf llvm2.7 api update

by Gary Benson :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Xerxes Rånby wrote:

> In llvm2.7 svn trunk Chris Lattner added a new API on Aph's request
> that would enable and disable debugging output more vigorously.
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091026/089863.html
> - new api for us, yay!
> The attached patch in this mail makes Shark use this new API for the
> -XX:SharkPrintAsmOf debug option.
>
> Unfortunally there was a small namespaces bug in the implementation
> of this new LLVM API and I am waiting for response from Chris
> reguarding this issue:
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091109/090682.html 
> - correspondence
> You have to apply the patch on llvm in this correspondence in-order
> to build the new patch for icedtea6.
>
> Should i remove the old pre LLVM2.7 support for -XX:SharkPrintAsmOf ?
> Currently you need a special patched llvm version to make the option
> work at all on older LLVM versions.

Please leave the old support in, with a #else as I mentioned in my
last mail.

Thanks for doing this!

Cheers,
Gary

--
http://gbenson.net/

Re: [patch] rfc: -XX:SharkPrintAsmOf llvm2.7 api update

by Xerxes Rånby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Xerxes Rånby skrev:

> In llvm2.7 svn trunk Chris Lattner added a new API on Aph's request that
> would enable and disable debugging output more vigorously.
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091026/089863.html
> - new api for us, yay!
> The attached patch in this mail makes Shark use this new API for the
> -XX:SharkPrintAsmOf debug option.
>
> Unfortunally there was a small namespaces bug in the implementation of
> this new LLVM API and I am waiting for response from Chris reguarding
> this issue:
> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091109/090682.html 
> - correspondence
> You have to apply the patch on llvm in this correspondence in-order to
> build the new patch for icedtea6.
>
> Should i remove the old pre LLVM2.7 support for -XX:SharkPrintAsmOf ?
> Currently you need a special patched llvm version to make the option
> work at all on older LLVM versions.
>
> Cheers and have a great day!
> Xerxes
>  
 2nd try i somehow attached the wrong version of the patch with some
missing curly-brackets, this should be the correct version.

Xerxes

Index: icedtea6/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp
===================================================================
--- icedtea6.orig/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp 2009-11-03 13:56:31.000000000 +0100
+++ icedtea6/ports/hotspot/src/share/vm/shark/sharkCompiler.cpp 2009-11-09 12:08:35.000000000 +0100
@@ -132,6 +132,7 @@
 
   // Compile to native code
 #ifndef PRODUCT
+#if SHARK_LLVM_VERSION < 27
 #ifdef X86
   if (SharkPrintAsmOf != NULL) {
     std::vector<const char*> args;
@@ -144,6 +145,22 @@
     cl::ParseCommandLineOptions(args.size() - 1, (char **) &args[0]);
   }
 #endif // X86
+#endif
+#if SHARK_LLVM_VERSION >= 27
+  if (SharkPrintAsmOf != NULL) {
+    if (!fnmatch(SharkPrintAsmOf, name, 0)) {
+#ifdef X86
+      llvm::SetCurrentDebugType("x86-emitter");
+#else
+      llvm::SetCurrentDebugType("jit");
+#endif // X86
+      llvm::DebugFlag=true;
+    } else {
+      llvm::SetCurrentDebugType("");
+      llvm::DebugFlag=false;
+    }
+  }
+#endif
 #endif // !PRODUCT
   memory_manager()->set_entry_for_function(function, entry);
   module()->getFunctionList().push_back(function);
Index: icedtea6/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp
===================================================================
--- icedtea6.orig/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp 2009-10-30 10:41:30.000000000 +0100
+++ icedtea6/ports/hotspot/src/share/vm/shark/llvmHeaders.hpp 2009-11-09 09:32:14.000000000 +0100
@@ -44,7 +44,12 @@
 #endif
 #include <llvm/Type.h>
 #include <llvm/ExecutionEngine/JITMemoryManager.h>
+#if SHARK_LLVM_VERSION < 27
 #include <llvm/Support/CommandLine.h>
+#endif
+#if SHARK_LLVM_VERSION >= 27
+#include <llvm/Support/Debug.h>
+#endif
 
 #include <map>
 

Re: [patch] rfc: -XX:SharkPrintAsmOf llvm2.7 api update

by Xerxes Rånby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Gary Benson skrev:

> Xerxes Rånby wrote:
>  
>> In llvm2.7 svn trunk Chris Lattner added a new API on Aph's request
>> that would enable and disable debugging output more vigorously.
>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091026/089863.html
>> - new api for us, yay!
>> The attached patch in this mail makes Shark use this new API for the
>> -XX:SharkPrintAsmOf debug option.
>>
>> Unfortunally there was a small namespaces bug in the implementation
>> of this new LLVM API and I am waiting for response from Chris
>> reguarding this issue:
>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091109/090682.html 
>> - correspondence
>> You have to apply the patch on llvm in this correspondence in-order
>> to build the new patch for icedtea6.
>>
>> Should i remove the old pre LLVM2.7 support for -XX:SharkPrintAsmOf ?
>> Currently you need a special patched llvm version to make the option
>> work at all on older LLVM versions.
>>    
>
> Please leave the old support in, with a #else as I mentioned in my
> last mail.
>
> Thanks for doing this!
>
> Cheers,
> Gary
>
>  
Ok thanks, i will add as many #else as appropriate and commit!

Cheers
Xerxes

Re: [patch] rfc: -XX:SharkPrintAsmOf llvm2.7 api update

by Xerxes Rånby :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Xerxes Rånby skrev:

> Gary Benson skrev:
>  
>> Xerxes Rånby wrote:
>>  
>>    
>>> In llvm2.7 svn trunk Chris Lattner added a new API on Aph's request
>>> that would enable and disable debugging output more vigorously.
>>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091026/089863.html
>>> - new api for us, yay!
>>> The attached patch in this mail makes Shark use this new API for the
>>> -XX:SharkPrintAsmOf debug option.
>>>
>>> Unfortunally there was a small namespaces bug in the implementation
>>> of this new LLVM API and I am waiting for response from Chris
>>> reguarding this issue:
>>> http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091109/090682.html 
>>> - correspondence
>>> You have to apply the patch on llvm in this correspondence in-order
>>> to build the new patch for icedtea6.
>>>      

For your information: Patching of llvm are no longer needed to make use
of the -XX:SharkPrintAsmOf=  debug option when using llvm2.7svn rev
86544 and later with icedtea6! All fixed upstream.
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20091109/090686.html

Enjoy!
Xerxes