8151130: [BACKOUT] Remove Method::_method_data for C1
authorthartmann
Thu, 03 Mar 2016 13:18:53 +0100
changeset 36350 29d8bb1668f5
parent 36349 6cc8e6f596b2
child 36352 4f47e3c0969f
child 36557 b017bd9fb598
8151130: [BACKOUT] Remove Method::_method_data for C1 Summary: Backing out the fix for JDK-8147978 because it fails and blocks integration. Reviewed-by: vlivanov, zmajo
hotspot/src/share/vm/c1/c1_Runtime1.cpp
hotspot/src/share/vm/oops/method.cpp
hotspot/src/share/vm/oops/method.hpp
hotspot/src/share/vm/runtime/arguments.cpp
hotspot/src/share/vm/runtime/vmStructs.cpp
hotspot/src/share/vm/utilities/macros.hpp
--- a/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Wed Mar 02 15:42:03 2016 +0300
+++ b/hotspot/src/share/vm/c1/c1_Runtime1.cpp	Thu Mar 03 13:18:53 2016 +0100
@@ -1502,23 +1502,21 @@
   nm->make_not_entrant();
 
   methodHandle m(nm->method());
-  if (ProfileInterpreter) {
-    MethodData* mdo = m->method_data();
+  MethodData* mdo = m->method_data();
 
-    if (mdo == NULL && !HAS_PENDING_EXCEPTION) {
-      // Build an MDO.  Ignore errors like OutOfMemory;
-      // that simply means we won't have an MDO to update.
-      Method::build_interpreter_method_data(m, THREAD);
-      if (HAS_PENDING_EXCEPTION) {
-        assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
-        CLEAR_PENDING_EXCEPTION;
-      }
-      mdo = m->method_data();
+  if (mdo == NULL && !HAS_PENDING_EXCEPTION) {
+    // Build an MDO.  Ignore errors like OutOfMemory;
+    // that simply means we won't have an MDO to update.
+    Method::build_interpreter_method_data(m, THREAD);
+    if (HAS_PENDING_EXCEPTION) {
+      assert((PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())), "we expect only an OOM error here");
+      CLEAR_PENDING_EXCEPTION;
     }
+    mdo = m->method_data();
+  }
 
-    if (mdo != NULL) {
-      mdo->inc_trap_count(Deoptimization::Reason_none);
-    }
+  if (mdo != NULL) {
+    mdo->inc_trap_count(Deoptimization::Reason_none);
   }
 
   if (TracePredicateFailedTraps) {
--- a/hotspot/src/share/vm/oops/method.cpp	Wed Mar 02 15:42:03 2016 +0300
+++ b/hotspot/src/share/vm/oops/method.cpp	Thu Mar 03 13:18:53 2016 +0100
@@ -383,15 +383,14 @@
   MutexLocker ml(MethodData_lock, THREAD);
   if (method->method_data() == NULL) {
     ClassLoaderData* loader_data = method->method_holder()->class_loader_data();
-#if defined(COMPILER2) || INCLUDE_JVMCI
     MethodData* method_data = MethodData::allocate(loader_data, method, THREAD);
     if (HAS_PENDING_EXCEPTION) {
       CompileBroker::log_metaspace_failure();
       ClassLoaderDataGraph::set_metaspace_oom(true);
       return;   // return the exception (which is cleared)
     }
+
     method->set_method_data(method_data);
-#endif
     if (PrintMethodData && (Verbose || WizardMode)) {
       ResourceMark rm(THREAD);
       tty->print("build_interpreter_method_data for ");
@@ -921,7 +920,7 @@
   // shared class that failed to load, this->link_method() may
   // have already been called (before an exception happened), so
   // this->_method_data may not be NULL.
-  assert(!DumpSharedSpaces || method_data() == NULL, "unexpected method data?");
+  assert(!DumpSharedSpaces || _method_data == NULL, "unexpected method data?");
 
   set_method_data(NULL);
   clear_method_counters();
--- a/hotspot/src/share/vm/oops/method.hpp	Wed Mar 02 15:42:03 2016 +0300
+++ b/hotspot/src/share/vm/oops/method.hpp	Thu Mar 03 13:18:53 2016 +0100
@@ -64,9 +64,7 @@
  friend class JVMCIVMStructs;
  private:
   ConstMethod*      _constMethod;                // Method read-only data.
-#if defined(COMPILER2) || INCLUDE_JVMCI
   MethodData*       _method_data;
-#endif
   MethodCounters*   _method_counters;
   AccessFlags       _access_flags;               // Access flags
   int               _vtable_index;               // vtable index of this method (see VtableIndexFlag)
@@ -321,7 +319,6 @@
   // InterpreterRuntime::exception_handler_for_exception.
   static int fast_exception_handler_bci_for(methodHandle mh, KlassHandle ex_klass, int throw_bci, TRAPS);
 
-#if defined(COMPILER2) || INCLUDE_JVMCI
   // method data access
   MethodData* method_data() const              {
     return _method_data;
@@ -333,10 +330,6 @@
     // the initialization of data otherwise.
     OrderAccess::release_store_ptr((volatile void *)&_method_data, data);
   }
-#else
-  MethodData* method_data() const              { return NULL; }
-  void set_method_data(MethodData* data)       { }
-#endif
 
   MethodCounters* method_counters() const {
     return _method_counters;
@@ -646,16 +639,9 @@
 #endif /* CC_INTERP */
   static ByteSize from_compiled_offset()         { return byte_offset_of(Method, _from_compiled_entry); }
   static ByteSize code_offset()                  { return byte_offset_of(Method, _code); }
-#if defined(COMPILER2) || INCLUDE_JVMCI
   static ByteSize method_data_offset()           {
     return byte_offset_of(Method, _method_data);
   }
-#else
-  static ByteSize method_data_offset()           {
-    ShouldNotReachHere();
-    return in_ByteSize(0);
-  }
-#endif
   static ByteSize method_counters_offset()       {
     return byte_offset_of(Method, _method_counters);
   }
@@ -668,11 +654,7 @@
   static ByteSize signature_handler_offset()     { return in_ByteSize(sizeof(Method) + wordSize);      }
 
   // for code generation
-#if defined(COMPILER2) || INCLUDE_JVMCI
   static int method_data_offset_in_bytes()       { return offset_of(Method, _method_data); }
-#else
-  static int method_data_offset_in_bytes()       { ShouldNotReachHere(); return 0; }
-#endif
   static int intrinsic_id_offset_in_bytes()      { return offset_of(Method, _intrinsic_id); }
   static int intrinsic_id_size_in_bytes()        { return sizeof(u2); }
 
--- a/hotspot/src/share/vm/runtime/arguments.cpp	Wed Mar 02 15:42:03 2016 +0300
+++ b/hotspot/src/share/vm/runtime/arguments.cpp	Thu Mar 03 13:18:53 2016 +0100
@@ -3464,12 +3464,6 @@
   }
 #endif
 
-#if !defined(COMPILER2) && !INCLUDE_JVMCI
-  UNSUPPORTED_OPTION(ProfileInterpreter, "ProfileInterpreter");
-  NOT_PRODUCT(UNSUPPORTED_OPTION(TraceProfileInterpreter, "TraceProfileInterpreter"));
-  UNSUPPORTED_OPTION(PrintMethodData, "PrintMethodData");
-#endif
-
 #ifndef TIERED
   // Tiered compilation is undefined.
   UNSUPPORTED_OPTION(TieredCompilation, "TieredCompilation");
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp	Wed Mar 02 15:42:03 2016 +0300
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp	Thu Mar 03 13:18:53 2016 +0100
@@ -390,7 +390,7 @@
   nonstatic_field(MethodCounters,              _invocation_counter,                           InvocationCounter)                     \
   nonstatic_field(MethodCounters,              _backedge_counter,                             InvocationCounter)                     \
   nonstatic_field(Method,                      _constMethod,                                  ConstMethod*)                          \
-  COMPILER2_OR_JVMCI_PRESENT(nonstatic_field(Method, _method_data,                            MethodData*))                          \
+  nonstatic_field(Method,                      _method_data,                                  MethodData*)                           \
   nonstatic_field(Method,                      _method_counters,                              MethodCounters*)                       \
   nonstatic_field(Method,                      _access_flags,                                 AccessFlags)                           \
   nonstatic_field(Method,                      _vtable_index,                                 int)                                   \
--- a/hotspot/src/share/vm/utilities/macros.hpp	Wed Mar 02 15:42:03 2016 +0300
+++ b/hotspot/src/share/vm/utilities/macros.hpp	Thu Mar 03 13:18:53 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -206,15 +206,6 @@
 #define NOT_COMPILER2(code) code
 #endif // COMPILER2
 
-// COMPILER2 or JVMCI
-#if defined(COMPILER2) || INCLUDE_JVMCI
-#define COMPILER2_OR_JVMCI_PRESENT(code) code
-#define NOT_COMPILER2_OR_JVMCI(code)
-#else
-#define COMPILER2_OR_JVMCI_PRESENT(code)
-#define NOT_COMPILER2_OR_JVMCI(code) code
-#endif
-
 #ifdef TIERED
 #define TIERED_ONLY(code) code
 #define NOT_TIERED(code)