changeset 484:ad665697620c

meth: remove a bunch more dead code (CMH, MTF)
author jrose
date Tue, 17 Jul 2012 05:23:18 -0700
parents c489641155e3
children 9717ee54c9f5
files meth-lazy-7023639.review.patch
diffstat 1 files changed, 300 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/meth-lazy-7023639.review.patch	Tue Jul 17 11:59:30 2012 +0200
+++ b/meth-lazy-7023639.review.patch	Tue Jul 17 05:23:18 2012 -0700
@@ -1,6 +1,50 @@
 # HG changeset patch
 # Parent 80f2a5825abb717dc55c38358758a373258beadd
 
+diff --git a/src/cpu/zero/vm/cppInterpreter_zero.cpp b/src/cpu/zero/vm/cppInterpreter_zero.cpp
+--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp
++++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp
+@@ -646,16 +646,15 @@
+   oop method_type = (oop) p;
+ 
+   // The MethodHandle is in the slot after the arguments
+-  oop form = java_lang_invoke_MethodType::form(method_type);
+-  int num_vmslots = java_lang_invoke_MethodTypeForm::vmslots(form);
+-  assert(argument_slots == num_vmslots + 1, "should be");
++  int num_vmslots = argument_slots - 1;
+   oop method_handle = VMSLOTS_OBJECT(num_vmslots);
+ 
+   // InvokeGeneric requires some extra shuffling
+   oop mhtype = java_lang_invoke_MethodHandle::type(method_handle);
+   bool is_exact = mhtype == method_type;
+   if (!is_exact) {
+-    if (method->intrinsic_id() == vmIntrinsics::_invokeExact) {
++    if (true || // FIXME
++        method->intrinsic_id() == vmIntrinsics::_invokeExact) {
+       CALL_VM_NOCHECK_NOFIX(
+         SharedRuntime::throw_WrongMethodTypeException(
+           thread, method_type, mhtype));
+@@ -670,8 +669,8 @@
+     // NB the x86 code for this (in methodHandles_x86.cpp, search for
+     // "genericInvoker") is really really odd.  I'm hoping it's trying
+     // to accomodate odd VM/class library combinations I can ignore.
+-    oop adapter = java_lang_invoke_MethodTypeForm::genericInvoker(form);
+-    if (adapter == NULL) {
++    oop adapter = NULL; //FIXME: load the adapter from the CP cache
++    IF (adapter == NULL) {
+       CALL_VM_NOCHECK_NOFIX(
+         SharedRuntime::throw_WrongMethodTypeException(
+           thread, method_type, mhtype));
+@@ -1179,8 +1178,7 @@
+ intptr_t* CppInterpreter::calculate_unwind_sp(ZeroStack* stack,
+                                               oop method_handle) {
+   oop method_type = java_lang_invoke_MethodHandle::type(method_handle);
+-  oop form = java_lang_invoke_MethodType::form(method_type);
+-  int argument_slots = java_lang_invoke_MethodTypeForm::vmslots(form);
++  int argument_slots = java_lang_invoke_MethodType::ptype_slot_count(method_type);
+ 
+   return stack->sp() + argument_slots;
+ }
 diff --git a/src/share/vm/ci/ciSignature.hpp b/src/share/vm/ci/ciSignature.hpp
 --- a/src/share/vm/ci/ciSignature.hpp
 +++ b/src/share/vm/ci/ciSignature.hpp
@@ -73,6 +117,250 @@
    }
    java_lang_StackTraceElement::set_lineNumber(element(), line_number);
  
+@@ -2402,8 +2407,6 @@
+ 
+ int java_lang_invoke_LambdaForm::_vmentry_offset;
+ 
+-int java_lang_invoke_CountingMethodHandle::_vmcount_offset;
+-
+ void java_lang_invoke_MethodHandle::compute_offsets() {
+   klassOop klass_oop = SystemDictionary::MethodHandle_klass();
+   if (klass_oop != NULL && EnableInvokeDynamic) {
+@@ -2433,23 +2436,6 @@
+   }
+ }
+ 
+-void java_lang_invoke_CountingMethodHandle::compute_offsets() {
+-  klassOop k = SystemDictionary::CountingMethodHandle_klass();
+-  if (k != NULL && EnableInvokeDynamic) {
+-    compute_offset(_vmcount_offset, k, vmSymbols::vmcount_name(), vmSymbols::int_signature(), true);
+-  }
+-}
+-
+-int java_lang_invoke_CountingMethodHandle::vmcount(oop mh) {
+-  assert(is_instance(mh), "CMH only");
+-  return mh->int_field(_vmcount_offset);
+-}
+-
+-void java_lang_invoke_CountingMethodHandle::set_vmcount(oop mh, int count) {
+-  assert(is_instance(mh), "CMH only");
+-  mh->int_field_put(_vmcount_offset, count);
+-}
+-
+ oop java_lang_invoke_MethodHandle::type(oop mh) {
+   return mh->obj_field(_type_offset);
+ }
+@@ -2558,14 +2544,12 @@
+ 
+ int java_lang_invoke_MethodType::_rtype_offset;
+ int java_lang_invoke_MethodType::_ptypes_offset;
+-int java_lang_invoke_MethodType::_form_offset;
+ 
+ void java_lang_invoke_MethodType::compute_offsets() {
+   klassOop k = SystemDictionary::MethodType_klass();
+   if (k != NULL) {
+     compute_offset(_rtype_offset,  k, vmSymbols::rtype_name(),  vmSymbols::class_signature());
+     compute_offset(_ptypes_offset, k, vmSymbols::ptypes_name(), vmSymbols::class_array_signature());
+-    compute_offset(_form_offset,   k, vmSymbols::form_name(),   vmSymbols::java_lang_invoke_MethodTypeForm_signature());
+   }
+ }
+ 
+@@ -2618,11 +2602,6 @@
+   return (objArrayOop) mt->obj_field(_ptypes_offset);
+ }
+ 
+-oop java_lang_invoke_MethodType::form(oop mt) {
+-  assert(is_instance(mt), "must be a MethodType");
+-  return mt->obj_field(_form_offset);
+-}
+-
+ oop java_lang_invoke_MethodType::ptype(oop mt, int idx) {
+   return ptypes(mt)->obj_at(idx);
+ }
+@@ -2631,25 +2610,20 @@
+   return ptypes(mt)->length();
+ }
+ 
+-oop java_lang_invoke_MethodType::basic_type(oop mt) {
+-  return java_lang_invoke_MethodTypeForm::basicType(form(mt));
++int java_lang_invoke_MethodType::ptype_slot_count(oop mt) {
++  objArrayOop pts = ptypes(mt);
++  int count = pts->length();
++  int slots = 0;
++  for (int i = 0; i < count; i++) {
++    BasicType bt = java_lang_Class::as_BasicType(pts->obj_at(i));
++    slots += type2size[bt];
++  }
++  return slots;
+ }
+ 
+-
+-// Support for java_lang_invoke_MethodTypeForm
+-
+-int java_lang_invoke_MethodTypeForm::_basicType_offset;
+-
+-void java_lang_invoke_MethodTypeForm::compute_offsets() {
+-  klassOop k = SystemDictionary::MethodTypeForm_klass();
+-  if (k != NULL && EnableInvokeDynamic) {
+-    compute_offset(_basicType_offset, k, vmSymbols::basicType_name(), vmSymbols::java_lang_invoke_MethodType_signature());
+-  }
+-}
+-
+-oop java_lang_invoke_MethodTypeForm::basicType(oop mtform) {
+-  assert(mtform->klass() == SystemDictionary::MethodTypeForm_klass(), "MTForm only");
+-  return mtform->obj_field(_basicType_offset);
++int java_lang_invoke_MethodType::rtype_slot_count(oop mt) {
++  BasicType bt = java_lang_Class::as_BasicType(rtype(mt));
++  return type2size[bt];
+ }
+ 
+ 
+@@ -3015,9 +2989,7 @@
+     java_lang_invoke_MemberName::compute_offsets();
+     java_lang_invoke_LambdaForm::compute_offsets();
+     java_lang_invoke_MethodType::compute_offsets();
+-    java_lang_invoke_MethodTypeForm::compute_offsets();
+     java_lang_invoke_CallSite::compute_offsets();
+-    java_lang_invoke_CountingMethodHandle::compute_offsets();
+   }
+   java_security_AccessControlContext::compute_offsets();
+   // Initialize reflection classes. The layouts of these classes
+diff --git a/src/share/vm/classfile/javaClasses.hpp b/src/share/vm/classfile/javaClasses.hpp
+--- a/src/share/vm/classfile/javaClasses.hpp
++++ b/src/share/vm/classfile/javaClasses.hpp
+@@ -915,34 +915,6 @@
+   static int form_offset_in_bytes()             { return _form_offset; }
+ };
+ 
+-// A simple class that maintains an invocation count
+-class java_lang_invoke_CountingMethodHandle: public java_lang_invoke_MethodHandle {
+-  friend class JavaClasses;
+-
+- private:
+-  static int _vmcount_offset;
+-  static void compute_offsets();
+-
+- public:
+-  // Accessors
+-  static int            vmcount(oop mh);
+-  static void       set_vmcount(oop mh, int count);
+-
+-  // Testers
+-  static bool is_subclass(klassOop klass) {
+-    return SystemDictionary::CountingMethodHandle_klass() != NULL &&
+-      Klass::cast(klass)->is_subclass_of(SystemDictionary::CountingMethodHandle_klass());
+-  }
+-  static bool is_instance(oop obj) {
+-    return obj != NULL && is_subclass(obj->klass());
+-  }
+-
+-  // Accessors for code generation:
+-  static int vmcount_offset_in_bytes()          { return _vmcount_offset; }
+-};
+-
+-
+-
+ // Interface to java.lang.invoke.LambdaForm objects
+ // (These are a private interface for managing adapter code generation.)
+ 
+@@ -1059,7 +1031,6 @@
+  private:
+   static int _rtype_offset;
+   static int _ptypes_offset;
+-  static int _form_offset;
+ 
+   static void compute_offsets();
+ 
+@@ -1067,11 +1038,13 @@
+   // Accessors
+   static oop            rtype(oop mt);
+   static objArrayOop    ptypes(oop mt);
+-  static oop            form(oop mt);
+ 
+   static oop            ptype(oop mt, int index);
+   static int            ptype_count(oop mt);
+ 
++  static int            ptype_slot_count(oop mt);  // extra counts for long/double
++  static int            rtype_slot_count(oop mt);  // extra counts for long/double
++
+   static Symbol*        as_signature(oop mt, bool intern_if_not_found, TRAPS);
+   static void           print_signature(oop mt, outputStream* st);
+ 
+@@ -1081,44 +1054,9 @@
+ 
+   static bool equals(oop mt1, oop mt2);
+ 
+-  static oop basic_type(oop mt);  // java_lang_invoke_MethodTypeForm::basicType(form(mt))
+-  static bool same_basic_type(oop mt1, oop mt2) {
+-    return equals(basic_type(mt1), basic_type(mt2));
+-  }
+-
+   // Accessors for code generation:
+   static int rtype_offset_in_bytes()            { return _rtype_offset; }
+   static int ptypes_offset_in_bytes()           { return _ptypes_offset; }
+-  static int form_offset_in_bytes()             { return _form_offset; }
+-};
+-
+-class java_lang_invoke_MethodTypeForm: AllStatic {
+-  friend class JavaClasses;
+-
+- private:
+-  static int _vmslots_offset;           // number of argument slots needed
+-  static int _vmlayout_offset;          // object describing internal calling sequence
+-  static int _basicType_offset;         // basicType = canonical MethodType (normalizing subwords)
+-  static int _genericInvoker_offset;    // genericInvoker = adapter for invokeGeneric
+-
+-  static void compute_offsets();
+-
+- public:
+-  // Accessors
+-  static int            vmslots(oop mtform);
+-  static void       set_vmslots(oop mtform, int vmslots);
+-
+-  static oop            basicType(oop mtform);
+-  static oop            genericInvoker(oop mtform);
+-
+-  static oop            vmlayout(oop mtform);
+-  static oop       init_vmlayout(oop mtform, oop cookie);
+-
+-  // Accessors for code generation:
+-  static int vmslots_offset_in_bytes()          { return _vmslots_offset; }
+-  static int vmlayout_offset_in_bytes()         { return _vmlayout_offset; }
+-  static int basicType_offset_in_bytes()        { return _basicType_offset; }
+-  static int genericInvoker_offset_in_bytes()   { return _genericInvoker_offset; }
+ };
+ 
+ 
+diff --git a/src/share/vm/classfile/systemDictionary.hpp b/src/share/vm/classfile/systemDictionary.hpp
+--- a/src/share/vm/classfile/systemDictionary.hpp
++++ b/src/share/vm/classfile/systemDictionary.hpp
+@@ -149,10 +149,8 @@
+   template(MethodHandleNatives_klass,      java_lang_invoke_MethodHandleNatives,      Pre_JSR292) \
+   template(LambdaForm_klass,               java_lang_invoke_LambdaForm,               Opt)        \
+   template(MethodType_klass,               java_lang_invoke_MethodType,               Pre_JSR292) \
+-  template(MethodTypeForm_klass,           java_lang_invoke_MethodTypeForm,           Pre_JSR292) \
+   template(BootstrapMethodError_klass,     java_lang_BootstrapMethodError,            Pre_JSR292) \
+   template(CallSite_klass,                 java_lang_invoke_CallSite,                 Pre_JSR292) \
+-  template(CountingMethodHandle_klass,     java_lang_invoke_CountingMethodHandle,     Opt)        \
+   template(ConstantCallSite_klass,         java_lang_invoke_ConstantCallSite,         Pre_JSR292) \
+   template(MutableCallSite_klass,          java_lang_invoke_MutableCallSite,          Pre_JSR292) \
+   template(VolatileCallSite_klass,         java_lang_invoke_VolatileCallSite,         Pre_JSR292) \
+diff --git a/src/share/vm/classfile/vmSymbols.hpp b/src/share/vm/classfile/vmSymbols.hpp
+--- a/src/share/vm/classfile/vmSymbols.hpp
++++ b/src/share/vm/classfile/vmSymbols.hpp
+@@ -249,12 +249,9 @@
+   template(java_lang_invoke_LambdaForm_signature,     "Ljava/lang/invoke/LambdaForm;")            \
+   template(java_lang_invoke_MethodHandle_signature,   "Ljava/lang/invoke/MethodHandle;")          \
+   /* internal classes known only to the JVM: */                                                   \
+-  template(java_lang_invoke_MethodTypeForm,           "java/lang/invoke/MethodTypeForm")          \
+-  template(java_lang_invoke_MethodTypeForm_signature, "Ljava/lang/invoke/MethodTypeForm;")        \
+   template(java_lang_invoke_MemberName,               "java/lang/invoke/MemberName")              \
+   template(java_lang_invoke_MethodHandleNatives,      "java/lang/invoke/MethodHandleNatives")     \
+   template(java_lang_invoke_LambdaForm,               "java/lang/invoke/LambdaForm")              \
+-  template(java_lang_invoke_CountingMethodHandle,     "java/lang/invoke/CountingMethodHandle")    \
+   template(java_lang_invoke_ForceInline_signature,    "Ljava/lang/invoke/ForceInline;")           \
+   template(java_lang_invoke_DontInline_signature,     "Ljava/lang/invoke/DontInline;")            \
+   template(java_lang_invoke_LambdaForm_Compiled_signature, "Ljava/lang/invoke/LambdaForm$Compiled;") \
 diff --git a/src/share/vm/oops/methodOop.cpp b/src/share/vm/oops/methodOop.cpp
 --- a/src/share/vm/oops/methodOop.cpp
 +++ b/src/share/vm/oops/methodOop.cpp
@@ -167,10 +455,13 @@
 diff --git a/src/share/vm/prims/methodHandles.cpp b/src/share/vm/prims/methodHandles.cpp
 --- a/src/share/vm/prims/methodHandles.cpp
 +++ b/src/share/vm/prims/methodHandles.cpp
-@@ -473,6 +473,76 @@
-   return java_lang_invoke_MethodTypeForm::basicType(form);
+@@ -468,11 +468,76 @@
+   return bsig;
  }
  
+-oop MethodHandles::method_type_basic_type(oop method_type) {
+-  oop form = java_lang_invoke_MethodType::form(method_type);
+-  return java_lang_invoke_MethodTypeForm::basicType(form);
 +void MethodHandles::print_as_basic_type_signature_on(outputStream* st,
 +                                                     Symbol* sig,
 +                                                     bool keep_arrays,
@@ -237,8 +528,8 @@
 +    }
 +    array = 0;
 +  }
-+}
-+
+ }
+ 
 +
 +
  static oop object_java_mirror() {
@@ -247,8 +538,11 @@
 diff --git a/src/share/vm/prims/methodHandles.hpp b/src/share/vm/prims/methodHandles.hpp
 --- a/src/share/vm/prims/methodHandles.hpp
 +++ b/src/share/vm/prims/methodHandles.hpp
-@@ -144,6 +144,11 @@
-   static oop method_type_basic_type(oop method_type);
+@@ -141,9 +141,13 @@
+   }
+   static bool is_basic_type_signature(Symbol* sig);
+ 
+-  static oop method_type_basic_type(oop method_type);
    static Symbol* lookup_method_type(Symbol* msig, Handle mtype, TRAPS);
  
 +  static void print_as_method_type_on(outputStream* st, Symbol* sig) {