8209138: Symbol constructor uses u1 as the element type of its name argument
authorhseigel
Wed, 03 Oct 2018 09:46:46 -0400
changeset 51997 9ce37fa2e179
parent 51996 84743156e780
child 51998 27b48d82272c
child 56921 69544f53b8bf
8209138: Symbol constructor uses u1 as the element type of its name argument Summary: Maske u1 the type for Symbol values and add a function to return it as a char. Reviewed-by: dholmes, coleenp
src/hotspot/share/ci/ciEnv.cpp
src/hotspot/share/ci/ciInstanceKlass.cpp
src/hotspot/share/ci/ciObjArrayKlass.cpp
src/hotspot/share/ci/ciObjectFactory.cpp
src/hotspot/share/ci/ciSymbol.cpp
src/hotspot/share/ci/ciSymbol.hpp
src/hotspot/share/classfile/classFileParser.cpp
src/hotspot/share/classfile/symbolTable.cpp
src/hotspot/share/classfile/systemDictionary.cpp
src/hotspot/share/classfile/verificationType.cpp
src/hotspot/share/classfile/verificationType.hpp
src/hotspot/share/classfile/verifier.cpp
src/hotspot/share/classfile/vmSymbols.cpp
src/hotspot/share/jvmci/jvmciCompilerToVM.cpp
src/hotspot/share/jvmci/jvmciEnv.cpp
src/hotspot/share/oops/symbol.cpp
src/hotspot/share/oops/symbol.hpp
src/hotspot/share/prims/jvmtiTagMap.cpp
src/hotspot/share/prims/methodHandles.cpp
src/hotspot/share/prims/nativeLookup.cpp
src/hotspot/share/runtime/deoptimization.cpp
src/hotspot/share/runtime/fieldType.cpp
src/hotspot/share/runtime/fieldType.hpp
src/hotspot/share/runtime/signature.cpp
src/hotspot/share/runtime/signature.hpp
src/hotspot/share/runtime/vmStructs.cpp
src/hotspot/share/services/heapDumper.cpp
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/types/Field.java
--- a/src/hotspot/share/ci/ciEnv.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/ci/ciEnv.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -399,8 +399,8 @@
 
   // Now we need to check the SystemDictionary
   Symbol* sym = name->get_symbol();
-  if (sym->byte_at(0) == 'L' &&
-    sym->byte_at(sym->utf8_length()-1) == ';') {
+  if (sym->char_at(0) == 'L' &&
+    sym->char_at(sym->utf8_length()-1) == ';') {
     // This is a name from a signature.  Strip off the trimmings.
     // Call recursive to keep scope of strippedsym.
     TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
@@ -427,7 +427,7 @@
 
   // setup up the proper type to return on OOM
   ciKlass* fail_type;
-  if (sym->byte_at(0) == '[') {
+  if (sym->char_at(0) == '[') {
     fail_type = _unloaded_ciobjarrayklass;
   } else {
     fail_type = _unloaded_ciinstance_klass;
@@ -453,8 +453,8 @@
   // we must build an array type around it.  The CI requires array klasses
   // to be loaded if their element klasses are loaded, except when memory
   // is exhausted.
-  if (sym->byte_at(0) == '[' &&
-      (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) {
+  if (sym->char_at(0) == '[' &&
+      (sym->char_at(1) == '[' || sym->char_at(1) == 'L')) {
     // We have an unloaded array.
     // Build it on the fly if the element class exists.
     TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
--- a/src/hotspot/share/ci/ciInstanceKlass.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/ci/ciInstanceKlass.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -116,7 +116,7 @@
                                  jobject loader, jobject protection_domain)
   : ciKlass(name, T_OBJECT)
 {
-  assert(name->byte_at(0) != '[', "not an instance klass");
+  assert(name->char_at(0) != '[', "not an instance klass");
   _init_state = (InstanceKlass::ClassState)0;
   _nonstatic_field_size = -1;
   _has_nonstatic_fields = false;
@@ -299,7 +299,7 @@
     return false;
 
   // Test for trailing '/'
-  if ((char) name()->byte_at(len) != '/')
+  if (name()->char_at(len) != '/')
     return false;
 
   // Make sure it's not actually in a subpackage:
--- a/src/hotspot/share/ci/ciObjArrayKlass.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/ci/ciObjArrayKlass.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -112,9 +112,9 @@
   Symbol* base_name_sym = element_name->get_symbol();
   char* name;
 
-  if (base_name_sym->byte_at(0) == '[' ||
-      (base_name_sym->byte_at(0) == 'L' &&  // watch package name 'Lxx'
-       base_name_sym->byte_at(element_len-1) == ';')) {
+  if (base_name_sym->char_at(0) == '[' ||
+      (base_name_sym->char_at(0) == 'L' &&  // watch package name 'Lxx'
+       base_name_sym->char_at(element_len-1) == ';')) {
 
     int new_len = element_len + dimension + 1; // for the ['s and '\0'
     name = CURRENT_THREAD_ENV->name_buffer(new_len);
--- a/src/hotspot/share/ci/ciObjectFactory.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -466,7 +466,7 @@
 
   // Two cases: this is an unloaded ObjArrayKlass or an
   // unloaded InstanceKlass.  Deal with both.
-  if (name->byte_at(0) == '[') {
+  if (name->char_at(0) == '[') {
     // Decompose the name.'
     FieldArrayInfo fd;
     BasicType element_type = FieldType::get_array_info(name->get_symbol(),
--- a/src/hotspot/share/ci/ciSymbol.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/ci/ciSymbol.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -68,14 +68,14 @@
 
 // ------------------------------------------------------------------
 // ciSymbol::base
-const jbyte* ciSymbol::base() {
+const u1* ciSymbol::base() {
   GUARDED_VM_ENTRY(return get_symbol()->base();)
 }
 
 // ------------------------------------------------------------------
-// ciSymbol::byte_at
-int ciSymbol::byte_at(int i) {
-  GUARDED_VM_ENTRY(return get_symbol()->byte_at(i);)
+// ciSymbol::char_at
+char ciSymbol::char_at(int i) {
+  GUARDED_VM_ENTRY(return get_symbol()->char_at(i);)
 }
 
 // ------------------------------------------------------------------
--- a/src/hotspot/share/ci/ciSymbol.hpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/ci/ciSymbol.hpp	Wed Oct 03 09:46:46 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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 @@
   void print_impl(outputStream* st);
 
   // This is public in Symbol* but private here, because the base can move:
-  const jbyte* base();
+  const u1* base();
 
   // Make a ciSymbol from a C string (implementation).
   static ciSymbol* make_impl(const char* s);
@@ -77,8 +77,8 @@
   // The text of the symbol as ascii with all non-printable characters quoted as \u####
   const char* as_quoted_ascii();
 
-  // Return the i-th utf8 byte, where i < utf8_length
-  int         byte_at(int i);
+  // Return the i-th utf byte as a char, where i < utf8_length
+  char        char_at(int i);
 
   // Tests if the symbol starts with the given prefix.
   bool starts_with(const char* prefix, int len) const;
--- a/src/hotspot/share/classfile/classFileParser.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -655,7 +655,7 @@
             "Illegal zero length constant pool entry at %d in class %s",
             name_index, CHECK);
 
-          if (sig->byte_at(0) == JVM_SIGNATURE_FUNC) {
+          if (sig->char_at(0) == JVM_SIGNATURE_FUNC) {
             // Format check method name and signature
             verify_legal_method_name(name, CHECK);
             verify_legal_method_signature(name, sig, CHECK);
@@ -682,7 +682,7 @@
           // CONSTANT_Dynamic's name and signature are verified above, when iterating NameAndType_info.
           // Need only to be sure signature is non-zero length and the right type.
           if (signature->utf8_length() == 0 ||
-              signature->byte_at(0) == JVM_SIGNATURE_FUNC) {
+              signature->char_at(0) == JVM_SIGNATURE_FUNC) {
             throwIllegalSignature("CONSTANT_Dynamic", name, signature, CHECK);
           }
         }
@@ -707,7 +707,7 @@
             // Field name and signature are verified above, when iterating NameAndType_info.
             // Need only to be sure signature is non-zero length and the right type.
             if (signature->utf8_length() == 0 ||
-                signature->byte_at(0) == JVM_SIGNATURE_FUNC) {
+                signature->char_at(0) == JVM_SIGNATURE_FUNC) {
               throwIllegalSignature("Field", name, signature, CHECK);
             }
           }
@@ -716,7 +716,7 @@
             // Method name and signature are verified above, when iterating NameAndType_info.
             // Need only to be sure signature is non-zero length and the right type.
             if (signature->utf8_length() == 0 ||
-                signature->byte_at(0) != JVM_SIGNATURE_FUNC) {
+                signature->char_at(0) != JVM_SIGNATURE_FUNC) {
               throwIllegalSignature("Method", name, signature, CHECK);
             }
           }
@@ -724,7 +724,7 @@
           const unsigned int name_len = name->utf8_length();
           if (tag == JVM_CONSTANT_Methodref &&
               name_len != 0 &&
-              name->byte_at(0) == '<' &&
+              name->char_at(0) == '<' &&
               name != vmSymbols::object_initializer_name()) {
             classfile_parse_error(
               "Bad method name at constant pool index %u in class file %s",
@@ -942,7 +942,7 @@
 
         // Don't need to check legal name because it's checked when parsing constant pool.
         // But need to make sure it's not an array type.
-        guarantee_property(unresolved_klass->byte_at(0) != JVM_SIGNATURE_ARRAY,
+        guarantee_property(unresolved_klass->char_at(0) != JVM_SIGNATURE_ARRAY,
                            "Bad interface name in class file %s", CHECK);
 
         // Call resolve_super so classcircularity is checked
@@ -3752,7 +3752,7 @@
       if (need_verify)
         is_array = super_klass->is_array_klass();
     } else if (need_verify) {
-      is_array = (cp->klass_name_at(super_class_index)->byte_at(0) == JVM_SIGNATURE_ARRAY);
+      is_array = (cp->klass_name_at(super_class_index)->char_at(0) == JVM_SIGNATURE_ARRAY);
     }
     if (need_verify) {
       guarantee_property(!is_array,
@@ -5379,7 +5379,7 @@
     // The first non-signature thing better be a ')'
     if ((length > 0) && (*p++ == JVM_SIGNATURE_ENDFUNC)) {
       length--;
-      if (name->utf8_length() > 0 && name->byte_at(0) == '<') {
+      if (name->utf8_length() > 0 && name->char_at(0) == '<') {
         // All internal methods must return void
         if ((length == 1) && (p[0] == JVM_SIGNATURE_VOID)) {
           return args_size;
@@ -5796,7 +5796,7 @@
 void ClassFileParser::fix_unsafe_anonymous_class_name(TRAPS) {
   assert(_unsafe_anonymous_host != NULL, "Expected an unsafe anonymous class");
 
-  const jbyte* anon_last_slash = UTF8::strrchr(_class_name->base(),
+  const jbyte* anon_last_slash = UTF8::strrchr((const jbyte*)_class_name->base(),
                                                _class_name->utf8_length(), '/');
   if (anon_last_slash == NULL) {  // Unnamed package
     prepend_host_package_name(_unsafe_anonymous_host, CHECK);
@@ -6119,7 +6119,7 @@
   // It has been checked when constant pool is parsed.
   // However, make sure it is not an array type.
   if (_need_verify) {
-    guarantee_property(_class_name->byte_at(0) != JVM_SIGNATURE_ARRAY,
+    guarantee_property(_class_name->char_at(0) != JVM_SIGNATURE_ARRAY,
                        "Bad class name in class file %s",
                        CHECK);
   }
--- a/src/hotspot/share/classfile/symbolTable.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/classfile/symbolTable.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -478,8 +478,8 @@
 #ifdef ASSERT
     assert(sym->utf8_length() == _len, "%s [%d,%d]", where, sym->utf8_length(), _len);
     for (int i = 0; i < _len; i++) {
-      assert(sym->byte_at(i) == (jbyte) _name[i],
-             "%s [%d,%d,%d]", where, i, sym->byte_at(i), _name[i]);
+      assert(sym->char_at(i) == _name[i],
+             "%s [%d,%d,%d]", where, i, sym->char_at(i), _name[i]);
     }
 #endif
   }
--- a/src/hotspot/share/classfile/systemDictionary.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/classfile/systemDictionary.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -2601,7 +2601,7 @@
   if (type->utf8_length() == 1) {
 
     // It's a primitive.  (Void has a primitive mirror too.)
-    char ch = (char) type->byte_at(0);
+    char ch = type->char_at(0);
     assert(is_java_primitive(char2type(ch)) || ch == 'V', "");
     return Handle(THREAD, find_java_mirror_for_type(ch));
 
--- a/src/hotspot/share/classfile/verificationType.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/classfile/verificationType.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -120,7 +120,7 @@
 VerificationType VerificationType::get_component(ClassVerifier *context, TRAPS) const {
   assert(is_array() && name()->utf8_length() >= 2, "Must be a valid array");
   Symbol* component;
-  switch (name()->byte_at(1)) {
+  switch (name()->char_at(1)) {
     case 'Z': return VerificationType(Boolean);
     case 'B': return VerificationType(Byte);
     case 'C': return VerificationType(Char);
--- a/src/hotspot/share/classfile/verificationType.hpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/classfile/verificationType.hpp	Wed Oct 03 09:46:46 2018 -0400
@@ -207,7 +207,7 @@
   bool is_check() const { return (_u._data & TypeQuery) == TypeQuery; }
 
   bool is_x_array(char sig) const {
-    return is_null() || (is_array() && (name()->byte_at(1) == sig));
+    return is_null() || (is_array() && (name()->char_at(1) == sig));
   }
   bool is_int_array() const { return is_x_array('I'); }
   bool is_byte_array() const { return is_x_array('B'); }
@@ -223,10 +223,10 @@
     { return is_object_array() || is_array_array(); }
   bool is_object() const
     { return (is_reference() && !is_null() && name()->utf8_length() >= 1 &&
-              name()->byte_at(0) != '['); }
+              name()->char_at(0) != '['); }
   bool is_array() const
     { return (is_reference() && !is_null() && name()->utf8_length() >= 2 &&
-              name()->byte_at(0) == '['); }
+              name()->char_at(0) == '['); }
   bool is_uninitialized() const
     { return ((_u._data & Uninitialized) == Uninitialized); }
   bool is_uninitialized_this() const
@@ -322,7 +322,7 @@
   int dimensions() const {
     assert(is_array(), "Must be an array");
     int index = 0;
-    while (name()->byte_at(index) == '[') index++;
+    while (name()->char_at(index) == '[') index++;
     return index;
   }
 
--- a/src/hotspot/share/classfile/verifier.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/classfile/verifier.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -2809,7 +2809,7 @@
     }
   }
 
-  if (method_name->byte_at(0) == '<') {
+  if (method_name->char_at(0) == '<') {
     // Make sure <init> can only be invoked by invokespecial
     if (opcode != Bytecodes::_invokespecial ||
         method_name != vmSymbols::object_initializer_name()) {
--- a/src/hotspot/share/classfile/vmSymbols.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/classfile/vmSymbols.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -212,7 +212,7 @@
 BasicType vmSymbols::signature_type(const Symbol* s) {
   assert(s != NULL, "checking");
   if (s->utf8_length() == 1) {
-    BasicType result = char2type(s->byte_at(0));
+    BasicType result = char2type(s->char_at(0));
     if (is_java_primitive(result) || result == T_VOID) {
       assert(s == _type_signatures[result], "");
       return result;
--- a/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/jvmci/jvmciCompilerToVM.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -435,8 +435,8 @@
   if (resolve) {
     resolved_klass = SystemDictionary::resolve_or_null(class_name, class_loader, protection_domain, CHECK_0);
   } else {
-    if (class_name->byte_at(0) == 'L' &&
-      class_name->byte_at(class_name->utf8_length()-1) == ';') {
+    if (class_name->char_at(0) == 'L' &&
+      class_name->char_at(class_name->utf8_length()-1) == ';') {
       // This is a name from a signature.  Strip off the trimmings.
       // Call recursive to keep scope of strippedsym.
       TempNewSymbol strippedsym = SymbolTable::new_symbol(class_name->as_utf8()+1,
--- a/src/hotspot/share/jvmci/jvmciEnv.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/jvmci/jvmciEnv.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -98,8 +98,8 @@
   JVMCI_EXCEPTION_CONTEXT;
 
   // Now we need to check the SystemDictionary
-  if (sym->byte_at(0) == 'L' &&
-    sym->byte_at(sym->utf8_length()-1) == ';') {
+  if (sym->char_at(0) == 'L' &&
+    sym->char_at(sym->utf8_length()-1) == ';') {
     // This is a name from a signature.  Strip off the trimmings.
     // Call recursive to keep scope of strippedsym.
     TempNewSymbol strippedsym = SymbolTable::new_symbol(sym->as_utf8()+1,
@@ -132,8 +132,8 @@
   // we must build an array type around it.  The CI requires array klasses
   // to be loaded if their element klasses are loaded, except when memory
   // is exhausted.
-  if (sym->byte_at(0) == '[' &&
-      (sym->byte_at(1) == '[' || sym->byte_at(1) == 'L')) {
+  if (sym->char_at(0) == '[' &&
+      (sym->char_at(1) == '[' || sym->char_at(1) == 'L')) {
     // We have an unloaded array.
     // Build it on the fly if the element class exists.
     TempNewSymbol elem_sym = SymbolTable::new_symbol(sym->as_utf8()+1,
--- a/src/hotspot/share/oops/symbol.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/oops/symbol.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -79,7 +79,7 @@
 bool Symbol::starts_with(const char* prefix, int len) const {
   if (len > utf8_length()) return false;
   while (len-- > 0) {
-    if (prefix[len] != (char) byte_at(len))
+    if (prefix[len] != char_at(len))
       return false;
   }
   assert(len == -1, "we should be at the beginning");
@@ -117,7 +117,7 @@
   if (size > 0) {
     int len = MIN2(size - 1, utf8_length());
     for (int i = 0; i < len; i++) {
-      buf[i] = byte_at(i);
+      buf[i] = char_at(i);
     }
     buf[len] = '\0';
   }
@@ -311,7 +311,7 @@
   } else {
     st->print("'");
     for (int i = 0; i < utf8_length(); i++) {
-      st->print("%c", byte_at(i));
+      st->print("%c", char_at(i));
     }
     st->print("'");
   }
--- a/src/hotspot/share/oops/symbol.hpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/oops/symbol.hpp	Wed Oct 03 09:46:46 2018 -0400
@@ -112,7 +112,7 @@
   // in high half word. length is the number of UTF8 characters in the symbol
   volatile uint32_t _length_and_refcount;
   short _identity_hash;
-  jbyte _body[2];
+  u1 _body[2];
 
   enum {
     // max_symbol_length must fit into the top 16 bits of _length_and_refcount
@@ -128,7 +128,7 @@
     return (int)heap_word_size(byte_size(length));
   }
 
-  void byte_at_put(int index, int value) {
+  void byte_at_put(int index, u1 value) {
     assert(index >=0 && index < length(), "symbol index overflow");
     _body[index] = value;
   }
@@ -148,7 +148,7 @@
 
  public:
   // Low-level access (used with care, since not GC-safe)
-  const jbyte* base() const { return &_body[0]; }
+  const u1* base() const { return &_body[0]; }
 
   int size()                { return size(utf8_length()); }
   int byte_size()           { return byte_size(utf8_length()); }
@@ -176,12 +176,16 @@
     return (refcount() == PERM_REFCOUNT);
   }
 
-  int byte_at(int index) const {
+  // Function char_at() returns the Symbol's selected u1 byte as a char type.
+  //
+  // Note that all multi-byte chars have the sign bit set on all their bytes.
+  // No single byte chars have their sign bit set.
+  char char_at(int index) const {
     assert(index >=0 && index < length(), "symbol index overflow");
-    return base()[index];
+    return (char)base()[index];
   }
 
-  const jbyte* bytes() const { return base(); }
+  const u1* bytes() const { return base(); }
 
   int utf8_length() const { return length(); }
 
@@ -190,7 +194,7 @@
     int l = utf8_length();
     if (l != len) return false;
     while (l-- > 0) {
-      if (str[l] != (char) byte_at(l))
+      if (str[l] != char_at(l))
         return false;
     }
     assert(l == -1, "we should be at the beginning");
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/prims/jvmtiTagMap.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -853,7 +853,7 @@
     if (!fld.access_flags().is_static()) {
       continue;
     }
-    field_map->add(max_field_index - index, fld.signature()->byte_at(0), fld.offset());
+    field_map->add(max_field_index - index, fld.signature()->char_at(0), fld.offset());
   }
   return field_map;
 }
@@ -879,7 +879,7 @@
     if (fld.access_flags().is_static()) {
       continue;
     }
-    field_map->add(max_field_index - index, fld.signature()->byte_at(0), fld.offset());
+    field_map->add(max_field_index - index, fld.signature()->char_at(0), fld.offset());
   }
 
   return field_map;
--- a/src/hotspot/share/prims/methodHandles.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/prims/methodHandles.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -537,7 +537,7 @@
   assert(vmSymbols::object_signature()->equals(OBJ_SIG), "");
   const int len = sig->utf8_length();
   for (int i = 0; i < len; i++) {
-    switch (sig->byte_at(i)) {
+    switch (sig->char_at(i)) {
     case 'L':
       // only java/lang/Object is valid here
       if (sig->index_of_at(i, OBJ_SIG, OBJ_SIG_LEN) != i)
@@ -563,8 +563,8 @@
   } else if (is_basic_type_signature(sig)) {
     sig->increment_refcount();
     return sig;  // that was easy
-  } else if (sig->byte_at(0) != '(') {
-    BasicType bt = char2type(sig->byte_at(0));
+  } else if (sig->char_at(0) != '(') {
+    BasicType bt = char2type(sig->char_at(0));
     if (is_subword_type(bt)) {
       bsig = vmSymbols::int_signature();
     } else {
@@ -615,7 +615,7 @@
   int array = 0;
   bool prev_type = false;
   for (int i = 0; i < len; i++) {
-    char ch = sig->byte_at(i);
+    char ch = sig->char_at(i);
     switch (ch) {
     case '(': case ')':
       prev_type = false;
@@ -630,7 +630,7 @@
       {
         if (prev_type)  st->put(',');
         int start = i+1, slash = start;
-        while (++i < len && (ch = sig->byte_at(i)) != ';') {
+        while (++i < len && (ch = sig->char_at(i)) != ';') {
           if (ch == '/' || ch == '.' || ch == '$')  slash = i+1;
         }
         if (slash < i)  start = slash;
@@ -638,7 +638,7 @@
           st->put('L');
         } else {
           for (int j = start; j < i; j++)
-            st->put(sig->byte_at(j));
+            st->put(sig->char_at(j));
           prev_type = true;
         }
         break;
@@ -975,7 +975,7 @@
   }
   if (sig != NULL) {
     if (sig->utf8_length() == 0)  return 0; // a match is not possible
-    if (sig->byte_at(0) == '(')
+    if (sig->char_at(0) == '(')
       match_flags &= ~(IS_FIELD | IS_TYPE);
     else
       match_flags &= ~(IS_CONSTRUCTOR | IS_METHOD);
@@ -1456,7 +1456,7 @@
           {
             Symbol* type = caller->constants()->signature_ref_at(bss_index_in_pool);
             Handle th;
-            if (type->byte_at(0) == '(') {
+            if (type->char_at(0) == '(') {
               th = SystemDictionary::find_method_handle_type(type, caller, CHECK);
             } else {
               th = SystemDictionary::find_java_mirror_for_type(type, caller, SignatureStream::NCDFError, CHECK);
--- a/src/hotspot/share/prims/nativeLookup.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/prims/nativeLookup.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -103,7 +103,7 @@
   st.print("__");
   // find ')'
   int end;
-  for (end = 0; end < signature->utf8_length() && signature->byte_at(end) != ')'; end++);
+  for (end = 0; end < signature->utf8_length() && signature->char_at(end) != ')'; end++);
   // skip first '('
   mangle_name_on(&st, signature, 1, end);
   return st.as_string();
@@ -288,7 +288,7 @@
 
   Symbol* signature = method->signature();
   for (int end = 0; end < signature->utf8_length(); end++) {
-    if (signature->byte_at(end) == 'L') {
+    if (signature->char_at(end) == 'L') {
       // Don't allow object types
       return NULL;
     }
--- a/src/hotspot/share/runtime/deoptimization.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/runtime/deoptimization.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -1451,7 +1451,7 @@
   Symbol*  symbol  = constant_pool->symbol_at(index);
 
   // class name?
-  if (symbol->byte_at(0) != '(') {
+  if (symbol->char_at(0) != '(') {
     Handle protection_domain (THREAD, constant_pool->pool_holder()->protection_domain());
     SystemDictionary::resolve_or_null(symbol, class_loader, protection_domain, CHECK);
     return;
--- a/src/hotspot/share/runtime/fieldType.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/runtime/fieldType.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -32,21 +32,21 @@
 #include "runtime/signature.hpp"
 
 BasicType FieldType::basic_type(Symbol* signature) {
-  return char2type(signature->byte_at(0));
+  return char2type(signature->char_at(0));
 }
 
 // Check if it is a valid array signature
 bool FieldType::is_valid_array_signature(Symbol* sig) {
   assert(sig->utf8_length() > 1, "this should already have been checked");
-  assert(sig->byte_at(0) == '[', "this should already have been checked");
+  assert(sig->char_at(0) == '[', "this should already have been checked");
   // The first character is already checked
   int i = 1;
   int len = sig->utf8_length();
   // First skip all '['s
-  while(i < len - 1 && sig->byte_at(i) == '[') i++;
+  while(i < len - 1 && sig->char_at(i) == '[') i++;
 
   // Check type
-  switch(sig->byte_at(i)) {
+  switch(sig->char_at(i)) {
     case 'B': // T_BYTE
     case 'C': // T_CHAR
     case 'D': // T_DOUBLE
@@ -59,7 +59,7 @@
       return (i + 1 == len);
     case 'L':
       // If it is an object, the last character must be a ';'
-      return sig->byte_at(len - 1) == ';';
+      return sig->char_at(len - 1) == ';';
   }
 
   return false;
@@ -70,7 +70,7 @@
   assert(basic_type(signature) == T_ARRAY, "must be array");
   int index = 1;
   int dim   = 1;
-  while (signature->byte_at(index) == '[') {
+  while (signature->char_at(index) == '[') {
     index++;
     dim++;
   }
--- a/src/hotspot/share/runtime/fieldType.hpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/runtime/fieldType.hpp	Wed Oct 03 09:46:46 2018 -0400
@@ -58,14 +58,14 @@
   static BasicType basic_type(Symbol* signature);
 
   // Testing
-  static bool is_array(Symbol* signature) { return signature->utf8_length() > 1 && signature->byte_at(0) == '[' && is_valid_array_signature(signature); }
+  static bool is_array(Symbol* signature) { return signature->utf8_length() > 1 && signature->char_at(0) == '[' && is_valid_array_signature(signature); }
 
   static bool is_obj(Symbol* signature) {
      int sig_length = signature->utf8_length();
      // Must start with 'L' and end with ';'
      return (sig_length >= 2 &&
-             (signature->byte_at(0) == 'L') &&
-             (signature->byte_at(sig_length - 1) == ';'));
+             (signature->char_at(0) == 'L') &&
+             (signature->char_at(sig_length - 1) == ';'));
   }
 
   // Parse field and extract array information. Works for T_ARRAY only.
--- a/src/hotspot/share/runtime/signature.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/runtime/signature.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -50,7 +50,7 @@
 }
 
 void SignatureIterator::expect(char c) {
-  if (_signature->byte_at(_index) != c) fatal("expecting %c", c);
+  if (_signature->char_at(_index) != c) fatal("expecting %c", c);
   _index++;
 }
 
@@ -61,7 +61,7 @@
   //       work (stack underflow for some tests) - this seems to be a VC++ 6.0
   //       compiler bug (was problem - gri 4/27/2000).
   int size = -1;
-  switch(_signature->byte_at(_index)) {
+  switch(_signature->char_at(_index)) {
     case 'B': do_byte  (); if (_parameter_index < 0 ) _return_type = T_BYTE;
               _index++; size = T_BYTE_size   ; break;
     case 'C': do_char  (); if (_parameter_index < 0 ) _return_type = T_CHAR;
@@ -83,7 +83,7 @@
     case 'L':
       { int begin = ++_index;
         Symbol* sig = _signature;
-        while (sig->byte_at(_index++) != ';') ;
+        while (sig->char_at(_index++) != ';') ;
         do_object(begin, _index);
       }
       if (_parameter_index < 0 ) _return_type = T_OBJECT;
@@ -92,11 +92,11 @@
     case '[':
       { int begin = ++_index;
         Symbol* sig = _signature;
-        while (sig->byte_at(_index) == '[') {
+        while (sig->char_at(_index) == '[') {
           _index++;
         }
-        if (sig->byte_at(_index) == 'L') {
-          while (sig->byte_at(_index++) != ';') ;
+        if (sig->char_at(_index) == 'L') {
+          while (sig->char_at(_index++) != ';') ;
         } else {
           _index++;
         }
@@ -137,7 +137,7 @@
   _index = 0;
   _parameter_index = 0;
   expect('(');
-  while (_signature->byte_at(_index) != ')') _parameter_index += parse_type();
+  while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
   expect(')');
   _parameter_index = 0;
 }
@@ -217,8 +217,8 @@
   // Need to skip over each type in the signature's argument list until a
   // closing ')' is found., then get the return type.  We cannot just scan
   // for the first ')' because ')' is a legal character in a type name.
-  while (sig->byte_at(_index) != ')') {
-    switch(sig->byte_at(_index)) {
+  while (sig->char_at(_index) != ')') {
+    switch(sig->char_at(_index)) {
       case 'B':
       case 'C':
       case 'D':
@@ -234,17 +234,17 @@
         break;
       case 'L':
         {
-          while (sig->byte_at(_index++) != ';') ;
+          while (sig->char_at(_index++) != ';') ;
         }
         break;
       case '[':
         {
           int begin = ++_index;
-          while (sig->byte_at(_index) == '[') {
+          while (sig->char_at(_index) == '[') {
             _index++;
           }
-          if (sig->byte_at(_index) == 'L') {
-            while (sig->byte_at(_index++) != ';') ;
+          if (sig->char_at(_index) == 'L') {
+            while (sig->char_at(_index++) != ';') ;
           } else {
             _index++;
           }
@@ -269,7 +269,7 @@
   _parameter_index = 0;
   _index = 0;
   expect('(');
-  while (_signature->byte_at(_index) != ')') _parameter_index += parse_type();
+  while (_signature->char_at(_index) != ')') _parameter_index += parse_type();
   expect(')');
   // Parse return type
   _parameter_index = -1;
@@ -304,20 +304,20 @@
     case 'L': {
       _type = T_OBJECT;
       Symbol* sig = _signature;
-      while (sig->byte_at(_end++) != ';');
+      while (sig->char_at(_end++) != ';');
       break;
     }
     case '[': {
       _type = T_ARRAY;
       Symbol* sig = _signature;
-      char c = sig->byte_at(_end);
-      while ('0' <= c && c <= '9') c = sig->byte_at(_end++);
-      while (sig->byte_at(_end) == '[') {
+      char c = sig->char_at(_end);
+      while ('0' <= c && c <= '9') c = sig->char_at(_end++);
+      while (sig->char_at(_end) == '[') {
         _end++;
-        c = sig->byte_at(_end);
-        while ('0' <= c && c <= '9') c = sig->byte_at(_end++);
+        c = sig->char_at(_end);
+        while ('0' <= c && c <= '9') c = sig->char_at(_end++);
       }
-      switch(sig->byte_at(_end)) {
+      switch(sig->char_at(_end)) {
         case 'B':
         case 'C':
         case 'D':
@@ -327,7 +327,7 @@
         case 'S':
         case 'Z':_end++; break;
         default: {
-          while (sig->byte_at(_end++) != ';');
+          while (sig->char_at(_end++) != ';');
           break;
         }
       }
@@ -353,8 +353,8 @@
   int begin = _begin;
   int end   = _end;
 
-  if (   _signature->byte_at(_begin) == 'L'
-      && _signature->byte_at(_end-1) == ';') {
+  if (   _signature->char_at(_begin) == 'L'
+      && _signature->char_at(_end-1) == ';') {
     begin++;
     end--;
   }
@@ -394,15 +394,15 @@
   int begin = _begin;
   int end   = _end;
 
-  if (   _signature->byte_at(_begin) == 'L'
-      && _signature->byte_at(_end-1) == ';') {
+  if (   _signature->char_at(_begin) == 'L'
+      && _signature->char_at(_end-1) == ';') {
     begin++;
     end--;
   }
 
   char* buffer = NEW_RESOURCE_ARRAY(char, end - begin);
   for (int index = begin; index < end; index++) {
-    buffer[index - begin] = _signature->byte_at(index);
+    buffer[index - begin] = _signature->char_at(index);
   }
   Symbol* result = SymbolTable::probe(buffer, end - begin);
   return result;
--- a/src/hotspot/share/runtime/signature.hpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/runtime/signature.hpp	Wed Oct 03 09:46:46 2018 -0400
@@ -378,7 +378,7 @@
     }
 
     _begin = _end;
-    int t = sig->byte_at(_begin);
+    int t = sig->char_at(_begin);
     switch (t) {
       case 'B': _type = T_BYTE;    break;
       case 'C': _type = T_CHAR;    break;
@@ -405,8 +405,8 @@
   enum FailureMode { ReturnNull, CNFException, NCDFError };
   Klass* as_klass(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS);
   oop as_java_mirror(Handle class_loader, Handle protection_domain, FailureMode failure_mode, TRAPS);
-  const jbyte* raw_bytes()  { return _signature->bytes() + _begin; }
-  int          raw_length() { return _end - _begin; }
+  const u1* raw_bytes()  { return _signature->bytes() + _begin; }
+  int       raw_length() { return _end - _begin; }
 
   // return same as_symbol except allocation of new symbols is avoided.
   Symbol* as_symbol_or_null();
--- a/src/hotspot/share/runtime/vmStructs.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -329,8 +329,8 @@
   nonstatic_field(ObjArrayKlass,               _bottom_klass,                                 Klass*)                                \
   volatile_nonstatic_field(Symbol,             _length_and_refcount,                          unsigned int)                          \
   nonstatic_field(Symbol,                      _identity_hash,                                short)                                 \
-  unchecked_nonstatic_field(Symbol,            _body,                                         sizeof(jbyte)) /* NOTE: no type */     \
-  nonstatic_field(Symbol,                      _body[0],                                      jbyte)                                 \
+  unchecked_nonstatic_field(Symbol,            _body,                                         sizeof(u1)) /* NOTE: no type */        \
+  nonstatic_field(Symbol,                      _body[0],                                      u1)                                    \
   nonstatic_field(TypeArrayKlass,              _max_length,                                   jint)                                  \
                                                                                                                                      \
   /***********************/                                                                                                          \
--- a/src/hotspot/share/services/heapDumper.cpp	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/hotspot/share/services/heapDumper.cpp	Wed Oct 03 09:46:46 2018 -0400
@@ -696,7 +696,7 @@
 
 // returns hprof tag for the given type signature
 hprofTag DumperSupport::sig2tag(Symbol* sig) {
-  switch (sig->byte_at(0)) {
+  switch (sig->char_at(0)) {
     case JVM_SIGNATURE_CLASS    : return HPROF_NORMAL_OBJECT;
     case JVM_SIGNATURE_ARRAY    : return HPROF_NORMAL_OBJECT;
     case JVM_SIGNATURE_BYTE     : return HPROF_BYTE;
@@ -821,7 +821,7 @@
   for (FieldStream fld(ik, false, false); !fld.eos(); fld.next()) {
     if (!fld.access_flags().is_static()) {
       Symbol* sig = fld.signature();
-      switch (sig->byte_at(0)) {
+      switch (sig->char_at(0)) {
         case JVM_SIGNATURE_CLASS   :
         case JVM_SIGNATURE_ARRAY   : size += oopSize; break;
 
@@ -889,7 +889,7 @@
       writer->write_u1(sig2tag(sig));       // type
 
       // value
-      dump_field_value(writer, sig->byte_at(0), ik->java_mirror(), fld.offset());
+      dump_field_value(writer, sig->char_at(0), ik->java_mirror(), fld.offset());
     }
   }
 
@@ -925,7 +925,7 @@
   for (FieldStream fld(ik, false, false); !fld.eos(); fld.next()) {
     if (!fld.access_flags().is_static()) {
       Symbol* sig = fld.signature();
-      dump_field_value(writer, sig->byte_at(0), o, fld.offset());
+      dump_field_value(writer, sig->char_at(0), o, fld.offset());
     }
   }
 }
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/types/Field.java	Wed Oct 03 03:41:57 2018 -0400
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/types/Field.java	Wed Oct 03 09:46:46 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -57,7 +57,7 @@
 
     FIXME: among other things, this interface is not sufficient to
     describe fields which are themselves arrays (like Symbol's
-    jbyte _body[1]).  */
+    u1 _body[1]).  */
 public interface Field {
   /** Get the name of this field */
   public String getName();