changeset 4978:99d3d8a72252

More ifdef GRAAL usage.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Mon, 27 Feb 2012 18:31:27 +0100
parents 532be189cf09
children 18a5539bf19b
files src/share/vm/runtime/deoptimization.cpp src/share/vm/utilities/exceptions.cpp
diffstat 2 files changed, 50 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/runtime/deoptimization.cpp	Mon Feb 27 17:06:18 2012 +0100
+++ b/src/share/vm/runtime/deoptimization.cpp	Mon Feb 27 18:31:27 2012 +0100
@@ -19,6 +19,7 @@
  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  * or visit www.oracle.com if you need additional information or have any
  * questions.
+ *
  */
 
 #include "precompiled.hpp"
@@ -166,6 +167,7 @@
     tty->print("Deoptimization "); 
   }
   thread->inc_in_deopt_handler();
+
   return fetch_unroll_info_helper(thread);
 JRT_END
 
@@ -209,7 +211,6 @@
   assert(vf->is_compiled_frame(), "Wrong frame type");
   chunk->push(compiledVFrame::cast(vf));
 
-  // TODO(tw): Fix this hack after introducing GRAAL macro.
 #if defined(COMPILER2) || defined(GRAAL)
   // Reallocate the non-escaping objects and restore their fields. Then
   // relock objects if synchronization on them was eliminated.
@@ -746,7 +747,7 @@
 }
 
 
-//#ifdef COMPILER2
+#if defined(COMPILER2) || defined(GRAAL)
 bool Deoptimization::realloc_objects(JavaThread* thread, frame* fr, GrowableArray<ScopeValue*>* objects, TRAPS) {
   Handle pending_exception(thread->pending_exception());
   const char* exception_file = thread->exception_file();
@@ -991,7 +992,7 @@
   }
 }
 #endif
-//#endif // COMPILER2
+#endif // COMPILER2 || GRAAL
 
 vframeArray* Deoptimization::create_vframeArray(JavaThread* thread, frame fr, RegisterMap *reg_map, GrowableArray<compiledVFrame*>* chunk) {
   Events::log(thread, "DEOPT PACKING pc=" INTPTR_FORMAT " sp=" INTPTR_FORMAT, fr.pc(), fr.sp());
@@ -1190,6 +1191,7 @@
 JRT_END
 
 
+#if defined(COMPILER2) || defined(SHARK) || defined(GRAAL)
 void Deoptimization::load_class_by_index(constantPoolHandle constant_pool, int index, TRAPS) {
   // in case of an unresolved klass entry, load the class.
   if (constant_pool->tag_at(index).is_unresolved_klass()) {
@@ -1964,3 +1966,40 @@
     if (xtty != NULL)  xtty->tail("statistics");
   }
 }
+#else // COMPILER2 || SHARK || GRAAL
+
+
+// Stubs for C1 only system.
+bool Deoptimization::trap_state_is_recompiled(int trap_state) {
+  return false;
+}
+
+const char* Deoptimization::trap_reason_name(int reason) {
+  return "unknown";
+}
+
+void Deoptimization::print_statistics() {
+  // no output
+}
+
+void
+Deoptimization::update_method_data_from_interpreter(methodDataHandle trap_mdo, int trap_bci, int reason) {
+  // no udpate
+}
+
+int Deoptimization::trap_state_has_reason(int trap_state, int reason) {
+  return 0;
+}
+
+void Deoptimization::gather_statistics(DeoptReason reason, DeoptAction action,
+                                       Bytecodes::Code bc) {
+  // no update
+}
+
+const char* Deoptimization::format_trap_state(char* buf, size_t buflen,
+                                              int trap_state) {
+  jio_snprintf(buf, buflen, "#%d", trap_state);
+  return buf;
+}
+
+#endif // COMPILER2 || SHARK || GRAAL
--- a/src/share/vm/utilities/exceptions.cpp	Mon Feb 27 17:06:18 2012 +0100
+++ b/src/share/vm/utilities/exceptions.cpp	Mon Feb 27 18:31:27 2012 +0100
@@ -95,8 +95,10 @@
 #endif // ASSERT
 
   if (thread->is_VM_thread()
-	  // TODO(tw): May we do this?
-      /*|| thread->is_Compiler_thread()*/ ) {
+#ifndef GRAAL
+      || thread->is_Compiler_thread()
+#endif
+    ) {
     // We do not care what kind of exception we get for the vm-thread or a thread which
     // is compiling.  We just install a dummy exception object
     thread->set_pending_exception(Universe::vm_exception(), file, line);
@@ -119,8 +121,10 @@
   }
 
   if (thread->is_VM_thread()
-	  // TODO(tw): May we do this?
-     /* || thread->is_Compiler_thread()*/ ) {
+#ifndef GRAAL
+      || thread->is_Compiler_thread()
+#endif
+    ) {
     // We do not care what kind of exception we get for the vm-thread or a thread which
     // is compiling.  We just install a dummy exception object
     thread->set_pending_exception(Universe::vm_exception(), file, line);