changeset 1764:a3d58ec76be9

Fix Shark build. 2009-03-19 Andrew John Hughes <ahughes@redhat.com> * acinclude.m4: Cleanup options so only --enable-shark is needed to build Shark. * configure.ac: Reorder for above. * patches/hotspot/default/icedtea-shark.patch: Recreated against b50/HSb15.
author Andrew John Hughes <ahughes@redhat.com>
date Thu, 19 Mar 2009 16:00:19 +0000
parents 3fbe290cdd66
children 9adee4a3a8d1
files ChangeLog acinclude.m4 configure.ac patches/hotspot/default/icedtea-shark.patch
diffstat 4 files changed, 343 insertions(+), 316 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Thu Mar 19 13:51:08 2009 +0000
+++ b/ChangeLog	Thu Mar 19 16:00:19 2009 +0000
@@ -1,3 +1,12 @@
+2009-03-19  Andrew John Hughes  <ahughes@redhat.com>
+
+	* acinclude.m4:
+	Cleanup options so only --enable-shark is
+	needed to build Shark.
+	* configure.ac: Reorder for above.
+	* patches/hotspot/default/icedtea-shark.patch:
+	Recreated against b50/HSb15.
+
 2009-03-09  Tomas Hurka  <tomas.hurka@sun.com>
 
 	* Makefile.am: Updated visualvm to version 1.1.1.
--- a/acinclude.m4	Thu Mar 19 13:51:08 2009 +0000
+++ b/acinclude.m4	Thu Mar 19 16:00:19 2009 +0000
@@ -714,22 +714,36 @@
     esac
   ],
   [
-    case "${host}" in
-      i?86-*-*) ;;
-      sparc*-*-*) ;;
-      x86_64-*-*) ;;
-      *)
-        if test "x${WITH_CACAO}" != xno; then
-          use_zero=no
-        else
-          use_zero=yes
-        fi
-        ;;
-    esac
+    if test "x${use_shark}" = "xyes"; then
+      use_zero=yes;
+    else
+      case "${host}" in
+        i?86-*-*) ;;
+        sparc*-*-*) ;;
+        x86_64-*-*) ;;
+        *)
+          if test "x${WITH_CACAO}" != xno; then
+            use_zero=no
+          else
+            use_zero=yes
+          fi
+          ;;
+      esac
+    fi
   ])
   AC_MSG_RESULT($use_zero)
   AM_CONDITIONAL(ZERO_BUILD, test "x${use_zero}" = xyes)
 
+  use_core=no
+  if test "x${WITH_CACAO}" != "xno"; then
+    use_core=yes;
+  elif test "x${use_zero}" = "xyes"; then
+    if test "x${use_shark}" = "xno"; then
+      use_core=yes;
+    fi
+  fi
+  AM_CONDITIONAL(CORE_BUILD, test "x${use_core}" = xyes)
+
   ZERO_LIBARCH=
   ZERO_BITSPERWORD=
   ZERO_ENDIANNESS=
@@ -789,7 +803,7 @@
   AC_CONFIG_FILES([ergo.c])
 ])
 
-AC_DEFUN([SET_CORE_OR_SHARK_BUILD],
+AC_DEFUN([SET_SHARK_BUILD],
 [
   AC_MSG_CHECKING(whether to use the Shark JIT)
   shark_selected=no
@@ -804,20 +818,12 @@
     esac
   ])
 
-  use_core=no
   use_shark=no
-  if test "x${WITH_CACAO}" != "xno"; then
-    use_core=yes
-  elif test "x${use_zero}" = "xyes"; then
-    if test "x${shark_selected}" = "xyes"; then
+  if test "x${shark_selected}" = "xyes"; then
       use_shark=yes
-    else
-      use_core=yes
-    fi
   fi
   AC_MSG_RESULT($use_shark)
 
-  AM_CONDITIONAL(CORE_BUILD, test "x${use_core}" = xyes)
   AM_CONDITIONAL(SHARK_BUILD, test "x${use_shark}" = xyes)
 ])
 
--- a/configure.ac	Thu Mar 19 13:51:08 2009 +0000
+++ b/configure.ac	Thu Mar 19 16:00:19 2009 +0000
@@ -279,8 +279,8 @@
 AC_CHECK_WITH_CACAO_HOME
 AC_CHECK_WITH_CACAO_SRC_ZIP
 ENABLE_OPTIMIZATIONS
+SET_SHARK_BUILD
 ENABLE_ZERO_BUILD
-SET_CORE_OR_SHARK_BUILD
 WITH_VERSION_SUFFIX
 WITH_PROJECT
 ENABLE_HG
--- a/patches/hotspot/default/icedtea-shark.patch	Thu Mar 19 13:51:08 2009 +0000
+++ b/patches/hotspot/default/icedtea-shark.patch	Thu Mar 19 16:00:19 2009 +0000
@@ -1,5 +1,228 @@
---- openjdk/hotspot/src/share/vm/oops/methodOop.cpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/oops/methodOop.cpp	2008-12-03 14:33:48.000000000 +0000
+diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.cpp openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp
+--- openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	2009-03-05 08:25:32.000000000 +0000
++++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	2009-03-19 14:32:38.000000000 +0000
+@@ -548,3 +548,14 @@
+   }
+   return impl;
+ }
++
++#ifdef SHARK
++// ------------------------------------------------------------------
++// ciInstanceKlass::is_cache_entry_resolved
++//
++// Is this entry in the constant pool cache resolved?
++bool ciInstanceKlass::is_cache_entry_resolved(int index, Bytecodes::Code opcode) {
++  VM_ENTRY_MARK;
++  return get_instanceKlass()->constants()->cache()->entry_at(index)->is_resolved(opcode);
++}
++#endif // SHARK
+diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.hpp openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp
+--- openjdk.orig/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	2009-03-05 08:25:32.000000000 +0000
++++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	2009-03-19 14:32:38.000000000 +0000
+@@ -198,4 +198,9 @@
+   // What kind of ciObject is this?
+   bool is_instance_klass() { return true; }
+   bool is_java_klass()     { return true; }
++
++#ifdef SHARK
++  // Is this entry in the constant pool cache resolved?
++  bool is_cache_entry_resolved(int index, Bytecodes::Code opcode);
++#endif // SHARK
+ };
+diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciMethod.cpp openjdk/hotspot/src/share/vm/ci/ciMethod.cpp
+--- openjdk.orig/hotspot/src/share/vm/ci/ciMethod.cpp	2009-03-05 08:25:32.000000000 +0000
++++ openjdk/hotspot/src/share/vm/ci/ciMethod.cpp	2009-03-19 14:32:38.000000000 +0000
+@@ -56,9 +56,9 @@
+   _liveness           = NULL;
+   _bcea = NULL;
+   _method_blocks = NULL;
+-#ifdef COMPILER2
++#if defined(COMPILER2) || defined(SHARK)
+   _flow               = NULL;
+-#endif // COMPILER2
++#endif // COMPILER2 || SHARK
+ 
+   if (JvmtiExport::can_hotswap_or_post_breakpoint() && _is_compilable) {
+     // 6328518 check hotswap conditions under the right lock.
+@@ -124,9 +124,9 @@
+   _bcea = NULL;
+   _method_blocks = NULL;
+   _method_data = NULL;
+-#ifdef COMPILER2
++#if defined(COMPILER2) || defined(SHARK)
+   _flow = NULL;
+-#endif // COMPILER2
++#endif // COMPILER2 || SHARK
+ }
+ 
+ 
+@@ -294,34 +294,34 @@
+ // ------------------------------------------------------------------
+ // ciMethod::get_flow_analysis
+ ciTypeFlow* ciMethod::get_flow_analysis() {
+-#ifdef COMPILER2
++#if defined(COMPILER2) || defined(SHARK)
+   if (_flow == NULL) {
+     ciEnv* env = CURRENT_ENV;
+     _flow = new (env->arena()) ciTypeFlow(env, this);
+     _flow->do_flow();
+   }
+   return _flow;
+-#else // COMPILER2
++#else // COMPILER2 || SHARK
+   ShouldNotReachHere();
+   return NULL;
+-#endif // COMPILER2
++#endif // COMPILER2 || SHARK
+ }
+ 
+ 
+ // ------------------------------------------------------------------
+ // ciMethod::get_osr_flow_analysis
+ ciTypeFlow* ciMethod::get_osr_flow_analysis(int osr_bci) {
+-#ifdef COMPILER2
++#if defined(COMPILER2) || defined(SHARK)
+   // OSR entry points are always place after a call bytecode of some sort
+   assert(osr_bci >= 0, "must supply valid OSR entry point");
+   ciEnv* env = CURRENT_ENV;
+   ciTypeFlow* flow = new (env->arena()) ciTypeFlow(env, this, osr_bci);
+   flow->do_flow();
+   return flow;
+-#else // COMPILER2
++#else // COMPILER2 || SHARK
+   ShouldNotReachHere();
+   return NULL;
+-#endif // COMPILER2
++#endif // COMPILER2 || SHARK
+ }
+ 
+ // ------------------------------------------------------------------
+diff -Nru openjdk.orig/hotspot/src/share/vm/ci/ciMethod.hpp openjdk/hotspot/src/share/vm/ci/ciMethod.hpp
+--- openjdk.orig/hotspot/src/share/vm/ci/ciMethod.hpp	2009-03-05 08:25:32.000000000 +0000
++++ openjdk/hotspot/src/share/vm/ci/ciMethod.hpp	2009-03-19 14:32:38.000000000 +0000
+@@ -69,7 +69,7 @@
+ 
+   // Optional liveness analyzer.
+   MethodLiveness* _liveness;
+-#ifdef COMPILER2
++#if defined(COMPILER2) || defined(SHARK)
+   ciTypeFlow*     _flow;
+ #endif
+ 
+diff -Nru openjdk.orig/hotspot/src/share/vm/code/nmethod.cpp openjdk/hotspot/src/share/vm/code/nmethod.cpp
+--- openjdk.orig/hotspot/src/share/vm/code/nmethod.cpp	2009-03-05 08:25:32.000000000 +0000
++++ openjdk/hotspot/src/share/vm/code/nmethod.cpp	2009-03-19 14:32:38.000000000 +0000
+@@ -65,6 +65,11 @@
+   assert(compiler() != NULL, "must be");
+   return compiler()->is_c2();
+ }
++bool nmethod::is_compiled_by_shark() const {
++  if (is_native_method()) return false;
++  assert(compiler() != NULL, "must be");
++  return compiler()->is_shark();
++}
+ 
+ 
+ 
+@@ -1567,6 +1572,7 @@
+ // Method that knows how to preserve outgoing arguments at call. This method must be
+ // called with a frame corresponding to a Java invoke
+ void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
++#ifndef SHARK
+   if (!method()->is_native()) {
+     SimpleScopeDesc ssd(this, fr.pc());
+     Bytecode_invoke* call = Bytecode_invoke_at(ssd.method(), ssd.bci());
+@@ -1574,6 +1580,7 @@
+     symbolOop signature = call->signature();
+     fr.oops_compiled_arguments_do(signature, is_static, reg_map, f);
+   }
++#endif // !SHARK
+ }
+ 
+ 
+@@ -2003,6 +2010,8 @@
+     tty->print("(c1) ");
+   } else if (is_compiled_by_c2()) {
+     tty->print("(c2) ");
++  } else if (is_compiled_by_shark()) {
++    tty->print("(shark) ");
+   } else {
+     tty->print("(nm) ");
+   }
+diff -Nru openjdk.orig/hotspot/src/share/vm/code/nmethod.hpp openjdk/hotspot/src/share/vm/code/nmethod.hpp
+--- openjdk.orig/hotspot/src/share/vm/code/nmethod.hpp	2009-03-05 08:25:32.000000000 +0000
++++ openjdk/hotspot/src/share/vm/code/nmethod.hpp	2009-03-19 14:32:38.000000000 +0000
+@@ -318,6 +318,7 @@
+ 
+   bool is_compiled_by_c1() const;
+   bool is_compiled_by_c2() const;
++  bool is_compiled_by_shark() const;
+ 
+   // boundaries for different parts
+   address code_begin         () const             { return _entry_point; }
+diff -Nru openjdk.orig/hotspot/src/share/vm/compiler/abstractCompiler.hpp openjdk/hotspot/src/share/vm/compiler/abstractCompiler.hpp
+--- openjdk.orig/hotspot/src/share/vm/compiler/abstractCompiler.hpp	2009-03-05 08:25:32.000000000 +0000
++++ openjdk/hotspot/src/share/vm/compiler/abstractCompiler.hpp	2009-03-19 14:32:38.000000000 +0000
+@@ -45,18 +45,26 @@
+   // Missing feature tests
+   virtual bool supports_native()                 { return true; }
+   virtual bool supports_osr   ()                 { return true; }
+-#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2))
++#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK))
+   virtual bool is_c1   ()                        { return false; }
+   virtual bool is_c2   ()                        { return false; }
++  virtual bool is_shark()                        { return false; }
+ #else
+ #ifdef COMPILER1
+   bool is_c1   ()                                { return true; }
+   bool is_c2   ()                                { return false; }
++  bool is_shark()                                { return false; }
+ #endif // COMPILER1
+ #ifdef COMPILER2
+   bool is_c1   ()                                { return false; }
+   bool is_c2   ()                                { return true; }
++  bool is_shark()                                { return false; }
+ #endif // COMPILER2
++#ifdef SHARK
++  bool is_c1   ()                                { return false; }
++  bool is_c2   ()                                { return false; }
++  bool is_shark()                                { return true; }
++#endif // SHARK  
+ #endif // TIERED
+ 
+   // Customization
+diff -Nru openjdk.orig/hotspot/src/share/vm/compiler/compileBroker.cpp openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp
+--- openjdk.orig/hotspot/src/share/vm/compiler/compileBroker.cpp	2009-03-05 08:25:32.000000000 +0000
++++ openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp	2009-03-19 14:32:38.000000000 +0000
+@@ -554,6 +554,14 @@
+ #endif
+ #endif // COMPILER2
+ 
++#ifdef SHARK
++#if defined(COMPILER1) || defined(COMPILER2)
++#error "Can't use COMPILER1 or COMPILER2 with shark"
++#endif
++  _compilers[0] = new SharkCompiler();
++  _compilers[1] = _compilers[0];  
++#endif
++  
+   // Initialize the CompileTask free list
+   _task_free_list = NULL;
+ 
+diff -Nru openjdk.orig/hotspot/src/share/vm/memory/cardTableModRefBS.hpp openjdk/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
+--- openjdk.orig/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	2009-03-05 08:25:33.000000000 +0000
++++ openjdk/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	2009-03-19 14:32:38.000000000 +0000
+@@ -44,6 +44,7 @@
+   friend class VMStructs;
+   friend class CardTableRS;
+   friend class CheckForUnmarkedOops; // Needs access to raw card bytes.
++  friend class SharkBuilder;
+ #ifndef PRODUCT
+   // For debugging.
+   friend class GuaranteeNotModClosure;
+diff -Nru openjdk.orig/hotspot/src/share/vm/oops/methodOop.cpp openjdk/hotspot/src/share/vm/oops/methodOop.cpp
+--- openjdk.orig/hotspot/src/share/vm/oops/methodOop.cpp	2009-03-05 08:25:34.000000000 +0000
++++ openjdk/hotspot/src/share/vm/oops/methodOop.cpp	2009-03-19 14:32:38.000000000 +0000
 @@ -727,10 +727,14 @@
    }
  
@@ -15,96 +238,9 @@
  
  }
  
---- openjdk/hotspot/src/share/vm/memory/cardTableModRefBS.hpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/memory/cardTableModRefBS.hpp	2008-12-03 14:33:48.000000000 +0000
-@@ -44,6 +44,7 @@
-   friend class VMStructs;
-   friend class CardTableRS;
-   friend class CheckForUnmarkedOops; // Needs access to raw card bytes.
-+  friend class SharkBuilder;
- #ifndef PRODUCT
-   // For debugging.
-   friend class GuaranteeNotModClosure;
---- openjdk/hotspot/src/share/vm/runtime/globals.cpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/runtime/globals.cpp	2008-12-03 14:33:48.000000000 +0000
-@@ -176,6 +176,18 @@
-   #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2 notproduct}", DEFAULT },
- #endif
- 
-+#define SHARK_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark product}", DEFAULT },
-+#define SHARK_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{Shark pd product}", DEFAULT },
-+#define SHARK_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark diagnostic}", DEFAULT },
-+#ifdef PRODUCT
-+  #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
-+  #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
-+  #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
-+#else
-+  #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark}", DEFAULT },
-+  #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{Shark pd}", DEFAULT },
-+  #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark notproduct}", DEFAULT },
-+#endif
- 
- static Flag flagTable[] = {
-  RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT)
-@@ -189,6 +201,9 @@
- #ifdef COMPILER2
-  C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, C2_PD_DEVELOP_FLAG_STRUCT, C2_PRODUCT_FLAG_STRUCT, C2_PD_PRODUCT_FLAG_STRUCT, C2_DIAGNOSTIC_FLAG_STRUCT, C2_NOTPRODUCT_FLAG_STRUCT)
- #endif
-+#ifdef SHARK
-+ SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, SHARK_PD_DEVELOP_FLAG_STRUCT, SHARK_PRODUCT_FLAG_STRUCT, SHARK_PD_PRODUCT_FLAG_STRUCT, SHARK_DIAGNOSTIC_FLAG_STRUCT, SHARK_NOTPRODUCT_FLAG_STRUCT)
-+#endif
-  {0, NULL, NULL}
- };
- 
---- openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp	2008-12-03 14:33:49.000000000 +0000
-@@ -64,6 +64,11 @@
-       assert(monitor->owner() == NULL || (!monitor->owner()->is_unlocked() && !monitor->owner()->has_bias_pattern()), "object must be null or locked, and unbiased");
-       BasicObjectLock* dest = _monitors->at(index);
-       dest->set_obj(monitor->owner());
-+#ifdef SHARK
-+      // XXX This can be removed when Shark knows
-+      // which monitors are in use.
-+      if (monitor->owner())
-+#endif // SHARK
-       monitor->lock()->move_to(monitor->owner(), dest->lock());
-     }
-   }
-@@ -262,6 +267,11 @@
-     top = iframe()->previous_monitor_in_interpreter_frame(top);
-     BasicObjectLock* src = _monitors->at(index);
-     top->set_obj(src->obj());
-+#ifdef SHARK
-+    // XXX This can be removed when Shark knows
-+    // which monitors are in use.
-+    if (src->obj())
-+#endif // SHARK    
-     src->lock()->move_to(src->obj(), top->lock());
-   }
-   if (ProfileInterpreter) {
---- openjdk/hotspot/src/share/vm/runtime/vm_version.cpp.orig	2008-12-03 14:23:37.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/runtime/vm_version.cpp	2008-12-03 14:33:48.000000000 +0000
-@@ -94,12 +94,16 @@
- #ifdef TIERED
-   #define VMTYPE "Server"
- #else
-+#ifdef SHARK
-+  #define VMTYPE "Shark"
-+#else
- #if defined(COMPILER1) || defined(COMPILER2)
--   #define VMTYPE COMPILER1_PRESENT("Client")   \
--                  COMPILER2_PRESENT("Server")
-+  #define VMTYPE COMPILER1_PRESENT("Client")   \
-+                 COMPILER2_PRESENT("Server")
- #else
-   #define VMTYPE "Core"
- #endif // COMPILER1 || COMPILER2
-+#endif // SHARK
- #endif // TIERED
- #endif // KERNEL
- 
---- openjdk/hotspot/src/share/vm/runtime/deoptimization.cpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/runtime/deoptimization.cpp	2008-12-03 14:33:48.000000000 +0000
+diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/deoptimization.cpp openjdk/hotspot/src/share/vm/runtime/deoptimization.cpp
+--- openjdk.orig/hotspot/src/share/vm/runtime/deoptimization.cpp	2009-03-05 08:25:35.000000000 +0000
++++ openjdk/hotspot/src/share/vm/runtime/deoptimization.cpp	2009-03-19 14:32:38.000000000 +0000
 @@ -229,6 +229,7 @@
  
    }
@@ -179,8 +315,41 @@
  
 -#endif // COMPILER2
 +#endif // COMPILER2 || SHARK
---- openjdk/hotspot/src/share/vm/runtime/globals.hpp.orig	2008-12-03 14:22:17.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/runtime/globals.hpp	2008-12-03 14:33:48.000000000 +0000
+diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/globals.cpp openjdk/hotspot/src/share/vm/runtime/globals.cpp
+--- openjdk.orig/hotspot/src/share/vm/runtime/globals.cpp	2009-03-05 08:25:35.000000000 +0000
++++ openjdk/hotspot/src/share/vm/runtime/globals.cpp	2009-03-19 14:32:38.000000000 +0000
+@@ -176,6 +176,18 @@
+   #define C2_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{C2 notproduct}", DEFAULT },
+ #endif
+ 
++#define SHARK_PRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark product}", DEFAULT },
++#define SHARK_PD_PRODUCT_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{Shark pd product}", DEFAULT },
++#define SHARK_DIAGNOSTIC_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark diagnostic}", DEFAULT },
++#ifdef PRODUCT
++  #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) /* flag is constant */
++  #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     /* flag is constant */
++  #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc)
++#else
++  #define SHARK_DEVELOP_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark}", DEFAULT },
++  #define SHARK_PD_DEVELOP_FLAG_STRUCT(type, name, doc)     { #type, XSTR(name), &name, "{Shark pd}", DEFAULT },
++  #define SHARK_NOTPRODUCT_FLAG_STRUCT(type, name, value, doc) { #type, XSTR(name), &name, "{Shark notproduct}", DEFAULT },
++#endif
+ 
+ static Flag flagTable[] = {
+  RUNTIME_FLAGS(RUNTIME_DEVELOP_FLAG_STRUCT, RUNTIME_PD_DEVELOP_FLAG_STRUCT, RUNTIME_PRODUCT_FLAG_STRUCT, RUNTIME_PD_PRODUCT_FLAG_STRUCT, RUNTIME_DIAGNOSTIC_FLAG_STRUCT, RUNTIME_EXPERIMENTAL_FLAG_STRUCT, RUNTIME_NOTPRODUCT_FLAG_STRUCT, RUNTIME_MANAGEABLE_FLAG_STRUCT, RUNTIME_PRODUCT_RW_FLAG_STRUCT, RUNTIME_LP64_PRODUCT_FLAG_STRUCT)
+@@ -189,6 +201,9 @@
+ #ifdef COMPILER2
+  C2_FLAGS(C2_DEVELOP_FLAG_STRUCT, C2_PD_DEVELOP_FLAG_STRUCT, C2_PRODUCT_FLAG_STRUCT, C2_PD_PRODUCT_FLAG_STRUCT, C2_DIAGNOSTIC_FLAG_STRUCT, C2_NOTPRODUCT_FLAG_STRUCT)
+ #endif
++#ifdef SHARK
++ SHARK_FLAGS(SHARK_DEVELOP_FLAG_STRUCT, SHARK_PD_DEVELOP_FLAG_STRUCT, SHARK_PRODUCT_FLAG_STRUCT, SHARK_PD_PRODUCT_FLAG_STRUCT, SHARK_DIAGNOSTIC_FLAG_STRUCT, SHARK_NOTPRODUCT_FLAG_STRUCT)
++#endif
+  {0, NULL, NULL}
+ };
+ 
+diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp openjdk/hotspot/src/share/vm/runtime/globals.hpp
+--- openjdk.orig/hotspot/src/share/vm/runtime/globals.hpp	2009-03-19 14:27:37.000000000 +0000
++++ openjdk/hotspot/src/share/vm/runtime/globals.hpp	2009-03-19 14:32:38.000000000 +0000
 @@ -22,7 +22,7 @@
   *
   */
@@ -190,208 +359,51 @@
  define_pd_global(bool, BackgroundCompilation,        false);
  define_pd_global(bool, UseTLAB,                      false);
  define_pd_global(bool, CICompileOSR,                 false);
---- openjdk/hotspot/src/share/vm/code/nmethod.hpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/code/nmethod.hpp	2008-12-03 14:33:48.000000000 +0000
-@@ -318,6 +318,7 @@
- 
-   bool is_compiled_by_c1() const;
-   bool is_compiled_by_c2() const;
-+  bool is_compiled_by_shark() const;
- 
-   // boundaries for different parts
-   address code_begin         () const             { return _entry_point; }
---- openjdk/hotspot/src/share/vm/code/nmethod.cpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/code/nmethod.cpp	2008-12-03 14:33:48.000000000 +0000
-@@ -65,6 +65,11 @@
-   assert(compiler() != NULL, "must be");
-   return compiler()->is_c2();
- }
-+bool nmethod::is_compiled_by_shark() const {
-+  if (is_native_method()) return false;
-+  assert(compiler() != NULL, "must be");
-+  return compiler()->is_shark();
-+}
- 
- 
- 
-@@ -1567,6 +1572,7 @@
- // Method that knows how to preserve outgoing arguments at call. This method must be
- // called with a frame corresponding to a Java invoke
- void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map, OopClosure* f) {
-+#ifndef SHARK
-   if (!method()->is_native()) {
-     SimpleScopeDesc ssd(this, fr.pc());
-     Bytecode_invoke* call = Bytecode_invoke_at(ssd.method(), ssd.bci());
-@@ -1574,6 +1580,7 @@
-     symbolOop signature = call->signature();
-     fr.oops_compiled_arguments_do(signature, is_static, reg_map, f);
-   }
-+#endif // !SHARK
- }
- 
- 
-@@ -2003,6 +2010,8 @@
-     tty->print("(c1) ");
-   } else if (is_compiled_by_c2()) {
-     tty->print("(c2) ");
-+  } else if (is_compiled_by_shark()) {
-+    tty->print("(shark) ");
-   } else {
-     tty->print("(nm) ");
+diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/vframeArray.cpp openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp
+--- openjdk.orig/hotspot/src/share/vm/runtime/vframeArray.cpp	2009-03-05 08:25:35.000000000 +0000
++++ openjdk/hotspot/src/share/vm/runtime/vframeArray.cpp	2009-03-19 14:32:38.000000000 +0000
+@@ -64,6 +64,11 @@
+       assert(monitor->owner() == NULL || (!monitor->owner()->is_unlocked() && !monitor->owner()->has_bias_pattern()), "object must be null or locked, and unbiased");
+       BasicObjectLock* dest = _monitors->at(index);
+       dest->set_obj(monitor->owner());
++#ifdef SHARK
++      // XXX This can be removed when Shark knows
++      // which monitors are in use.
++      if (monitor->owner())
++#endif // SHARK
+       monitor->lock()->move_to(monitor->owner(), dest->lock());
+     }
    }
---- openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/compiler/compileBroker.cpp	2008-12-03 14:33:48.000000000 +0000
-@@ -554,6 +554,14 @@
- #endif
- #endif // COMPILER2
- 
+@@ -262,6 +267,11 @@
+     top = iframe()->previous_monitor_in_interpreter_frame(top);
+     BasicObjectLock* src = _monitors->at(index);
+     top->set_obj(src->obj());
 +#ifdef SHARK
-+#if defined(COMPILER1) || defined(COMPILER2)
-+#error "Can't use COMPILER1 or COMPILER2 with shark"
-+#endif
-+  _compilers[0] = new SharkCompiler();
-+  _compilers[1] = _compilers[0];  
-+#endif
-+  
-   // Initialize the CompileTask free list
-   _task_free_list = NULL;
- 
---- openjdk/hotspot/src/share/vm/compiler/abstractCompiler.hpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/compiler/abstractCompiler.hpp	2008-12-03 14:33:48.000000000 +0000
-@@ -45,18 +45,26 @@
-   // Missing feature tests
-   virtual bool supports_native()                 { return true; }
-   virtual bool supports_osr   ()                 { return true; }
--#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2))
-+#if defined(TIERED) || ( !defined(COMPILER1) && !defined(COMPILER2) && !defined(SHARK))
-   virtual bool is_c1   ()                        { return false; }
-   virtual bool is_c2   ()                        { return false; }
-+  virtual bool is_shark()                        { return false; }
++    // XXX This can be removed when Shark knows
++    // which monitors are in use.
++    if (src->obj())
++#endif // SHARK    
+     src->lock()->move_to(src->obj(), top->lock());
+   }
+   if (ProfileInterpreter) {
+diff -Nru openjdk.orig/hotspot/src/share/vm/runtime/vm_version.cpp openjdk/hotspot/src/share/vm/runtime/vm_version.cpp
+--- openjdk.orig/hotspot/src/share/vm/runtime/vm_version.cpp	2009-03-19 14:27:37.000000000 +0000
++++ openjdk/hotspot/src/share/vm/runtime/vm_version.cpp	2009-03-19 14:34:18.000000000 +0000
+@@ -94,6 +94,9 @@
+ #ifdef TIERED
+   #define VMTYPE "Server"
  #else
- #ifdef COMPILER1
-   bool is_c1   ()                                { return true; }
-   bool is_c2   ()                                { return false; }
-+  bool is_shark()                                { return false; }
- #endif // COMPILER1
- #ifdef COMPILER2
-   bool is_c1   ()                                { return false; }
-   bool is_c2   ()                                { return true; }
-+  bool is_shark()                                { return false; }
- #endif // COMPILER2
 +#ifdef SHARK
-+  bool is_c1   ()                                { return false; }
-+  bool is_c2   ()                                { return false; }
-+  bool is_shark()                                { return true; }
-+#endif // SHARK  
++  #define VMTYPE "Shark"
++#else
+ #if defined(COMPILER1) || defined(COMPILER2)
+    #define VMTYPE COMPILER1_PRESENT("Client")   \
+                   COMPILER2_PRESENT("Server")
+@@ -104,6 +107,7 @@
+   #define VMTYPE "Core"
+ #endif // ZERO
+ #endif // COMPILER1 || COMPILER2
++#endif // SHARK
  #endif // TIERED
- 
-   // Customization
---- openjdk/hotspot/src/share/vm/ci/ciMethod.hpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/ci/ciMethod.hpp	2008-12-03 14:33:48.000000000 +0000
-@@ -69,7 +69,7 @@
+ #endif // KERNEL
  
-   // Optional liveness analyzer.
-   MethodLiveness* _liveness;
--#ifdef COMPILER2
-+#if defined(COMPILER2) || defined(SHARK)
-   ciTypeFlow*     _flow;
- #endif
- 
---- openjdk/hotspot/src/share/vm/ci/ciMethod.cpp.orig	2008-11-22 00:11:18.000000000 +0000
-+++ openjdk/hotspot/src/share/vm/ci/ciMethod.cpp	2008-12-03 14:33:48.000000000 +0000
-@@ -56,9 +56,9 @@
-   _liveness           = NULL;
-   _bcea = NULL;
-   _method_blocks = NULL;
--#ifdef COMPILER2
-+#if defined(COMPILER2) || defined(SHARK)
-   _flow               = NULL;
--#endif // COMPILER2
-+#endif // COMPILER2 || SHARK
- 
-   if (JvmtiExport::can_hotswap_or_post_breakpoint() && _is_compilable) {
-     // 6328518 check hotswap conditions under the right lock.
-@@ -124,9 +124,9 @@
-   _bcea = NULL;
-   _method_blocks = NULL;
-   _method_data = NULL;
--#ifdef COMPILER2
-+#if defined(COMPILER2) || defined(SHARK)
-   _flow = NULL;
--#endif // COMPILER2
-+#endif // COMPILER2 || SHARK
- }
- 
- 
-@@ -294,34 +294,34 @@
- // ------------------------------------------------------------------
- // ciMethod::get_flow_analysis
- ciTypeFlow* ciMethod::get_flow_analysis() {
--#ifdef COMPILER2
-+#if defined(COMPILER2) || defined(SHARK)
-   if (_flow == NULL) {
-     ciEnv* env = CURRENT_ENV;
-     _flow = new (env->arena()) ciTypeFlow(env, this);
-     _flow->do_flow();
-   }
-   return _flow;
--#else // COMPILER2
-+#else // COMPILER2 || SHARK
-   ShouldNotReachHere();
-   return NULL;
--#endif // COMPILER2
-+#endif // COMPILER2 || SHARK
- }
- 
- 
- // ------------------------------------------------------------------
- // ciMethod::get_osr_flow_analysis
- ciTypeFlow* ciMethod::get_osr_flow_analysis(int osr_bci) {
--#ifdef COMPILER2
-+#if defined(COMPILER2) || defined(SHARK)
-   // OSR entry points are always place after a call bytecode of some sort
-   assert(osr_bci >= 0, "must supply valid OSR entry point");
-   ciEnv* env = CURRENT_ENV;
-   ciTypeFlow* flow = new (env->arena()) ciTypeFlow(env, this, osr_bci);
-   flow->do_flow();
-   return flow;
--#else // COMPILER2
-+#else // COMPILER2 || SHARK
-   ShouldNotReachHere();
-   return NULL;
--#endif // COMPILER2
-+#endif // COMPILER2 || SHARK
- }
- 
- // ------------------------------------------------------------------
-diff -r 5297ff20101d openjdk-ecj/hotspot/src/share/vm/ci/ciInstanceKlass.hpp
---- openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Mon Dec 15 15:32:37 2008 +0000
-+++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.hpp	Thu Mar 05 11:48:56 2009 +0000
-@@ -198,4 +198,9 @@
-   // What kind of ciObject is this?
-   bool is_instance_klass() { return true; }
-   bool is_java_klass()     { return true; }
-+
-+#ifdef SHARK
-+  // Is this entry in the constant pool cache resolved?
-+  bool is_cache_entry_resolved(int index, Bytecodes::Code opcode);
-+#endif // SHARK
- };
-diff -r 5297ff20101d openjdk-ecj/hotspot/src/share/vm/ci/ciInstanceKlass.cpp
---- openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Mon Dec 15 15:32:37 2008 +0000
-+++ openjdk/hotspot/src/share/vm/ci/ciInstanceKlass.cpp	Thu Mar 05 11:48:56 2009 +0000
-@@ -548,3 +548,14 @@
-   }
-   return impl;
- }
-+
-+#ifdef SHARK
-+// ------------------------------------------------------------------
-+// ciInstanceKlass::is_cache_entry_resolved
-+//
-+// Is this entry in the constant pool cache resolved?
-+bool ciInstanceKlass::is_cache_entry_resolved(int index, Bytecodes::Code opcode) {
-+  VM_ENTRY_MARK;
-+  return get_instanceKlass()->constants()->cache()->entry_at(index)->is_resolved(opcode);
-+}
-+#endif // SHARK