changeset 23878:3fc2faf6efc9

Merge
author asaha
date Tue, 22 Mar 2016 21:56:13 -0700
parents 81f376fd8bd4 (current diff) 85d782b2c99b (diff)
children 493ab9e0773f 4fc39d24d00e
files .hgtags
diffstat 11 files changed, 210 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Mon Feb 22 13:39:47 2016 -0800
+++ b/.hgtags	Tue Mar 22 21:56:13 2016 -0700
@@ -820,6 +820,14 @@
 8c791dd1c24d85ebd18b03d49185c2a25263c129 jdk8u75-b07
 e4a935cb6f7178912fd653e2a9514eadec7935ab jdk8u75-b08
 e97c45c377eb8d022cfe24b73737fa312107e0a5 jdk8u75-b09
+d44c7e324682a30e064503ef9582d83a41f4173e jdk8u75-b10
+cc78c97abff85062d6844fa253081e26a0a60150 jdk8u75-b12
+1b6d4fd2730e58f17820930f797938dc182117c4 jdk8u77-b00
+ddd297e340b1170d3cec011ee64e729f8b493c86 jdk8u77-b01
+1b4072e4bb3ad54c4e894998486a8b33f0689160 jdk8u77-b02
+223b64a19e94222dd97b92bb40abcfbc0bf6ef1f jdk8u77-b03
+bbbb05e91c629f8d9eef2ba43933767f68a898b0 jdk8u91-b00
+e36b6ade0499eadfd8673fe62ef0a613af2e6d67 jdk8u91-b13
 d7b01fb81aa8a5437cb03bc36afe15cf0e55fb89 jdk8u76-b00
 c1679cc87ba045219169cabb6b9b378c2b5cc578 jdk8u76-b01
 218483967e52b419d885d34af4488a81c5133804 jdk8u76-b02
@@ -830,3 +838,8 @@
 7d1074c74d6000ec8257917ebfcee3fed4249f7d jdk8u76-b07
 392f8722fc513e28f78c5c563d51af7dc8466b29 jdk8u76-b08
 3bf0f5b8a892defd0bf9731b4e15926881fcda74 jdk8u76-b09
+a2b0ee820059a44be558a2d435b7d85ed5a8b63a jdk8u76-b10
+16aa1f621ec67db1a55ebf6527750164ab63088d jdk8u76-b11
+9a87701e22b3cae79fdfd8cdb732051e02a710fa jdk8u76-b12
+481dcde745b6aec035781ed9f6797cfc93719f71 jdk8u92-b00
+f3e1e734e2d29101a9537ddeb71ecad413fcd352 jdk8u92-b13
--- a/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Mon Feb 22 13:39:47 2016 -0800
+++ b/src/cpu/sparc/vm/sharedRuntime_sparc.cpp	Tue Mar 22 21:56:13 2016 -0700
@@ -1326,9 +1326,12 @@
     }
   } else if (dst.first()->is_stack()) {
     // reg to stack
-    __ st_ptr(src.first()->as_Register(), SP, reg2offset(dst.first()) + STACK_BIAS);
+    // Some compilers (gcc) expect a clean 32 bit value on function entry
+    __ signx(src.first()->as_Register(), L5);
+    __ st_ptr(L5, SP, reg2offset(dst.first()) + STACK_BIAS);
   } else {
-    __ mov(src.first()->as_Register(), dst.first()->as_Register());
+    // Some compilers (gcc) expect a clean 32 bit value on function entry
+    __ signx(src.first()->as_Register(), dst.first()->as_Register());
   }
 }
 
--- a/src/cpu/zero/vm/cppInterpreter_zero.cpp	Mon Feb 22 13:39:47 2016 -0800
+++ b/src/cpu/zero/vm/cppInterpreter_zero.cpp	Tue Mar 22 21:56:13 2016 -0700
@@ -93,6 +93,7 @@
     case T_SHORT:
       return (intptr_t)(jshort)result;
     case T_OBJECT:  // nothing to do fall through
+    case T_ARRAY:
     case T_LONG:
     case T_INT:
     case T_FLOAT:
@@ -183,7 +184,7 @@
     }
     else if (istate->msg() == BytecodeInterpreter::return_from_method) {
       // Copy the result into the caller's frame
-      result_slots = type2size[result_type_of(method)];
+      result_slots = type2size[method->result_type()];
       assert(result_slots >= 0 && result_slots <= 2, "what?");
       result = istate->stack() + result_slots;
       break;
@@ -221,7 +222,7 @@
     // Adjust result to smaller
     intptr_t res = result[-i];
     if (result_slots == 1) {
-      res = narrow(result_type_of(method), res);
+      res = narrow(method->result_type(), res);
     }
     stack->push(res);
   }
@@ -435,7 +436,7 @@
 
   // Push our result
   if (!HAS_PENDING_EXCEPTION) {
-    BasicType type = result_type_of(method);
+    BasicType type = method->result_type();
     stack->set_sp(stack->sp() - type2size[type]);
 
     switch (type) {
@@ -795,26 +796,6 @@
   return i;
 }
 
-BasicType CppInterpreter::result_type_of(Method* method) {
-  BasicType t;
-  switch (method->result_index()) {
-    case 0 : t = T_BOOLEAN; break;
-    case 1 : t = T_CHAR;    break;
-    case 2 : t = T_BYTE;    break;
-    case 3 : t = T_SHORT;   break;
-    case 4 : t = T_INT;     break;
-    case 5 : t = T_LONG;    break;
-    case 6 : t = T_VOID;    break;
-    case 7 : t = T_FLOAT;   break;
-    case 8 : t = T_DOUBLE;  break;
-    case 9 : t = T_OBJECT;  break;
-    default: ShouldNotReachHere();
-  }
-  assert(AbstractInterpreter::BasicType_as_index(t) == method->result_index(),
-         "out of step with AbstractInterpreter::BasicType_as_index");
-  return t;
-}
-
 address InterpreterGenerator::generate_empty_entry() {
   if (!UseFastEmptyMethods)
     return NULL;
--- a/src/cpu/zero/vm/cppInterpreter_zero.hpp	Mon Feb 22 13:39:47 2016 -0800
+++ b/src/cpu/zero/vm/cppInterpreter_zero.hpp	Tue Mar 22 21:56:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2007, 2008, 2010, 2011 Red Hat, Inc.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -49,8 +49,4 @@
   static intptr_t* calculate_unwind_sp(ZeroStack* stack, oop method_handle);
   static void throw_exception(JavaThread* thread, Symbol* name,char *msg=NULL);
 
- private:
-  // Fast result type determination
-  static BasicType result_type_of(Method* method);
-
 #endif // CPU_ZERO_VM_CPPINTERPRETER_ZERO_HPP
--- a/src/share/vm/oops/method.cpp	Mon Feb 22 13:39:47 2016 -0800
+++ b/src/share/vm/oops/method.cpp	Tue Mar 22 21:56:13 2016 -0700
@@ -84,9 +84,6 @@
   set_constMethod(xconst);
   set_access_flags(access_flags);
   set_method_size(size);
-#ifdef CC_INTERP
-  set_result_index(T_VOID);
-#endif
   set_intrinsic_id(vmIntrinsics::_none);
   set_jfr_towrite(false);
   set_force_inline(false);
@@ -412,12 +409,6 @@
   set_size_of_parameters(asc.size() + (is_static() ? 0 : 1));
 }
 
-#ifdef CC_INTERP
-void Method::set_result_index(BasicType type)          {
-  _result_index = Interpreter::BasicType_as_index(type);
-}
-#endif
-
 BasicType Method::result_type() const {
   ResultTypeFinder rtf(signature());
   return rtf.type();
--- a/src/share/vm/oops/method.hpp	Mon Feb 22 13:39:47 2016 -0800
+++ b/src/share/vm/oops/method.hpp	Tue Mar 22 21:56:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -105,9 +105,6 @@
   AccessFlags       _access_flags;               // Access flags
   int               _vtable_index;               // vtable index of this method (see VtableIndexFlag)
                                                  // note: can have vtables with >2**16 elements (because of inheritance)
-#ifdef CC_INTERP
-  int               _result_index;               // C++ interpreter needs for converting results to/from stack
-#endif
   u2                _method_size;                // size of this object
   u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
   u1                _jfr_towrite          : 1,   // Flags
@@ -202,11 +199,6 @@
     return constMethod()->type_annotations();
   }
 
-#ifdef CC_INTERP
-  void set_result_index(BasicType type);
-  int  result_index()                            { return _result_index; }
-#endif
-
   // Helper routine: get klass name + "." + method name + signature as
   // C string, for the purpose of providing more useful NoSuchMethodErrors
   // and fatal error handling. The string is allocated in resource
@@ -559,7 +551,6 @@
   void compute_size_of_parameters(Thread *thread); // word size of parameters (receiver if any + arguments)
   Symbol* klass_name() const;                    // returns the name of the method holder
   BasicType result_type() const;                 // type of the method result
-  int result_type_index() const;                 // type index of the method result
   bool is_returning_oop() const                  { BasicType r = result_type(); return (r == T_OBJECT || r == T_ARRAY); }
   bool is_returning_fp() const                   { BasicType r = result_type(); return (r == T_FLOAT || r == T_DOUBLE); }
 
@@ -652,9 +643,6 @@
   // interpreter support
   static ByteSize const_offset()                 { return byte_offset_of(Method, _constMethod       ); }
   static ByteSize access_flags_offset()          { return byte_offset_of(Method, _access_flags      ); }
-#ifdef CC_INTERP
-  static ByteSize result_index_offset()          { return byte_offset_of(Method, _result_index ); }
-#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); }
   static ByteSize method_data_offset()           {
--- a/src/share/vm/oops/typeArrayOop.hpp	Mon Feb 22 13:39:47 2016 -0800
+++ b/src/share/vm/oops/typeArrayOop.hpp	Tue Mar 22 21:56:13 2016 -0700
@@ -96,7 +96,7 @@
   void byte_at_put(int which, jbyte contents)     { *byte_at_addr(which) = contents; }
 
   jboolean bool_at(int which) const               { return *bool_at_addr(which); }
-  void bool_at_put(int which, jboolean contents)  { *bool_at_addr(which) = contents; }
+  void bool_at_put(int which, jboolean contents)  { *bool_at_addr(which) = (((jint)contents) & 1); }
 
   jchar char_at(int which) const                  { return *char_at_addr(which); }
   void char_at_put(int which, jchar contents)     { *char_at_addr(which) = contents; }
--- a/src/share/vm/runtime/deoptimization.cpp	Mon Feb 22 13:39:47 2016 -0800
+++ b/src/share/vm/runtime/deoptimization.cpp	Tue Mar 22 21:56:13 2016 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2016, 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
@@ -847,13 +847,25 @@
       _obj->int_field_put(offset, (jint)*((jint*)&val));
       break;
 
-    case T_SHORT: case T_CHAR: // 2 bytes
+    case T_SHORT:
       assert(value->type() == T_INT, "Agreement.");
       val = value->get_int();
       _obj->short_field_put(offset, (jshort)*((jint*)&val));
       break;
 
-    case T_BOOLEAN: case T_BYTE: // 1 byte
+    case T_CHAR:
+      assert(value->type() == T_INT, "Agreement.");
+      val = value->get_int();
+      _obj->char_field_put(offset, (jchar)*((jint*)&val));
+      break;
+
+    case T_BYTE:
+      assert(value->type() == T_INT, "Agreement.");
+      val = value->get_int();
+      _obj->byte_field_put(offset, (jbyte)*((jint*)&val));
+      break;
+
+    case T_BOOLEAN:
       assert(value->type() == T_INT, "Agreement.");
       val = value->get_int();
       _obj->bool_field_put(offset, (jboolean)*((jint*)&val));
@@ -899,13 +911,25 @@
       obj->int_at_put(index, (jint)*((jint*)&val));
       break;
 
-    case T_SHORT: case T_CHAR: // 2 bytes
+    case T_SHORT:
       assert(value->type() == T_INT, "Agreement.");
       val = value->get_int();
       obj->short_at_put(index, (jshort)*((jint*)&val));
       break;
 
-    case T_BOOLEAN: case T_BYTE: // 1 byte
+    case T_CHAR:
+      assert(value->type() == T_INT, "Agreement.");
+      val = value->get_int();
+      obj->char_at_put(index, (jchar)*((jint*)&val));
+      break;
+
+    case T_BYTE:
+      assert(value->type() == T_INT, "Agreement.");
+      val = value->get_int();
+      obj->byte_at_put(index, (jbyte)*((jint*)&val));
+      break;
+
+    case T_BOOLEAN:
       assert(value->type() == T_INT, "Agreement.");
       val = value->get_int();
       obj->bool_at_put(index, (jboolean)*((jint*)&val));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/native/TestDirtyInt.java	Tue Mar 22 21:56:13 2016 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * 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.
+ */
+
+public class TestDirtyInt {
+    static {
+        System.loadLibrary("TestDirtyInt");
+    }
+
+    native static int test(int v);
+
+    static int compiled(int v) {
+        return test(v<<2);
+    }
+
+    static public void main(String[] args) {
+        for (int i = 0; i < 20000; i++) {
+            int res = compiled(Integer.MAX_VALUE);
+            if (res != 0x42) {
+                throw new RuntimeException("Test failed");
+            }
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/native/TestDirtyInt.sh	Tue Mar 22 21:56:13 2016 -0700
@@ -0,0 +1,80 @@
+#!/bin/sh
+
+#
+#  Copyright (c) 2016, 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
+#  under the terms of the GNU General Public License version 2 only, as
+#  published by the Free Software Foundation.
+#
+#  This code is distributed in the hope that it will be useful, but WITHOUT
+#  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+#  FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+#  version 2 for more details (a copy is included in the LICENSE file that
+#  accompanied this code).
+#
+#  You should have received a copy of the GNU General Public License version
+#  2 along with this work; if not, write to the Free Software Foundation,
+#  Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+#  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.
+#
+
+##
+## @test
+## @bug 8148353
+## @summary gcc on sparc expects clean 32 bit int in 64 bit register on function entry
+## @run shell/timeout=30 TestDirtyInt.sh
+##
+
+if [ "${TESTSRC}" = "" ]
+then
+  TESTSRC=${PWD}
+  echo "TESTSRC not set.  Using "${TESTSRC}" as default"
+fi
+echo "TESTSRC=${TESTSRC}"
+## Adding common setup Variables for running shell tests.
+. ${TESTSRC}/../../test_env.sh
+
+# set platform-dependent variables
+if [ $VM_OS == "linux" -a $VM_CPU == "sparcv9" ]; then
+    echo "Testing on linux-sparc"
+    gcc_cmd=`which gcc`
+    if [ "x$gcc_cmd" == "x" ]; then
+        echo "WARNING: gcc not found. Cannot execute test." 2>&1
+        exit 0;
+    fi
+else
+    echo "Test passed; only valid for linux-sparc"
+    exit 0;
+fi
+
+THIS_DIR=.
+
+cp ${TESTSRC}${FS}*.java ${THIS_DIR}
+${TESTJAVA}${FS}bin${FS}javac *.java
+
+$gcc_cmd -O1 -DLINUX -fPIC -shared \
+    -o ${TESTSRC}${FS}libTestDirtyInt.so \
+    -I${TESTJAVA}${FS}include \
+    -I${TESTJAVA}${FS}include${FS}linux \
+    ${TESTSRC}${FS}libTestDirtyInt.c
+
+# run the java test in the background
+cmd="${TESTJAVA}${FS}bin${FS}java \
+    -Djava.library.path=${TESTSRC}${FS} TestDirtyInt"
+
+echo "$cmd"
+eval $cmd 
+
+if [ $? = 0 ]
+then
+    echo "Test Passed"
+    exit 0
+fi
+
+echo "Test Failed"
+exit 1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/compiler/native/libTestDirtyInt.c	Tue Mar 22 21:56:13 2016 -0700
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016, 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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * 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 "jni.h"
+#include <stdio.h>
+
+static int array = 0x42;
+
+JNIEXPORT jint JNICALL Java_TestDirtyInt_test(JNIEnv* env, jclass jclazz, jint v)
+{
+  int* ptr = &array + v + 4;
+  return *ptr;
+}