Merge
authorlana
Thu, 13 Apr 2017 16:26:36 +0000
changeset 44635 8e526eee3e18
parent 44585 ee03d0fb7aa4 (current diff)
parent 44634 cf2e2a4c3358 (diff)
child 44636 a50cc126180c
Merge
--- a/hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/src/cpu/s390/vm/c1_Runtime1_s390.cpp	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2017 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2016 SAP SE. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
--- a/hotspot/src/share/vm/oops/metadata.hpp	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/src/share/vm/oops/metadata.hpp	Thu Apr 13 16:26:36 2017 +0000
@@ -47,6 +47,7 @@
   virtual bool is_method()             const volatile { return false; }
   virtual bool is_methodData()         const volatile { return false; }
   virtual bool is_constantPool()       const volatile { return false; }
+  virtual bool is_methodCounters()     const volatile { return false; }
 
   virtual const char* internal_name()  const = 0;
 
--- a/hotspot/src/share/vm/oops/methodCounters.cpp	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/src/share/vm/oops/methodCounters.cpp	Thu Apr 13 16:26:36 2017 +0000
@@ -73,3 +73,11 @@
 #endif
 }
 
+
+void MethodCounters::print_value_on(outputStream* st) const {
+  assert(is_methodCounters(), "must be methodCounters");
+  st->print("method counters");
+  print_address_on(st);
+}
+
+
--- a/hotspot/src/share/vm/oops/methodCounters.hpp	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/src/share/vm/oops/methodCounters.hpp	Thu Apr 13 16:26:36 2017 +0000
@@ -30,7 +30,7 @@
 #include "interpreter/invocationCounter.hpp"
 #include "runtime/arguments.hpp"
 
-class MethodCounters: public MetaspaceObj {
+class MethodCounters : public Metadata {
  friend class VMStructs;
  friend class JVMCIVMStructs;
  private:
@@ -109,10 +109,11 @@
   }
 
  public:
+  virtual bool is_methodCounters() const volatile { return true; }
+
   static MethodCounters* allocate(methodHandle mh, TRAPS);
 
   void deallocate_contents(ClassLoaderData* loader_data) {}
-  DEBUG_ONLY(bool on_stack() { return false; })  // for template
 
   AOT_ONLY(Method* method() const { return _method; })
 
@@ -120,8 +121,6 @@
     return align_size_up(sizeof(MethodCounters), wordSize) / wordSize;
   }
 
-  bool is_klass() const { return false; }
-
   void clear_counters();
 
 #if defined(COMPILER2) || INCLUDE_JVMCI
@@ -253,5 +252,9 @@
   static ByteSize backedge_mask_offset() {
     return byte_offset_of(MethodCounters, _backedge_mask);
   }
+
+  virtual const char* internal_name() const { return "{method counters}"; }
+  virtual void print_value_on(outputStream* st) const;
+
 };
 #endif //SHARE_VM_OOPS_METHODCOUNTERS_HPP
--- a/hotspot/src/share/vm/opto/library_call.cpp	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/src/share/vm/opto/library_call.cpp	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2017, 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
@@ -1668,6 +1668,9 @@
   }
 
   Node* adr = array_element_address(value, index, T_CHAR);
+  if (adr->is_top()) {
+    return false;
+  }
   if (is_store) {
     (void) store_to_memory(control(), adr, ch, T_CHAR, TypeAryPtr::BYTES, MemNode::unordered,
                            false, false, true /* mismatched */);
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.cpp	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- a/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/src/share/vm/runtime/commandLineFlagConstraintsRuntime.hpp	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016 Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 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
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp	Thu Apr 13 16:26:36 2017 +0000
@@ -189,19 +189,6 @@
   assert(vf->is_compiled_frame(), "Wrong frame type");
   chunk->push(compiledVFrame::cast(vf));
 
-  ScopeDesc* trap_scope = chunk->at(0)->scope();
-  Handle exceptionObject;
-  if (trap_scope->rethrow_exception()) {
-    if (PrintDeoptimizationDetails) {
-      tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
-    }
-    GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
-    guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
-    ScopeValue* topOfStack = expressions->top();
-    exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
-    assert(exceptionObject() != NULL, "exception oop can not be null");
-  }
-
   bool realloc_failures = false;
 
 #if defined(COMPILER2) || INCLUDE_JVMCI
@@ -296,6 +283,19 @@
 #endif // INCLUDE_JVMCI
 #endif // COMPILER2 || INCLUDE_JVMCI
 
+  ScopeDesc* trap_scope = chunk->at(0)->scope();
+  Handle exceptionObject;
+  if (trap_scope->rethrow_exception()) {
+    if (PrintDeoptimizationDetails) {
+      tty->print_cr("Exception to be rethrown in the interpreter for method %s::%s at bci %d", trap_scope->method()->method_holder()->name()->as_C_string(), trap_scope->method()->name()->as_C_string(), trap_scope->bci());
+    }
+    GrowableArray<ScopeValue*>* expressions = trap_scope->expressions();
+    guarantee(expressions != NULL && expressions->length() > 0, "must have exception to throw");
+    ScopeValue* topOfStack = expressions->top();
+    exceptionObject = StackValue::create_stack_value(&deoptee, &map, topOfStack)->get_obj();
+    guarantee(exceptionObject() != NULL, "exception oop can not be null");
+  }
+
   // Ensure that no safepoint is taken after pointers have been stored
   // in fields of rematerialized objects.  If a safepoint occurs from here on
   // out the java state residing in the vframeArray will be missed.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/intrinsics/string/TestStringUTF16IntrinsicRangeChecks.java	Thu Apr 13 16:26:36 2017 +0000
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 2017, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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 8158168
+ * @summary Verifies that callers of StringUTF16 intrinsics throw array out of bounds exceptions.
+ * @library /compiler/patches /test/lib
+ * @build java.base/java.lang.Helper
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_getCharStringU,_putCharStringU compiler.intrinsics.string.TestStringUTF16IntrinsicRangeChecks
+ * @run main/othervm -Xbatch -XX:CompileThreshold=100 -esa -ea -XX:+UnlockDiagnosticVMOptions -XX:DisableIntrinsic=_getCharStringU,_putCharStringU compiler.intrinsics.string.TestStringUTF16IntrinsicRangeChecks
+ */
+package compiler.intrinsics.string;
+
+import java.lang.reflect.Field;
+import java.util.Arrays;
+
+public class TestStringUTF16IntrinsicRangeChecks {
+
+    public static void main(String[] args) throws Exception {
+        byte[] val = new byte[2];
+        byte[] b4  = new byte[4];
+        char[] c4  = new char[4];
+        String s4 = new String(c4);
+        byte[] valHigh = new byte[2];
+        byte[] valLow  = new byte[2];
+        Helper.putCharSB(valHigh, 0, Character.MIN_HIGH_SURROGATE);
+        Helper.putCharSB(valLow,  0, Character.MIN_LOW_SURROGATE);
+
+        for (int i = 0; i < 1000; ++i) {
+            getChars((int)1234, -5, -5 + 4, val);
+            getChars((int)1234, -1, -1 + 4, val);
+            getChars((int)1234,  0,  0 + 4, val);
+            getChars((int)1234,  1,  1 + 4, val);
+
+            getChars((long)1234, -5, -5 + 4, val);
+            getChars((long)1234, -1, -1 + 4, val);
+            getChars((long)1234,  0,  0 + 4, val);
+            getChars((long)1234,  1,  1 + 4, val);
+
+            byte[] val2 = Arrays.copyOf(val, val.length);
+            putCharSB(val2, -1, '!');
+            putCharSB(val2,  1, '!');
+
+            byte[] val4 = Arrays.copyOf(b4, b4.length);
+            char[] c2  = new char[2];
+            String s2 = new String(c2);
+
+            putCharsSB(val4, -3, c2, 0, 2);
+            putCharsSB(val4, -1, c2, 0, 2);
+            putCharsSB(val4,  0, c4, 0, 4);
+            putCharsSB(val4,  1, c2, 0, 2);
+            putCharsSB(val4, -3, s2, 0, 2);
+            putCharsSB(val4, -1, s2, 0, 2);
+            putCharsSB(val4,  0, s4, 0, 4);
+            putCharsSB(val4,  1, s2, 0, 2);
+
+            codePointAtSB(valHigh, -1, 1);
+            codePointAtSB(valHigh, -1, 2);
+            codePointAtSB(valHigh,  0, 2);
+            codePointAtSB(valHigh,  1, 2);
+
+            codePointBeforeSB(valLow,  0);
+            codePointBeforeSB(valLow, -1);
+            codePointBeforeSB(valLow,  2);
+
+            if (Helper.codePointCountSB(valHigh, 0, 1) != 1) {
+                throw new AssertionError("codePointCountSB");
+            }
+            if (Helper.codePointCountSB(valLow, 0, 1) != 1) {
+                throw new AssertionError("codePointCountSB");
+            }
+            codePointCountSB(valHigh, -1, 0);
+            codePointCountSB(valHigh, -1, 2);
+            codePointCountSB(valHigh,  0, 2);
+
+            charAt(val, -1);
+            charAt(val,  1);
+
+            contentEquals(b4, val, -1);
+            contentEquals(b4, val,  2);
+            contentEquals(val, s4,  2);
+            contentEquals(val, s4, -1);
+
+            StringBuilder sb = new StringBuilder();
+            sb.append((String)null).append(true).append(false);
+            if (!sb.toString().equals("nulltruefalse")) {
+                throw new AssertionError("append");
+            }
+
+            putCharsAt(val2, -1, '1', '2', '3', '4');
+            putCharsAt(val2,  0, '1', '2', '3', '4');
+            putCharsAt(val2,  2, '1', '2', '3', '4');
+            putCharsAt(val2, -1, '1', '2', '3', '4', '5');
+            putCharsAt(val2,  0, '1', '2', '3', '4', '5');
+            putCharsAt(val2,  2, '1', '2', '3', '4', '5');
+
+            reverse(valHigh, -1);
+            reverse(valHigh,  2);
+            reverse(valLow,  -1);
+            reverse(valLow,   2);
+
+            byte[] d4 = new byte[4];
+            inflate(b4, 0, d4, -1, 2);
+            inflate(b4, 0, d4,  3, 2);
+            inflate(b4, 0, d4,  4, 1);
+
+            byte[] b0 = new byte[0];
+            byte[] b1 = new byte[1];
+            byte[] b2 = new byte[2];
+            byte[] t1 = new byte[] {1};
+            byte[] t2 = new byte[] {1, 2};
+            byte[] t4 = new byte[] {1, 2, 3, 4};
+            indexOf(b1,  1, t2,  1, 0);
+            indexOf(b2,  1, t1,  1, 0);
+            indexOf(b2,  2, t2,  1, 0);
+            indexOf(b2,  1, t2,  2, 0);
+            indexOf(b2, -1, t2,  1, 0);
+            indexOf(b2,  1, t2, -1, 0);
+            indexOf(b2,  1, t2,  1, 1);
+
+            indexOfLatin1(b1,  1, t1,  1, 0);
+            indexOfLatin1(b2,  2, t1,  1, 0);
+            indexOfLatin1(b2,  1, b0,  1, 0);
+            indexOfLatin1(b2,  1, t1,  2, 0);
+            indexOfLatin1(b2, -1, t1,  1, 0);
+            indexOfLatin1(b2,  2, t1,  1, 0);
+            indexOfLatin1(b2,  1, t1, -1, 0);
+            indexOfLatin1(b2,  1, t1,  2, 0);
+
+            lastIndexOf(b1, t2, 1, 0);
+            lastIndexOf(b2, t4, 2, 0);
+            lastIndexOf(b2, t2, 1, 0);
+            lastIndexOf(b2, t2, 1, 1);
+
+            lastIndexOfLatin1(b1, t1, 1, 0);
+            lastIndexOfLatin1(b2, t2, 2, 0);
+            lastIndexOfLatin1(b2, t1, 1, 0);
+            lastIndexOfLatin1(b2, t1, 1, 1);
+        }
+    }
+
+    static void getChars(int i, int begin, int end, byte[] value) {
+        try {
+            Helper.getChars(i, begin, end, value);
+            throw new AssertionError("getChars");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void getChars(long l, int begin, int end, byte[] value) {
+        try {
+            Helper.getChars(l, begin, end, value);
+            throw new AssertionError("getChars");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharSB(byte[] val, int index, int c) {
+        try {
+            Helper.putCharSB(val, index, c);
+            throw new AssertionError("putCharSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
+        try {
+            Helper.putCharsSB(val, index, ca, off, end);
+            throw new AssertionError("putCharsSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
+        try {
+            Helper.putCharsSB(val, index, s, off, end);
+            throw new AssertionError("putCharsSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void codePointAtSB(byte[] val, int index, int end) {
+        try {
+            Helper.codePointAtSB(val, index, end);
+            throw new AssertionError("codePointAtSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void codePointBeforeSB(byte[] val, int index) {
+        try {
+            Helper.codePointBeforeSB(val, index);
+            throw new AssertionError("codePointBeforeSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void codePointCountSB(byte[] val, int beginIndex, int endIndex) {
+        try {
+            Helper.codePointCountSB(val, beginIndex, endIndex);
+            throw new AssertionError("codePointCountSB");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void charAt(byte[] v, int index) {
+        try {
+            Helper.charAt(v, index);
+            throw new AssertionError("charAt");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void contentEquals(byte[] v1, byte[] v2, int len) {
+        try {
+            Helper.contentEquals(v1, v2, len);
+            throw new AssertionError("contentEquals");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void contentEquals(byte[] v, CharSequence cs, int len) {
+        try {
+            Helper.contentEquals(v, cs, len);
+            throw new AssertionError("contentEquals");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharsAt(byte[] v, int i, char c1, char c2, char c3, char c4) {
+        try {
+            Helper.putCharsAt(v, i, c1, c2, c3, c4);
+            throw new AssertionError("putCharsAt");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void putCharsAt(byte[] v, int i, char c1, char c2, char c3, char c4, char c5) {
+        try {
+            Helper.putCharsAt(v, i, c1, c2, c3, c4, c5);
+            throw new AssertionError("putCharsAt");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void reverse(byte[] v, int len) {
+        try {
+            Helper.reverse(v, len);
+            throw new AssertionError("reverse");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void inflate(byte[] v1, int o1, byte[] v2, int o2, int len) {
+        try {
+            Helper.inflate(v1, o1, v2, o2, len);
+            throw new AssertionError("inflate");
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void indexOf(byte[] v1, int l1, byte[] v2, int l2, int from) {
+        try {
+            if (Helper.indexOf(v1, l1, v2, l2, from) != -1) {
+                throw new AssertionError("indexOf");
+            }
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void lastIndexOf(byte[] v1, byte[] v2, int l2, int from) {
+        try {
+            if (Helper.lastIndexOf(v1, v2, l2, from) != -1) {
+                throw new AssertionError("lastIndexOf");
+            }
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void indexOfLatin1(byte[] v1, int l1, byte[] v2, int l2, int from) {
+        try {
+            if (Helper.indexOfLatin1(v1, l1, v2, l2, from) != -1) {
+                throw new AssertionError("indexOfLatin1");
+            }
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+
+    static void lastIndexOfLatin1(byte[] v1, byte[] v2, int l2, int from) {
+        try {
+            if (Helper.lastIndexOfLatin1(v1, v2, l2, from) != -1) {
+                throw new AssertionError("lastIndexOfLatin1");
+            }
+        } catch (IndexOutOfBoundsException io) {
+        }
+    }
+}
--- a/hotspot/test/compiler/patches/java.base/java/lang/Helper.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/compiler/patches/java.base/java/lang/Helper.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, 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
@@ -73,4 +73,84 @@
         StringUTF16.getChars(value, srcBegin, srcEnd, dst, dstBegin);
         return dst;
     }
+
+    public static void putCharSB(byte[] val, int index, int c) {
+        StringUTF16.putCharSB(val, index, c);
+    }
+
+    public static void putCharsSB(byte[] val, int index, char[] ca, int off, int end) {
+        StringUTF16.putCharsSB(val, index, ca, off, end);
+    }
+
+    public static void putCharsSB(byte[] val, int index, CharSequence s, int off, int end) {
+        StringUTF16.putCharsSB(val, index, s, off, end);
+    }
+
+    public static int codePointAtSB(byte[] val, int index, int end) {
+        return StringUTF16.codePointAtSB(val, index, end);
+    }
+
+    public static int codePointBeforeSB(byte[] val, int index) {
+        return StringUTF16.codePointBeforeSB(val, index);
+    }
+
+    public static int codePointCountSB(byte[] val, int beginIndex, int endIndex) {
+        return StringUTF16.codePointCountSB(val, beginIndex, endIndex);
+    }
+
+    public static int getChars(int i, int begin, int end, byte[] value) {
+        return StringUTF16.getChars(i, begin, end, value);
+    }
+
+    public static int getChars(long l, int begin, int end, byte[] value) {
+        return StringUTF16.getChars(l, begin, end, value);
+    }
+
+    public static boolean contentEquals(byte[] v1, byte[] v2, int len) {
+        return StringUTF16.contentEquals(v1, v2, len);
+    }
+
+    public static boolean contentEquals(byte[] value, CharSequence cs, int len) {
+        return StringUTF16.contentEquals(value, cs, len);
+    }
+
+    public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4) {
+        return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4);
+    }
+
+    public static int putCharsAt(byte[] value, int i, char c1, char c2, char c3, char c4, char c5) {
+        return StringUTF16.putCharsAt(value, i, c1, c2, c3, c4, c5);
+    }
+
+    public static char charAt(byte[] value, int index) {
+        return StringUTF16.charAt(value, index);
+    }
+
+    public static void reverse(byte[] value, int count) {
+        StringUTF16.reverse(value, count);
+    }
+
+    public static void inflate(byte[] src, int srcOff, byte[] dst, int dstOff, int len) {
+        StringUTF16.inflate(src, srcOff, dst, dstOff, len);
+    }
+
+    public static int indexOf(byte[] src, int srcCount,
+                                    byte[] tgt, int tgtCount, int fromIndex) {
+        return StringUTF16.indexOf(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+
+    public static int indexOfLatin1(byte[] src, int srcCount,
+                                    byte[] tgt, int tgtCount, int fromIndex) {
+        return StringUTF16.indexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+    public static int lastIndexOf(byte[] src, byte[] tgt, int tgtCount, int fromIndex) {
+        int srcCount = StringUTF16.length(src); // ignored
+        return StringUTF16.lastIndexOf(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+
+    public static int lastIndexOfLatin1(byte[] src, byte[] tgt, int tgtCount, int fromIndex) {
+        int srcCount = StringUTF16.length(src); // ignored
+        return StringUTF16.lastIndexOfLatin1(src, srcCount, tgt, tgtCount, fromIndex);
+    }
+
 }
--- a/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/runtime/libadimalloc.solaris.sparc/Testlibadimalloc.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -67,7 +67,7 @@
 
         // Start the process, get the pid and then wait for the test to finish
         Process process = builder.start();
-        long pid = process.getPid();
+        long pid = process.pid();
         int retval = process.waitFor();
 
         // make sure the SEGVOverflow test crashed
--- a/hotspot/test/serviceability/attach/AttachSetGetFlag.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/attach/AttachSetGetFlag.java	Thu Apr 13 16:26:36 2017 +0000
@@ -80,7 +80,7 @@
     try {
       waitForReady(target);
 
-      int pid = (int)target.getPid();
+      int pid = (int)target.pid();
 
       HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString());
 
@@ -116,7 +116,7 @@
     try {
       waitForReady(target);
 
-      int pid = (int)target.getPid();
+      int pid = (int)target.pid();
 
       HotSpotVirtualMachine vm = (HotSpotVirtualMachine)VirtualMachine.attach(((Integer)pid).toString());
 
--- a/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/DaemonThreadTest.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -78,7 +78,7 @@
         thread.start();
 
         // Run jstack tool and collect the output
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results = jstackTool.measure();
 
         // Analyze the jstack output for the correct thread type
--- a/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/SpreadLockTest.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -96,7 +96,7 @@
         debuggee.start();
 
         // Collect output from the jstack tool
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results1 = jstackTool.measure();
 
         // Go to method b()
--- a/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/ThreadNamesTest.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -61,7 +61,7 @@
         thread.start();
 
         // Run jstack tool and collect the output
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results = jstackTool.measure();
 
         // Analyze the jstack output for the strange thread name
--- a/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/TraveledLockTest.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -95,7 +95,7 @@
         debuggee.start();
 
         // Collect output from the jstack tool
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results1 = jstackTool.measure();
 
         // Go to method b()
--- a/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstack/WaitNotifyThreadTest.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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,7 +105,7 @@
         waitThread.start();
 
         // Collect output from the jstack tool
-        JstackTool jstackTool = new JstackTool(ProcessHandle.current().getPid());
+        JstackTool jstackTool = new JstackTool(ProcessHandle.current().pid());
         ToolResults results = jstackTool.measure();
 
         // Analyze the jstack output for the patterns needed
--- a/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCapacityTest.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -38,7 +38,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcCapacityTool jstatGcTool = new JstatGcCapacityTool(ProcessHandle.current().getPid());
+        JstatGcCapacityTool jstatGcTool = new JstatGcCapacityTool(ProcessHandle.current().pid());
 
         // Run once and get the  results asserting that they are reasonable
         JstatGcCapacityResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest01.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -41,7 +41,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().getPid());
+        JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().pid());
 
         // Run once and get the  results asserting that they are reasonable
         JstatGcCauseResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest02.java	Thu Apr 13 16:26:36 2017 +0000
@@ -38,6 +38,6 @@
 public class GcCauseTest02 {
 
     public static void main(String[] args) throws Exception {
-        new GarbageProducerTest(new JstatGcCauseTool(ProcessHandle.current().getPid())).run();
+        new GarbageProducerTest(new JstatGcCauseTool(ProcessHandle.current().pid())).run();
     }
 }
--- a/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcCauseTest03.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -41,7 +41,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().getPid());
+        JstatGcCauseTool jstatGcTool = new JstatGcCauseTool(ProcessHandle.current().pid());
 
         System.gc();
 
--- a/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcNewTest.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -40,7 +40,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcNewTool jstatGcTool = new JstatGcNewTool(ProcessHandle.current().getPid());
+        JstatGcNewTool jstatGcTool = new JstatGcNewTool(ProcessHandle.current().pid());
 
         // Run once and get the  results asserting that they are reasonable
         JstatGcNewResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcTest01.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcTest01.java	Thu Apr 13 16:26:36 2017 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2017, 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
@@ -44,7 +44,7 @@
     public static void main(String[] args) throws Exception {
 
         // We will be running "jstat -gc" tool
-        JstatGcTool jstatGcTool = new JstatGcTool(ProcessHandle.current().getPid());
+        JstatGcTool jstatGcTool = new JstatGcTool(ProcessHandle.current().pid());
 
         // Run once and get the  results asserting that they are reasonable
         JstatGcResults measurement1 = jstatGcTool.measure();
--- a/hotspot/test/serviceability/tmtools/jstat/GcTest02.java	Thu Apr 13 16:01:12 2017 +0000
+++ b/hotspot/test/serviceability/tmtools/jstat/GcTest02.java	Thu Apr 13 16:26:36 2017 +0000
@@ -38,6 +38,6 @@
 public class GcTest02 {
 
     public static void main(String[] args) throws Exception {
-        new GarbageProducerTest(new JstatGcTool(ProcessHandle.current().getPid())).run();
+        new GarbageProducerTest(new JstatGcTool(ProcessHandle.current().pid())).run();
     }
 }