applying patches doesn't seem to work

Christian Thalinger Christian.Thalinger at Sun.COM
Mon Oct 5 05:49:10 PDT 2009


On Thu, 2009-10-01 at 05:33 -0700, alan yung wrote:
> Now I have different build problem - build fails with error messages
> in hotspot directory.
> The errors look like following:  (the machine is windows XP)
> 
> 
> C:\cygwin\home\alan\davinci\sources\hotspot\src\share\vm\utilities
> \growableArray.hpp(132) : error C2220: warn
> ing treat
> d as error - no 'object' file generated
>         C:\cygwin\home\alan\davinci\sources\hotspot\src\share\vm
> \utilities\growableArray.hpp(130) : while com
> piling cl
> ss template member function 'GrowableArray<E>::GrowableArray(Thread
> *,int)'
>         with
>         [
>             E=MethodHandleWalker::SlotState
>         ]
>         c:\cygwin\home\alan\davinci\sources\hotspot\src\share\vm\prims
> \methodHandleWalk.hpp(121) : see refere
> nce to cl
> ss template instantiation 'GrowableArray<E>' being compiled
>         with
>         [
>             E=MethodHandleWalker::SlotState
>         ]
> C:\cygwin\home\alan\davinci\sources\hotspot\src\share\vm\utilities
> \growableArray.hpp(132) : warning C4345: be
> havior ch
> nge: an object of POD type constructed with an initializer of the form
> () will be default-initialized

Sorry for the delay.  This seems to be an initialization problem of a
POD type, changing SlotState to a class should fix the problem.

Currently there is an issue with one of our internal servers, which I
need to push my changes upstream.  You could try to apply the attached
patch yourself, but it may not apply cleanly to your repository.

-- Christian


diff --git a/src/share/vm/prims/methodHandleWalk.cpp b/src/share/vm/prims/methodHandleWalk.cpp
--- a/src/share/vm/prims/methodHandleWalk.cpp
+++ b/src/share/vm/prims/methodHandleWalk.cpp
@@ -227,8 +227,8 @@
 
         for (int i = 0, slot = _outgoing.length() - 1; slot >= 0; slot--) {
           SlotState* arg_state = slot_state(slot);
-          if (arg_state->_type == T_VOID)  continue;
-          ArgToken arg = _outgoing.at(slot)._arg;
+          if (arg_state->type() == T_VOID)  continue;
+          ArgToken arg = _outgoing.at(slot).arg();
 
           klassOop  in_klass  = NULL;
           klassOop  out_klass = NULL;
@@ -264,8 +264,8 @@
         klassOop dest_klass = NULL;
         BasicType dest = java_lang_Class::as_BasicType(chain().adapter_arg_oop(), &dest_klass);
         assert(dest == T_OBJECT, "");
-        assert(dest == arg_state->_type, "");
-        arg_state->_arg = make_conversion(T_OBJECT, dest_klass, Bytecodes::_checkcast, arg_state->_arg, CHECK_(empty));
+        assert(dest == arg_state->type(), "");
+        (void) make_conversion(T_OBJECT, dest_klass, Bytecodes::_checkcast, arg_state->arg(), CHECK_(empty));
         debug_only(dest_klass = (klassOop)badOop);
         break;
       }
@@ -275,7 +275,7 @@
         BasicType src = chain().adapter_conversion_src_type(),
                   dest = chain().adapter_conversion_dest_type();
         Bytecodes::Code bc = conversion_code(src, dest);
-        ArgToken arg = arg_state->_arg;
+        ArgToken arg = arg_state->arg();
         if (bc == Bytecodes::_nop) {
           break;
         } else if (bc != Bytecodes::_illegal) {
@@ -298,7 +298,7 @@
       case sun_dyn_AdapterMethodHandle::OP_REF_TO_PRIM: {
         // checkcast to wrapper type & call intValue, etc.
         BasicType dest = chain().adapter_conversion_dest_type();
-        ArgToken arg = arg_state->_arg;
+        ArgToken arg = arg_state->arg();
         arg = make_conversion(T_OBJECT, SystemDictionary::box_klass(dest),
                               Bytecodes::_checkcast, arg, CHECK_(empty));
         vmIntrinsics::ID unboxer = vmIntrinsics::for_unboxing(dest);
@@ -316,7 +316,7 @@
       case sun_dyn_AdapterMethodHandle::OP_PRIM_TO_REF: {
         // call wrapper type.valueOf
         BasicType src = chain().adapter_conversion_src_type();
-        ArgToken arg = arg_state->_arg;
+        ArgToken arg = arg_state->arg();
         vmIntrinsics::ID boxer = vmIntrinsics::for_boxing(src);
         if (boxer == vmIntrinsics::_none) {
           lose("no boxing method", CHECK_(empty));
@@ -351,7 +351,7 @@
         SlotState* dest_arg_state = slot_state(dest_arg_slot);
         // Rotate the source argument (plus following N slots) into the
         // position occupied by the dest argument (plus following N slots).
-        int rotate_count = type2size[dest_arg_state->_type];
+        int rotate_count = type2size[dest_arg_state->type()];
         // (no other rotate counts are currently supported)
         if (arg_slot < dest_arg_slot) {
           for (int i = 0; i < rotate_count; i++) {
@@ -377,7 +377,7 @@
         for (int i = 0; i < dup_slots; i++) {
           SlotState* dup = slot_state(arg_slot + 2*i);
           if (dup == NULL)              break;  // safety net
-          if (dup->_type != T_VOID)     _outgoing_argc += 1;
+          if (dup->type() != T_VOID)    _outgoing_argc += 1;
           _outgoing.at_insert(i, (*dup));
         }
         break;
@@ -391,7 +391,7 @@
         for (int i = 0; i < drop_slots; i++) {
           SlotState* drop = slot_state(arg_slot);
           if (drop == NULL)             break;  // safety net
-          if (drop->_type != T_VOID)    _outgoing_argc -= 1;
+          if (drop->type() != T_VOID)   _outgoing_argc -= 1;
           _outgoing.remove_at(arg_slot);
         }
         break;
@@ -418,8 +418,8 @@
         debug_only(element_klass_oop = (klassOop)badOop);
 
         // Fetch the argument, which we will cast to the required array type.
-        assert(arg_state->_type == T_OBJECT, "");
-        ArgToken array_arg = arg_state->_arg;
+        assert(arg_state->type() == T_OBJECT, "");
+        ArgToken array_arg = arg_state->arg();
         array_arg = make_conversion(T_OBJECT, array_klass(), Bytecodes::_checkcast, array_arg, CHECK_(empty));
         change_argument(T_OBJECT, arg_slot, T_VOID, ArgToken(tt_void));
 
@@ -506,8 +506,8 @@
   int ap = 0;
   for (int i = _outgoing.length() - 1; i >= 0; i--) {
     SlotState* arg_state = slot_state(i);
-    if (arg_state->_type == T_VOID)  continue;
-    arglist[ap++] = _outgoing.at(i)._arg;
+    if (arg_state->type() == T_VOID)  continue;
+    arglist[ap++] = _outgoing.at(i).arg();
   }
   assert(ap == _outgoing_argc, "");
   arglist[ap] = ArgToken();  // add a sentinel, for the sake of asserts
@@ -566,7 +566,7 @@
     _outgoing.at_put(slot, make_state(new_type, new_arg));
   } else if (old_size > new_size) {
     for (int i = old_size - 1; i >= new_size; i--) {
-      assert((i != 0) == (_outgoing.at(slot + i)._type == T_VOID), "");
+      assert((i != 0) == (_outgoing.at(slot + i).type() == T_VOID), "");
       _outgoing.remove_at(slot + i);
     }
     if (new_size > 0)
@@ -587,7 +587,7 @@
 int MethodHandleWalker::argument_count_slow() {
   int args_seen = 0;
   for (int i = _outgoing.length() - 1; i >= 0; i--) {
-    if (_outgoing.at(i)._type != T_VOID) {
+    if (_outgoing.at(i).type() != T_VOID) {
       ++args_seen;
     }
   }
diff --git a/src/share/vm/prims/methodHandleWalk.hpp b/src/share/vm/prims/methodHandleWalk.hpp
--- a/src/share/vm/prims/methodHandleWalk.hpp
+++ b/src/share/vm/prims/methodHandleWalk.hpp
@@ -145,13 +145,21 @@
   };
 
   // Abstract interpretation state:
-  struct SlotState {
+  class SlotState {
+  private:
     BasicType _type;
     ArgToken  _arg;
+
+  public:
+    SlotState() : _type(T_ILLEGAL) {}
+    SlotState(BasicType type, ArgToken arg) : _type(type), _arg(arg) {}
+
+    BasicType type() const { return _type; }
+    ArgToken  arg()  const { return _arg;  }
   };
+
   static SlotState make_state(BasicType type, ArgToken arg) {
-    SlotState ss;
-    ss._type = type; ss._arg = arg;
+    SlotState ss(type, arg);
     return ss;
   }
 
@@ -178,7 +186,7 @@
     SlotState* ss = slot_state(slot);
     if (ss == NULL)
       return T_ILLEGAL;
-    return ss->_type;
+    return ss->type();
   }
   bool slot_has_argument(int slot) {
     return slot_type(slot) < T_VOID;




More information about the mlvm-dev mailing list