changeset 13052:3cb736f232c7 mvt

8185301: [MVT] Add JVM support for -Dvalhalla.mangleClassInfo Summary: Introduction of JVM_CONSTANT_Value to support MVT's name mangling specification for value types Reviewed-by: acorn, dsimms
author lfoltan
date Tue, 25 Jul 2017 16:57:58 -0400
parents cbbd2c7f3259
children 6efbdfd91076
files src/cpu/x86/vm/templateTable_x86.cpp src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java src/share/vm/c1/c1_GraphBuilder.cpp src/share/vm/ci/ciEnv.cpp src/share/vm/ci/ciReplay.cpp src/share/vm/ci/ciStreams.hpp src/share/vm/ci/ciTypeFlow.cpp src/share/vm/classfile/classFileParser.cpp src/share/vm/classfile/classFileParser.hpp src/share/vm/interpreter/bytecodeInterpreter.cpp src/share/vm/interpreter/bytecodeTracer.cpp src/share/vm/interpreter/interpreterRuntime.cpp src/share/vm/jvmci/jvmciEnv.cpp src/share/vm/jvmci/vmStructs_jvmci.cpp src/share/vm/oops/constantPool.cpp src/share/vm/oops/constantPool.hpp src/share/vm/oops/generateOopMap.cpp src/share/vm/oops/method.cpp src/share/vm/prims/jvm.cpp src/share/vm/prims/jvmtiRedefineClasses.cpp src/share/vm/prims/jvmtiTagMap.cpp src/share/vm/prims/methodComparator.cpp src/share/vm/runtime/deoptimization.cpp src/share/vm/runtime/vmStructs.cpp src/share/vm/utilities/constantTag.cpp src/share/vm/utilities/constantTag.hpp test/runtime/valhalla/valuetypes/UninitializedValueFieldsTest.java test/runtime/valhalla/valuetypes/VTBufferTest.java test/runtime/valhalla/valuetypes/ValueTypeGetField.java
diffstat 30 files changed, 497 insertions(+), 146 deletions(-) [+]
line wrap: on
line diff
--- a/src/cpu/x86/vm/templateTable_x86.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/cpu/x86/vm/templateTable_x86.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -448,6 +448,19 @@
 
   // resolved class - need to call vm to get java mirror of the class
   __ cmpl(rdx, JVM_CONSTANT_Class);
+  __ jcc(Assembler::equal, call_ldc);
+
+  // unresolved value type - get the resolved class
+  __ cmpl(rdx, JVM_CONSTANT_UnresolvedValue);
+  __ jccb(Assembler::equal, call_ldc);
+
+  // unresolved value type in error state - call into runtime to throw the error
+  // from the first resolution attempt
+  __ cmpl(rdx, JVM_CONSTANT_UnresolvedValueInError);
+  __ jccb(Assembler::equal, call_ldc);
+
+  // resolved value type - need to call vm to get java mirror
+  __ cmpl(rdx, JVM_CONSTANT_Value);
   __ jcc(Assembler::notEqual, notClass);
 
   __ bind(call_ldc);
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotConstantPool.java	Tue Jul 25 16:57:58 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -108,6 +108,9 @@
         Class(config().jvmConstantClass),
         UnresolvedClass(config().jvmConstantUnresolvedClass),
         UnresolvedClassInError(config().jvmConstantUnresolvedClassInError),
+        Value(config().jvmConstantValue),
+        UnresolvedValue(config().jvmConstantUnresolvedValue),
+        UnresolvedValueInError(config().jvmConstantUnresolvedValueInError),
         String(config().jvmConstantString),
         Fieldref(config().jvmConstantFieldref),
         MethodRef(config().jvmConstantMethodref),
@@ -506,6 +509,9 @@
             case Class:
             case UnresolvedClass:
             case UnresolvedClassInError:
+            case Value:
+            case UnresolvedValue:
+            case UnresolvedValueInError:
                 final int opcode = -1;  // opcode is not used
                 return lookupType(cpi, opcode);
             case String:
@@ -684,11 +690,15 @@
                 index = getUncachedKlassRefIndexAt(index);
                 // Read the tag only once because it could change between multiple reads.
                 final JVM_CONSTANT klassTag = getTagAt(index);
-                assert klassTag == JVM_CONSTANT.Class || klassTag == JVM_CONSTANT.UnresolvedClass || klassTag == JVM_CONSTANT.UnresolvedClassInError : klassTag;
+                assert klassTag == JVM_CONSTANT.Class || klassTag == JVM_CONSTANT.UnresolvedClass || klassTag == JVM_CONSTANT.UnresolvedClassInError ||
+                       klassTag == JVM_CONSTANT.Value || klassTag == JVM_CONSTANT.UnresolvedValue || klassTag == JVM_CONSTANT.UnresolvedValueInError : klassTag;
                 // fall through
             case Class:
             case UnresolvedClass:
             case UnresolvedClassInError:
+            case Value:
+            case UnresolvedValue:
+            case UnresolvedValueInError:
                 final HotSpotResolvedObjectTypeImpl type = compilerToVM().resolveTypeInPool(this, index);
                 Class<?> klass = type.mirror();
                 if (!klass.isPrimitive() && !klass.isArray()) {
--- a/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/jdk.internal.vm.ci/share/classes/jdk.vm.ci.hotspot/src/jdk/vm/ci/hotspot/HotSpotVMConfig.java	Tue Jul 25 16:57:58 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 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
@@ -220,6 +220,9 @@
     final int jvmConstantClass = getConstant("JVM_CONSTANT_Class", Integer.class);
     final int jvmConstantUnresolvedClass = getConstant("JVM_CONSTANT_UnresolvedClass", Integer.class);
     final int jvmConstantUnresolvedClassInError = getConstant("JVM_CONSTANT_UnresolvedClassInError", Integer.class);
+    final int jvmConstantValue = getConstant("JVM_CONSTANT_Value", Integer.class);
+    final int jvmConstantUnresolvedValue = getConstant("JVM_CONSTANT_UnresolvedValue", Integer.class);
+    final int jvmConstantUnresolvedValueInError = getConstant("JVM_CONSTANT_UnresolvedValueInError", Integer.class);
     final int jvmConstantString = getConstant("JVM_CONSTANT_String", Integer.class);
     final int jvmConstantFieldref = getConstant("JVM_CONSTANT_Fieldref", Integer.class);
     final int jvmConstantMethodref = getConstant("JVM_CONSTANT_Methodref", Integer.class);
--- a/src/share/vm/c1/c1_GraphBuilder.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/c1/c1_GraphBuilder.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -2130,7 +2130,8 @@
   bool will_link;
   ciKlass* klass = stream()->get_klass(will_link);
   assert(klass->is_instance_klass(), "must be an instance klass");
-  NewInstance* new_instance = new NewInstance(klass->as_instance_klass(), state_before, stream()->is_unresolved_klass());
+  NewInstance* new_instance = new NewInstance(klass->as_instance_klass(), state_before,
+                                              stream()->is_unresolved_klass() || stream()->is_unresolved_value_type());
   _memory->new_instance(new_instance);
   apush(append_split(new_instance));
 }
--- a/src/share/vm/ci/ciEnv.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/ci/ciEnv.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -475,7 +475,7 @@
   if (found_klass == NULL && !cpool.is_null() && cpool->has_preresolution()) {
     // Look inside the constant pool for pre-resolved class entries.
     for (int i = cpool->length() - 1; i >= 1; i--) {
-      if (cpool->tag_at(i).is_klass()) {
+      if (cpool->tag_at(i).is_klass() || cpool->tag_at(i).is_value_type()) {
         Klass* kls = cpool->resolved_klass_at(i);
         if (kls->name() == sym) {
           found_klass = kls;
@@ -645,7 +645,8 @@
       assert (constant->is_instance(), "must be an instance, or not? ");
       return ciConstant(T_OBJECT, constant);
     }
-  } else if (tag.is_klass() || tag.is_unresolved_klass()) {
+  } else if (tag.is_klass() || tag.is_unresolved_klass() ||
+             tag.is_value_type() || tag.is_unresolved_value_type()) {
     // 4881222: allow ldc to take a class type
     ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore_will_link, accessor);
     if (HAS_PENDING_EXCEPTION) {
--- a/src/share/vm/ci/ciReplay.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/ci/ciReplay.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -693,14 +693,25 @@
           }
           break;
         }
+
+        case JVM_CONSTANT_UnresolvedValue: {
+          if (tag == JVM_CONSTANT_Value) {
+            tty->print_cr("Resolving value type %s at %d", cp->klass_name_at(i)->as_utf8(), i);
+            Klass* k = cp->klass_at(i, CHECK);
+          }
+          break;
+        }
+
         case JVM_CONSTANT_Long:
         case JVM_CONSTANT_Double:
           parsed_two_word = i + 1;
 
         case JVM_CONSTANT_ClassIndex:
+        case JVM_CONSTANT_ValueIndex:
         case JVM_CONSTANT_StringIndex:
         case JVM_CONSTANT_String:
         case JVM_CONSTANT_UnresolvedClassInError:
+        case JVM_CONSTANT_UnresolvedValueInError:
         case JVM_CONSTANT_Fieldref:
         case JVM_CONSTANT_Methodref:
         case JVM_CONSTANT_InterfaceMethodref:
@@ -727,6 +738,16 @@
           }
           break;
 
+        case JVM_CONSTANT_Value:
+          if (tag == JVM_CONSTANT_Value) {
+          } else if (tag == JVM_CONSTANT_UnresolvedValue) {
+            tty->print_cr("Warning: entry was unresolved in the replay data");
+          } else {
+            report_error("Unexpected tag");
+            return;
+          }
+          break;
+
         case 0:
           if (parsed_two_word == i) continue;
 
@@ -874,7 +895,7 @@
       oop value = InstanceKlass::cast(k)->allocate_instance(CHECK_(true));
       java_mirror->obj_field_put(fd->offset(), value);
       return true;
-    } 
+    }
     return false;
   }
 
--- a/src/share/vm/ci/ciStreams.hpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/ci/ciStreams.hpp	Tue Jul 25 16:57:58 2017 -0400
@@ -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
@@ -249,6 +249,12 @@
     return tag.is_unresolved_klass();
   }
 
+  // True if the klass-using bytecode points to an unresolved value type
+  bool is_unresolved_value_type() const {
+    constantTag tag = get_constant_pool_tag(get_klass_index());
+    return tag.is_unresolved_value_type();
+  }
+
   // If this bytecode is one of get_field, get_static, put_field,
   // or put_static, get the referenced field.
   ciField* get_field(bool& will_link);
--- a/src/share/vm/ci/ciTypeFlow.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/ci/ciTypeFlow.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -777,7 +777,7 @@
   bool will_link;
   ciKlass* klass = str->get_klass(will_link);
   assert(klass->is_valuetype(), "should be value type");
-  if (!will_link || str->is_unresolved_klass()) {
+  if (!will_link || str->is_unresolved_value_type()) {
     trap(str, klass, str->get_klass_index());
   } else {
     push_object(klass);
--- a/src/share/vm/classfile/classFileParser.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/classfile/classFileParser.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -144,12 +144,18 @@
     // so we don't need bounds-check for reading tag.
     const u1 tag = cfs->get_u1_fast();
     switch (tag) {
-      case JVM_CONSTANT_Class : {
+      case JVM_CONSTANT_Class: {
         cfs->guarantee_more(3, CHECK);  // name_index, tag/access_flags
         const u2 name_index = cfs->get_u2_fast();
         cp->klass_index_at_put(index, name_index);
         break;
       }
+      case JVM_CONSTANT_Value: {  // may be present in a retransform situation
+        cfs->guarantee_more(3, CHECK);  // name_index, tag/access_flags
+        const u2 name_index = cfs->get_u2_fast();
+        cp->value_type_index_at_put(index, name_index);
+        break;
+      }
       case JVM_CONSTANT_Fieldref: {
         cfs->guarantee_more(5, CHECK);  // class_index, name_and_type_index, tag/access_flags
         const u2 class_index = cfs->get_u2_fast();
@@ -399,8 +405,9 @@
   for (index = 1; index < length; index++) {          // Index 0 is unused
     const jbyte tag = cp->tag_at(index).value();
     switch (tag) {
-      case JVM_CONSTANT_Class: {
-        ShouldNotReachHere();     // Only JVM_CONSTANT_ClassIndex should be present
+      case JVM_CONSTANT_Class:
+      case JVM_CONSTANT_Value: {
+        ShouldNotReachHere();     // Only JVM_CONSTANT_[Class|Value]Index should be present
         break;
       }
       case JVM_CONSTANT_Fieldref:
@@ -461,7 +468,36 @@
         check_property(valid_symbol_at(class_index),
           "Invalid constant pool index %u in class file %s",
           class_index, CHECK);
-        cp->unresolved_klass_at_put(index, class_index, num_klasses++);
+
+        // check for a value type
+        if (EnableValhalla || EnableMVT) {
+          Symbol* const name = cp->symbol_at(class_index);
+          const unsigned int name_len = name->utf8_length();
+
+          // check for name > 3 to rule out ";Q;" where no name is present
+          if (name_len != 0 &&
+              name_len > 3 &&
+              name->byte_at(0) == ';' &&
+              name->byte_at(1) == 'Q' &&
+              name->byte_at(name_len-1) == ';') {
+            Symbol* const strippedsym = SymbolTable::new_symbol(name, 2, name_len-1, CHECK);
+            assert(strippedsym != NULL, "failure to create value type stripped name");
+            cp->symbol_at_put(class_index, strippedsym);
+            cp->unresolved_value_type_at_put(index, class_index, num_klasses++);
+          } else {
+            cp->unresolved_klass_at_put(index, class_index, num_klasses++);
+          }
+        } else {
+          cp->unresolved_klass_at_put(index, class_index, num_klasses++);
+        }
+        break;
+      }
+      case JVM_CONSTANT_ValueIndex: {
+        const int class_index = cp->value_type_index_at(index);
+        check_property(valid_symbol_at(class_index),
+          "Invalid constant pool index %u in class file %s",
+          class_index, CHECK);
+        cp->unresolved_value_type_at_put(index, class_index, num_klasses++);
         break;
       }
       case JVM_CONSTANT_StringIndex: {
@@ -593,7 +629,8 @@
   for (index = 1; index < length; index++) {
     const jbyte tag = cp->tag_at(index).value();
     switch (tag) {
-      case JVM_CONSTANT_UnresolvedClass: {
+      case JVM_CONSTANT_UnresolvedClass:
+      case JVM_CONSTANT_UnresolvedValue: {
         const Symbol* const class_name = cp->klass_name_at(index);
         // check the name, even if _cp_patches will overwrite it
         verify_legal_class_name(class_name, CHECK);
@@ -3106,7 +3143,8 @@
     // Inner class index
     const u2 inner_class_info_index = cfs->get_u2_fast();
     check_property(
-      valid_klass_reference_at(inner_class_info_index),
+      (valid_klass_reference_at(inner_class_info_index) ||
+       ((EnableValhalla || EnableMVT) && valid_value_type_reference_at(inner_class_info_index))),
       "inner_class_info_index %u has bad constant type in class file %s",
       inner_class_info_index, CHECK_0);
     // Outer class index
@@ -3596,14 +3634,15 @@
                    super_class_index,
                    CHECK_NULL);
   } else {
-    check_property(valid_klass_reference_at(super_class_index),
+    check_property((valid_klass_reference_at(super_class_index) ||
+                    ((EnableValhalla || EnableMVT) && valid_value_type_reference_at(super_class_index))),
                    "Invalid superclass index %u in class file %s",
                    super_class_index,
                    CHECK_NULL);
     // The class name should be legal because it is checked when parsing constant pool.
     // However, make sure it is not an array type.
     bool is_array = false;
-    if (cp->tag_at(super_class_index).is_klass()) {
+    if (cp->tag_at(super_class_index).is_klass() || cp->tag_at(super_class_index).is_value_type()) {
       super_klass = InstanceKlass::cast(cp->resolved_klass_at(super_class_index));
       if (need_verify)
         is_array = super_klass->is_array_klass();
@@ -6068,8 +6107,9 @@
   // This class and superclass
   _this_class_index = stream->get_u2_fast();
   check_property(
-    valid_cp_range(_this_class_index, cp_size) &&
-      cp->tag_at(_this_class_index).is_unresolved_klass(),
+    (valid_cp_range(_this_class_index, cp_size) &&
+     (cp->tag_at(_this_class_index).is_unresolved_klass() ||
+      cp->tag_at(_this_class_index).is_unresolved_value_type())),
     "Invalid this class index %u in constant pool in class file %s",
     _this_class_index, CHECK);
 
@@ -6265,6 +6305,23 @@
       );
       return;
     }
+
+    // For a java/lang/__Value super class, the class inheriting, must be a value class
+    if ((EnableValhalla || EnableMVT) &&
+        _super_klass->name() == vmSymbols::java_lang____Value()) {
+      guarantee_property(_access_flags.get_flags() & JVM_ACC_VALUE,
+                         "Only a value class can inherit from java/lang/__Value",
+                         CHECK);
+    }
+
+    // For a value class, only java/lang/__Value is an acceptable super class
+    if ((EnableValhalla || EnableMVT) &&
+        _access_flags.get_flags() & JVM_ACC_VALUE) {
+      guarantee_property(_super_klass->name() == vmSymbols::java_lang____Value(),
+                         "Value class can only inherit java/lang/__Value",
+                         CHECK);
+    }
+
     // Make sure super class is not final
     if (_super_klass->is_final()
         && !(_super_klass->name() == vmSymbols::java_lang____Value()
--- a/src/share/vm/classfile/classFileParser.hpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/classfile/classFileParser.hpp	Tue Jul 25 16:57:58 2017 -0400
@@ -460,6 +460,11 @@
              _cp->tag_at(index).is_klass_or_reference();
   }
 
+  bool valid_value_type_reference_at(int index) const {
+    return _cp->is_within_bounds(index) &&
+             _cp->tag_at(index).is_value_type_or_reference();
+  }
+
   // Checks that the cpool index is in range and is a utf8
   bool valid_symbol_at(int cpool_index) const {
     return _cp->is_within_bounds(cpool_index) &&
--- a/src/share/vm/interpreter/bytecodeInterpreter.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/interpreter/bytecodeInterpreter.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -2360,12 +2360,15 @@
             }
 
           case JVM_CONSTANT_Class:
+          case JVM_CONSTANT_Value:
             VERIFY_OOP(constants->resolved_klass_at(index)->java_mirror());
             SET_STACK_OBJECT(constants->resolved_klass_at(index)->java_mirror(), 0);
             break;
 
           case JVM_CONSTANT_UnresolvedClass:
           case JVM_CONSTANT_UnresolvedClassInError:
+          case JVM_CONSTANT_UnresolvedValue:
+          case JVM_CONSTANT_UnresolvedValueInError:
             CALL_VM(InterpreterRuntime::ldc(THREAD, wide), handle_exception);
             SET_STACK_OBJECT(THREAD->vm_result(), 0);
             THREAD->set_vm_result(NULL);
--- a/src/share/vm/interpreter/bytecodeTracer.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/interpreter/bytecodeTracer.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -330,10 +330,12 @@
   } else if (tag.is_string()) {
     const char* string = constants->string_at_noresolve(i);
     st->print_cr(" %s", string);
-  } else if (tag.is_klass()) {
+  } else if (tag.is_klass() || tag.is_value_type()) {
     st->print_cr(" %s", constants->resolved_klass_at(i)->external_name());
   } else if (tag.is_unresolved_klass()) {
     st->print_cr(" <unresolved klass at %d>", i);
+  } else if (tag.is_unresolved_value_type()) {
+    st->print_cr(" <unresolved value type at %d>", i);
   } else if (tag.is_method_type()) {
     int i2 = constants->method_type_index_at(i);
     st->print(" <MethodType> %d", i2);
--- a/src/share/vm/interpreter/interpreterRuntime.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/interpreter/interpreterRuntime.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -113,7 +113,9 @@
   int index = wide ? get_index_u2(thread, Bytecodes::_ldc_w) : get_index_u1(thread, Bytecodes::_ldc);
   constantTag tag = pool->tag_at(index);
 
-  assert (tag.is_unresolved_klass() || tag.is_klass(), "wrong ldc call");
+  assert ((tag.is_unresolved_klass() || tag.is_klass() ||
+           tag.is_unresolved_value_type() || tag.is_value_type()),
+          "wrong ldc call");
   Klass* klass = pool->klass_at(index, CHECK);
     oop java_class = klass->java_mirror();
     thread->set_vm_result(java_class);
--- a/src/share/vm/jvmci/jvmciEnv.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/jvmci/jvmciEnv.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -150,7 +150,7 @@
   if (found_klass == NULL && !cpool.is_null() && cpool->has_preresolution()) {
     // Look inside the constant pool for pre-resolved class entries.
     for (int i = cpool->length() - 1; i >= 1; i--) {
-      if (cpool->tag_at(i).is_klass()) {
+      if (cpool->tag_at(i).is_klass() || cpool->tag_at(i).is_value_type()) {
         Klass*  kls = cpool->resolved_klass_at(i);
         if (kls->name() == sym) {
           return kls;
--- a/src/share/vm/jvmci/vmStructs_jvmci.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/jvmci/vmStructs_jvmci.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -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
@@ -393,6 +393,7 @@
   declare_constant(JVM_CONSTANT_Long)                                     \
   declare_constant(JVM_CONSTANT_Double)                                   \
   declare_constant(JVM_CONSTANT_Class)                                    \
+  declare_constant(JVM_CONSTANT_Value)                                    \
   declare_constant(JVM_CONSTANT_String)                                   \
   declare_constant(JVM_CONSTANT_Fieldref)                                 \
   declare_constant(JVM_CONSTANT_Methodref)                                \
@@ -406,9 +407,12 @@
   declare_constant(JVM_CONSTANT_Invalid)                                  \
   declare_constant(JVM_CONSTANT_InternalMin)                              \
   declare_constant(JVM_CONSTANT_UnresolvedClass)                          \
+  declare_constant(JVM_CONSTANT_UnresolvedValue)                          \
   declare_constant(JVM_CONSTANT_ClassIndex)                               \
+  declare_constant(JVM_CONSTANT_ValueIndex)                               \
   declare_constant(JVM_CONSTANT_StringIndex)                              \
   declare_constant(JVM_CONSTANT_UnresolvedClassInError)                   \
+  declare_constant(JVM_CONSTANT_UnresolvedValueInError)                   \
   declare_constant(JVM_CONSTANT_MethodHandleInError)                      \
   declare_constant(JVM_CONSTANT_MethodTypeInError)                        \
   declare_constant(JVM_CONSTANT_InternalMax)                              \
--- a/src/share/vm/oops/constantPool.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/oops/constantPool.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -168,11 +168,20 @@
         unresolved_klass_at_put(i, class_index, num_klasses++);
       }
       break;
+    case JVM_CONSTANT_ValueIndex:
+      {
+        const int class_index = value_type_index_at(i);
+        unresolved_value_type_at_put(i, class_index, num_klasses++);
+      }
+      break;
 #ifndef PRODUCT
     case JVM_CONSTANT_Class:
     case JVM_CONSTANT_UnresolvedClass:
     case JVM_CONSTANT_UnresolvedClassInError:
-      // All of these should have been reverted back to ClassIndex before calling
+    case JVM_CONSTANT_Value:
+    case JVM_CONSTANT_UnresolvedValue:
+    case JVM_CONSTANT_UnresolvedValueInError:
+      // All of these should have been reverted back to Unresolved before calling
       // this function.
       ShouldNotReachHere();
 #endif
@@ -197,9 +206,10 @@
   // The interpreter assumes when the tag is stored, the klass is resolved
   // and the Klass* non-NULL, so we need hardware store ordering here.
   if (k != NULL) {
-    release_tag_at_put(class_index, JVM_CONSTANT_Class);
+    release_tag_at_put(class_index, (k->is_value() ? (jbyte)JVM_CONSTANT_Value : JVM_CONSTANT_Class));
   } else {
-    release_tag_at_put(class_index, JVM_CONSTANT_UnresolvedClass);
+    release_tag_at_put(class_index, (tag_at(class_index).is_value_type_or_reference() ?
+                                       JVM_CONSTANT_UnresolvedValue : JVM_CONSTANT_UnresolvedClass));
   }
 }
 
@@ -213,7 +223,7 @@
 
   // The interpreter assumes when the tag is stored, the klass is resolved
   // and the Klass* non-NULL, so we need hardware store ordering here.
-  release_tag_at_put(class_index, JVM_CONSTANT_Class);
+  release_tag_at_put(class_index, (k->is_value() ? (jbyte)JVM_CONSTANT_Value : JVM_CONSTANT_Class));
 }
 
 // CDS support. Create a new resolved_references array.
@@ -309,12 +319,14 @@
   assert(this_cp->tag_at(name_index).is_symbol(), "sanity");
 
   Klass* klass = this_cp->resolved_klasses()->at(resolved_klass_index);
+
   if (klass != NULL) {
     return klass;
   }
 
   // This tag doesn't change back to unresolved class unless at a safepoint.
-  if (this_cp->tag_at(which).is_unresolved_klass_in_error()) {
+  if (this_cp->tag_at(which).is_unresolved_klass_in_error() ||
+      this_cp->tag_at(which).is_unresolved_value_type_in_error()) {
     // The original attempt to resolve this constant pool entry failed so find the
     // class of the original error and throw another error of the same class
     // (JVMS 5.4.3).
@@ -343,7 +355,10 @@
   // to resolve this constant pool entry fail with the same error (JVMS 5.4.3).
   if (HAS_PENDING_EXCEPTION) {
     if (save_resolution_error) {
-      save_and_throw_exception(this_cp, which, constantTag(JVM_CONSTANT_UnresolvedClass), CHECK_NULL);
+      bool is_value_type_tag = this_cp->tag_at(which).is_value_type_or_reference();
+      save_and_throw_exception(this_cp, which,
+                               constantTag((is_value_type_tag ? JVM_CONSTANT_UnresolvedValue : JVM_CONSTANT_UnresolvedClass)),
+                               CHECK_NULL);
       // If CHECK_NULL above doesn't return the exception, that means that
       // some other thread has beaten us and has resolved the class.
       // To preserve old behavior, we return the resolved class.
@@ -368,7 +383,7 @@
   // The interpreter assumes when the tag is stored, the klass is resolved
   // and the Klass* stored in _resolved_klasses is non-NULL, so we need
   // hardware store ordering here.
-  this_cp->release_tag_at_put(which, JVM_CONSTANT_Class);
+  this_cp->release_tag_at_put(which, (k->is_value() ? (jbyte)JVM_CONSTANT_Value : JVM_CONSTANT_Class));
   return k;
 }
 
@@ -604,7 +619,7 @@
 bool ConstantPool::resolve_class_constants(TRAPS) {
   constantPoolHandle cp(THREAD, this);
   for (int index = 1; index < length(); index++) { // Index 0 is unused
-    if (tag_at(index).is_unresolved_klass() &&
+    if ((tag_at(index).is_unresolved_klass() || tag_at(index).is_unresolved_value_type()) &&
         klass_at_if_loaded(cp, index) == NULL) {
       return false;
   }
@@ -623,6 +638,7 @@
   // Return specific message for the tag
   switch (tag.value()) {
   case JVM_CONSTANT_UnresolvedClass:
+  case JVM_CONSTANT_UnresolvedValue:
     // return the class name in the error message
     message = this_cp->klass_name_at(which);
     break;
@@ -677,7 +693,7 @@
                             (jbyte*)this_cp->tag_addr_at(which), (jbyte)tag.value());
     if (old_tag != error_tag && old_tag != tag.value()) {
       // MethodHandles and MethodType doesn't change to resolved version.
-      assert(this_cp->tag_at(which).is_klass(), "Wrong tag value");
+      assert(this_cp->tag_at(which).is_klass() || this_cp->tag_at(which).is_value_type(), "Wrong tag value");
       // Forget the exception and use the resolved class.
       CLEAR_PENDING_EXCEPTION;
     }
@@ -721,6 +737,9 @@
   case JVM_CONSTANT_UnresolvedClass:
   case JVM_CONSTANT_UnresolvedClassInError:
   case JVM_CONSTANT_Class:
+  case JVM_CONSTANT_UnresolvedValue:
+  case JVM_CONSTANT_UnresolvedValueInError:
+  case JVM_CONSTANT_Value:
     {
       assert(cache_index == _no_index_sentinel, "should not have been set");
       Klass* resolved = klass_at_impl(this_cp, index, true, CHECK_NULL);
@@ -951,6 +970,7 @@
 
   switch (t1) {
   case JVM_CONSTANT_Class:
+  case JVM_CONSTANT_Value:
   {
     Klass* k1 = klass_at(index1, CHECK_false);
     Klass* k2 = cp2->klass_at(index2, CHECK_false);
@@ -969,6 +989,16 @@
     }
   } break;
 
+  case JVM_CONSTANT_ValueIndex:
+  {
+    int recur1 = value_type_index_at(index1);
+    int recur2 = cp2->value_type_index_at(index2);
+    bool match = compare_entry_to(recur1, cp2, recur2, CHECK_false);
+    if (match) {
+      return true;
+    }
+  } break;
+
   case JVM_CONSTANT_Double:
   {
     jdouble d1 = double_at(index1);
@@ -1048,6 +1078,7 @@
   } break;
 
   case JVM_CONSTANT_UnresolvedClass:
+  case JVM_CONSTANT_UnresolvedValue:
   {
     Symbol* k1 = klass_name_at(index1);
     Symbol* k2 = cp2->klass_name_at(index2);
@@ -1305,6 +1336,12 @@
     to_cp->klass_index_at_put(to_i, ki);
   } break;
 
+  case JVM_CONSTANT_ValueIndex:
+  {
+    jint ki = from_cp->klass_index_at(from_i);
+    to_cp->klass_index_at_put(to_i, ki);
+  } break;
+
   case JVM_CONSTANT_Double:
   {
     jdouble d = from_cp->double_at(from_i);
@@ -1377,6 +1414,16 @@
     to_cp->klass_index_at_put(to_i, name_index);
   } break;
 
+  case JVM_CONSTANT_Value:
+  case JVM_CONSTANT_UnresolvedValue:
+  case JVM_CONSTANT_UnresolvedValueInError:
+  {
+    // Revert to JVM_CONSTANT_ValueIndex
+    int name_index = from_cp->klass_slot_at(from_i).name_index();
+    assert(from_cp->tag_at(name_index).is_symbol(), "sanity");
+    to_cp->value_type_index_at_put(to_i, name_index);
+  } break;
+
   case JVM_CONSTANT_String:
   {
     Symbol* s = from_cp->unresolved_string_at(from_i);
@@ -1492,7 +1539,8 @@
 
   if (tag.is_string()) {
     return string_at_noresolve(which);
-  } else if (tag.is_klass() || tag.is_unresolved_klass()) {
+  } else if (tag.is_klass() || tag.is_unresolved_klass() ||
+             tag.is_value_type() || tag.is_unresolved_value_type()) {
     return klass_name_at(which)->as_C_string();
   } else if (tag.is_symbol()) {
     return symbol_at(which)->as_C_string();
@@ -1574,6 +1622,12 @@
         ent_size = 2;
         break;
       }
+      case JVM_CONSTANT_Value: {
+        idx1 = Bytes::get_Java_u2(bytes);
+        printf("class        #%03d", idx1);
+        ent_size = 2;
+        break;
+      }
       case JVM_CONSTANT_String: {
         idx1 = Bytes::get_Java_u2(bytes);
         printf("String       #%03d", idx1);
@@ -1620,6 +1674,18 @@
         printf("UnresolvedClassInErr: %s", WARN_MSG);
         break;
       }
+      case JVM_CONSTANT_ValueIndex: {
+        printf("ValueIndex  %s", WARN_MSG);
+        break;
+      }
+      case JVM_CONSTANT_UnresolvedValue: {
+        printf("UnresolvedValue: %s", WARN_MSG);
+        break;
+      }
+      case JVM_CONSTANT_UnresolvedValueInError: {
+        printf("UnresolvedValueInErr: %s", WARN_MSG);
+        break;
+      }
       case JVM_CONSTANT_StringIndex: {
         printf("StringIndex: %s", WARN_MSG);
         break;
@@ -1650,6 +1716,10 @@
     case JVM_CONSTANT_ClassIndex:
     case JVM_CONSTANT_UnresolvedClass:
     case JVM_CONSTANT_UnresolvedClassInError:
+    case JVM_CONSTANT_Value:
+    case JVM_CONSTANT_ValueIndex:
+    case JVM_CONSTANT_UnresolvedValue:
+    case JVM_CONSTANT_UnresolvedValueInError:
     case JVM_CONSTANT_StringIndex:
     case JVM_CONSTANT_MethodType:
     case JVM_CONSTANT_MethodTypeInError:
@@ -1706,6 +1776,14 @@
         DBG(printf("adding class entry %s = %d\n", sym->as_utf8(), idx));
         break;
       }
+      case JVM_CONSTANT_Value:
+      case JVM_CONSTANT_UnresolvedValue:
+      case JVM_CONSTANT_UnresolvedValueInError: {
+        Symbol* sym = klass_name_at(idx);
+        classmap->add_entry(sym, idx);
+        DBG(printf("adding value type entry %s = %d\n", sym->as_utf8(), idx));
+        break;
+      }
       case JVM_CONSTANT_Long:
       case JVM_CONSTANT_Double: {
         idx++; // Both Long and Double take two cpool slots
@@ -1793,6 +1871,17 @@
         DBG(printf("JVM_CONSTANT_Class: idx=#%03hd, %s", idx1, sym->as_utf8()));
         break;
       }
+      case JVM_CONSTANT_Value:
+      case JVM_CONSTANT_UnresolvedValue:
+      case JVM_CONSTANT_UnresolvedValueInError: {
+        *bytes = JVM_CONSTANT_Value;
+        Symbol* sym = klass_name_at(idx);
+        idx1 = tbl->symbol_to_value(sym);
+        assert(idx1 != 0, "Have not found a hashtable entry");
+        Bytes::put_Java_u2((address) (bytes+1), idx1);
+        DBG(printf("JVM_CONSTANT_Value: idx=#%03hd, %s", idx1, sym->as_utf8()));
+        break;
+      }
       case JVM_CONSTANT_String: {
         *bytes = JVM_CONSTANT_String;
         Symbol* sym = unresolved_string_at(idx);
@@ -1827,6 +1916,13 @@
         DBG(printf("JVM_CONSTANT_ClassIndex: %hd", idx1));
         break;
       }
+      case JVM_CONSTANT_ValueIndex: {
+        *bytes = JVM_CONSTANT_Value;
+        idx1 = value_type_index_at(idx);
+        Bytes::put_Java_u2((address) (bytes+1), idx1);
+        DBG(printf("JVM_CONSTANT_ValueIndex: %hd", idx1));
+        break;
+      }
       case JVM_CONSTANT_StringIndex: {
         *bytes = JVM_CONSTANT_String;
         idx1 = string_index_at(idx);
@@ -1934,7 +2030,8 @@
   guarantee(cp->pool_holder() != NULL, "must be fully loaded");
 
   for (int i = 0; i< cp->length();  i++) {
-    if (cp->tag_at(i).is_unresolved_klass()) {
+    if (cp->tag_at(i).is_unresolved_klass() ||
+        cp->tag_at(i).is_unresolved_value_type()) {
       // This will force loading of the class
       Klass* klass = cp->klass_at(i, CHECK);
       if (klass->is_instance_klass()) {
@@ -1993,6 +2090,13 @@
         st->print(" {" PTR_FORMAT "}", p2i(k));
       }
       break;
+    case JVM_CONSTANT_Value :
+      { Klass* k = klass_at(index, CATCH);
+        guarantee(k != NULL, "need klass");
+        k->print_value_on(st);
+        st->print(" {" PTR_FORMAT "}", p2i(k));
+      }
+      break;
     case JVM_CONSTANT_Fieldref :
     case JVM_CONSTANT_Methodref :
     case JVM_CONSTANT_InterfaceMethodref :
@@ -2027,14 +2131,17 @@
     case JVM_CONSTANT_Utf8 :
       symbol_at(index)->print_value_on(st);
       break;
-    case JVM_CONSTANT_ClassIndex: {
+    case JVM_CONSTANT_ClassIndex:
+    case JVM_CONSTANT_ValueIndex: {
         int name_index = *int_at_addr(index);
         st->print("klass_index=%d ", name_index);
         symbol_at(name_index)->print_value_on(st);
       }
       break;
     case JVM_CONSTANT_UnresolvedClass :               // fall-through
-    case JVM_CONSTANT_UnresolvedClassInError: {
+    case JVM_CONSTANT_UnresolvedClassInError :
+    case JVM_CONSTANT_UnresolvedValue :
+    case JVM_CONSTANT_UnresolvedValueInError : {
         CPKlassSlot kslot = klass_slot_at(index);
         int resolved_klass_index = kslot.resolved_klass_index();
         int name_index = kslot.name_index();
@@ -2116,7 +2223,8 @@
   guarantee(is_constantPool(), "object must be constant pool");
   for (int i = 0; i< length();  i++) {
     constantTag tag = tag_at(i);
-    if (tag.is_klass() || tag.is_unresolved_klass()) {
+    if (tag.is_klass() || tag.is_unresolved_klass() ||
+        tag.is_value_type() || tag.is_unresolved_value_type()) {
       guarantee(klass_name_at(i)->refcount() != 0, "should have nonzero reference count");
     } else if (tag.is_symbol()) {
       CPSlot entry = slot_at(i);
--- a/src/share/vm/oops/constantPool.hpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/oops/constantPool.hpp	Tue Jul 25 16:57:58 2017 -0400
@@ -62,8 +62,9 @@
   }
 };
 
-// This represents a JVM_CONSTANT_Class, JVM_CONSTANT_UnresolvedClass, or
-// JVM_CONSTANT_UnresolvedClassInError slot in the constant pool.
+// This represents a (JVM_CONSTANT_Class, JVM_CONSTANT_UnresolvedClass or JVM_CONSTANT_UnresolvedClassInError) or
+//                   (JVM_CONSTANT_Value, JVM_CONSTANT_UnresolvedValue or JVM_CONSTANT_UnresolvedValueInError)
+// slot in the constant pool.
 class CPKlassSlot VALUE_OBJ_CLASS_SPEC {
   // cp->symbol_at(_name_index) gives the name of the class.
   int _name_index;
@@ -139,7 +140,8 @@
 
   CPSlot slot_at(int which) const {
     assert(is_within_bounds(which), "index out of bounds");
-    assert(!tag_at(which).is_unresolved_klass() && !tag_at(which).is_unresolved_klass_in_error(), "Corrupted constant pool");
+    assert(!tag_at(which).is_unresolved_klass() && !tag_at(which).is_unresolved_klass_in_error() &&
+           !tag_at(which).is_unresolved_value_type() && !tag_at(which).is_unresolved_value_type_in_error(), "Corrupted constant pool");
     // Uses volatile because the klass slot changes without a lock.
     volatile intptr_t adr = (intptr_t)OrderAccess::load_ptr_acquire(obj_at_addr_raw(which));
     assert(adr != 0 || which == 0, "cp entry for klass should not be zero");
@@ -259,12 +261,18 @@
 
   // Storing constants
 
-  // For temporary use while constructing constant pool
+  // For temporary use while constructing constant pool. Used during a retransform/class redefinition as well.
   void klass_index_at_put(int which, int name_index) {
     tag_at_put(which, JVM_CONSTANT_ClassIndex);
     *int_at_addr(which) = name_index;
   }
 
+  // For temporary use while constructing constant pool. Used during a retransform/class redefinition as well.
+  void value_type_index_at_put(int which, int name_index) {
+    tag_at_put(which, JVM_CONSTANT_ValueIndex);
+    *int_at_addr(which) = name_index;
+  }
+
   // Anonymous class support:
   void klass_at_put(int class_index, int name_index, int resolved_klass_index, Klass* k, Symbol* name);
   void klass_at_put(int class_index, Klass* k);
@@ -278,6 +286,15 @@
       build_int_from_shorts((jushort)resolved_klass_index, (jushort)name_index);
   }
 
+  void unresolved_value_type_at_put(int which, int name_index, int resolved_klass_index) {
+    release_tag_at_put(which, JVM_CONSTANT_UnresolvedValue);
+
+    assert((name_index & 0xffff0000) == 0, "must be");
+    assert((resolved_klass_index & 0xffff0000) == 0, "must be");
+    *int_at_addr(which) =
+      build_int_from_shorts((jushort)resolved_klass_index, (jushort)name_index);
+  }
+
   void method_handle_index_at_put(int which, int ref_kind, int ref_index) {
     tag_at_put(which, JVM_CONSTANT_MethodHandle);
     *int_at_addr(which) = ((jint) ref_index<<16) | ref_kind;
@@ -378,7 +395,8 @@
   }
 
   CPKlassSlot klass_slot_at(int which) const {
-    assert(tag_at(which).is_unresolved_klass() || tag_at(which).is_klass(),
+    assert(tag_at(which).is_unresolved_klass() || tag_at(which).is_klass() ||
+           tag_at(which).is_unresolved_value_type() || tag_at(which).is_value_type(),
            "Corrupted constant pool");
     int value = *int_at_addr(which);
     int name_index = extract_high_short_from_int(value);
@@ -392,7 +410,7 @@
   }
 
   Klass* resolved_klass_at(int which) const {  // Used by Compiler
-    guarantee(tag_at(which).is_klass(), "Corrupted constant pool");
+    guarantee(tag_at(which).is_klass() || tag_at(which).is_value_type(), "Corrupted constant pool");
     // Must do an acquire here in case another thread resolved the klass
     // behind our back, lest we later load stale values thru the oop.
     CPKlassSlot kslot = klass_slot_at(which);
@@ -409,6 +427,11 @@
     // will be initialized later by a call to initialize_unresolved_klasses().
     unresolved_klass_at_put(which, name_index, CPKlassSlot::_temp_resolved_klass_index);
   }
+  void temp_unresolved_value_type_at_put(int which, int name_index) {
+    // Used only during constant pool merging for class redefinition. The resolved klass index
+    // will be initialized later by a call to initialize_unresolved_klasses().
+    unresolved_value_type_at_put(which, name_index, CPKlassSlot::_temp_resolved_klass_index);
+  }
 
   jint int_at(int which) {
     assert(tag_at(which).is_int(), "Corrupted constant pool");
@@ -830,6 +853,11 @@
     return *int_at_addr(which);
   }
 
+  jint value_type_index_at(int which) {
+    assert(tag_at(which).is_value_type_index(), "Corrupted constant pool");
+    return *int_at_addr(which);
+  }
+
   jint string_index_at(int which) {
     assert(tag_at(which).is_string_index(), "Corrupted constant pool");
     return *int_at_addr(which);
--- a/src/share/vm/oops/generateOopMap.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/oops/generateOopMap.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1914,7 +1914,7 @@
   BasicType       bt  = ldc.result_type();
   CellTypeState   cts;
   if (tag.basic_type() == T_OBJECT) {
-    assert(!tag.is_string_index() && !tag.is_klass_index(), "Unexpected index tag");
+    assert(!tag.is_string_index() && !tag.is_klass_index() && !tag.is_value_type_index(), "Unexpected index tag");
     assert(bt == T_OBJECT, "Guard is incorrect");
     cts = CellTypeState::make_line_ref(bci);
   } else {
--- a/src/share/vm/oops/method.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/oops/method.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -741,7 +741,8 @@
 
 
 bool Method::is_klass_loaded_by_klass_index(int klass_index) const {
-  if( constants()->tag_at(klass_index).is_unresolved_klass() ) {
+  if( constants()->tag_at(klass_index).is_unresolved_klass() ||
+      constants()->tag_at(klass_index).is_unresolved_value_type() ) {
     Thread *thread = Thread::current();
     Symbol* klass_name = constants()->klass_name_at(klass_index);
     Handle loader(thread, method_holder()->class_loader());
@@ -757,7 +758,10 @@
   int klass_index = constants()->klass_ref_index_at(refinfo_index);
   if (must_be_resolved) {
     // Make sure klass is resolved in constantpool.
-    if (constants()->tag_at(klass_index).is_unresolved_klass()) return false;
+    if (constants()->tag_at(klass_index).is_unresolved_klass() ||
+        constants()->tag_at(klass_index).is_unresolved_value_type()) {
+      return false;
+    }
   }
   return is_klass_loaded_by_klass_index(klass_index);
 }
--- a/src/share/vm/prims/jvm.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/prims/jvm.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -1952,7 +1952,8 @@
   constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   constantTag tag = cp->tag_at(index);
-  if (!tag.is_klass() && !tag.is_unresolved_klass()) {
+  if (!tag.is_klass() && !tag.is_unresolved_klass() &&
+      !tag.is_value_type() && !tag.is_unresolved_value_type()) {
     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
   }
   Klass* k = cp->klass_at(index, CHECK_NULL);
@@ -1966,7 +1967,8 @@
   constantPoolHandle cp = constantPoolHandle(THREAD, reflect_ConstantPool::get_cp(JNIHandles::resolve_non_null(obj)));
   bounds_check(cp, index, CHECK_NULL);
   constantTag tag = cp->tag_at(index);
-  if (!tag.is_klass() && !tag.is_unresolved_klass()) {
+  if (!tag.is_klass() && !tag.is_unresolved_klass() &&
+      !tag.is_value_type() && !tag.is_unresolved_value_type()) {
     THROW_MSG_0(vmSymbols::java_lang_IllegalArgumentException(), "Wrong type at constant pool index");
   }
   Klass* k = ConstantPool::klass_at_if_loaded(cp, index);
@@ -2243,6 +2245,9 @@
   // sun.reflect.ConstantPool will return only tags from the JVM spec, not internal ones.
   if (tag.is_klass_or_reference()) {
       result = JVM_CONSTANT_Class;
+  } else if (tag.is_value_type_or_reference()) {
+      // Return Class, JVM_CONSTANT_Value not externally visible
+      result = JVM_CONSTANT_Class;
   } else if (tag.is_string_index()) {
       result = JVM_CONSTANT_String;
   } else if (tag.is_method_type_in_error()) {
@@ -2357,7 +2362,8 @@
     ConstantPool* cp = InstanceKlass::cast(k)->constants();
     for (int index = cp->length() - 1; index >= 0; index--) {
       constantTag tag = cp->tag_at(index);
-      types[index] = (tag.is_unresolved_klass()) ? JVM_CONSTANT_Class : tag.value();
+      // For a value type return Class, JVM_CONSTANT_Value not externally visible
+      types[index] = (tag.is_unresolved_klass() || tag.is_unresolved_value_type()) ? JVM_CONSTANT_Class : tag.value();
     }
   }
 JVM_END
--- a/src/share/vm/prims/jvmtiRedefineClasses.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/prims/jvmtiRedefineClasses.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -316,6 +316,29 @@
       (*merge_cp_length_p)++;
     } break;
 
+    // this is an indirect CP entry so it needs special handling
+    case JVM_CONSTANT_Value:
+    case JVM_CONSTANT_UnresolvedValue:
+    {
+      int name_i = scratch_cp->klass_name_index_at(scratch_i);
+      int new_name_i = find_or_append_indirect_entry(scratch_cp, name_i, merge_cp_p,
+                                                     merge_cp_length_p, THREAD);
+
+      if (new_name_i != name_i) {
+        log_trace(redefine, class, constantpool)
+          ("Value type entry@%d name_index change: %d to %d",
+           *merge_cp_length_p, name_i, new_name_i);
+      }
+
+      (*merge_cp_p)->temp_unresolved_value_type_at_put(*merge_cp_length_p, new_name_i);
+      if (scratch_i != *merge_cp_length_p) {
+        // The new entry in *merge_cp_p is at a different index than
+        // the new entry in scratch_cp so we need to map the index values.
+        map_index(scratch_cp, scratch_i, *merge_cp_length_p);
+      }
+      (*merge_cp_length_p)++;
+    } break;
+
     // these are direct CP entries so they can be directly appended,
     // but double and long take two constant pool entries
     case JVM_CONSTANT_Double:  // fall through
@@ -513,6 +536,7 @@
     // At this stage, Class or UnresolvedClass could be in scratch_cp, but not
     // ClassIndex
     case JVM_CONSTANT_ClassIndex: // fall through
+    case JVM_CONSTANT_ValueIndex: // fall through
 
     // Invalid is used as the tag for the second constant pool entry
     // occupied by JVM_CONSTANT_Double or JVM_CONSTANT_Long. It should
@@ -522,10 +546,12 @@
     // At this stage, String could be here, but not StringIndex
     case JVM_CONSTANT_StringIndex: // fall through
 
-    // At this stage JVM_CONSTANT_UnresolvedClassInError should not be
-    // here
+    // At this stage JVM_CONSTANT_UnresolvedClassInError should not be here
     case JVM_CONSTANT_UnresolvedClassInError: // fall through
 
+    // At this stage JVM_CONSTANT_UnresolvedValueInError should not be here
+    case JVM_CONSTANT_UnresolvedValueInError: // fall through
+
     default:
     {
       // leave a breadcrumb
@@ -973,12 +999,14 @@
        int index1, const constantPoolHandle& cp2, int index2) {
 
   jbyte t1 = cp1->tag_at(index1).value();
-  if (t1 != JVM_CONSTANT_Class && t1 != JVM_CONSTANT_UnresolvedClass) {
+  if (t1 != JVM_CONSTANT_Class && t1 != JVM_CONSTANT_UnresolvedClass &&
+      t1 != JVM_CONSTANT_Value && t1 != JVM_CONSTANT_UnresolvedValue) {
     return false;  // wrong entry type; not our special case
   }
 
   jbyte t2 = cp2->tag_at(index2).value();
-  if (t2 != JVM_CONSTANT_Class && t2 != JVM_CONSTANT_UnresolvedClass) {
+  if (t2 != JVM_CONSTANT_Class && t2 != JVM_CONSTANT_UnresolvedClass &&
+      t2 != JVM_CONSTANT_Value && t2 != JVM_CONSTANT_UnresolvedValue) {
     return false;  // wrong entry type; not our special case
   }
 
@@ -1262,6 +1290,7 @@
     // perfect fit for ConstantPool*::copy_cp_to(), but we need to
     // handle one special case:
     // - revert JVM_CONSTANT_Class to JVM_CONSTANT_UnresolvedClass
+    // - revert JVM_CONSTANT_Value to JVM_CONSTANT_UnresolvedValue
     // This will make verification happy.
 
     int old_i;  // index into old_cp
@@ -1280,6 +1309,15 @@
           old_cp->klass_name_index_at(old_i));
         break;
 
+      case JVM_CONSTANT_Value:
+      case JVM_CONSTANT_UnresolvedValue:
+        // revert the copy to JVM_CONSTANT_UnresolvedValue
+        // May be resolving while calling this so do the same for
+        // JVM_CONSTANT_UnresolvedValue (klass_name_at() deals with transition)
+        (*merge_cp_p)->temp_unresolved_value_type_at_put(old_i,
+          old_cp->klass_name_index_at(old_i));
+        break;
+
       case JVM_CONSTANT_Double:
       case JVM_CONSTANT_Long:
         // just copy the entry to *merge_cp_p, but double and long take
--- a/src/share/vm/prims/jvmtiTagMap.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/prims/jvmtiTagMap.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -2892,7 +2892,7 @@
       ConstantPool* pool = ik->constants();
       for (int i = 1; i < pool->length(); i++) {
         constantTag tag = pool->tag_at(i).value();
-        if (tag.is_string() || tag.is_klass()) {
+        if (tag.is_string() || tag.is_klass() || tag.is_value_type()) {
           oop entry;
           if (tag.is_string()) {
             entry = pool->resolved_string_at(i);
--- a/src/share/vm/prims/methodComparator.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/prims/methodComparator.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 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
@@ -278,9 +278,11 @@
       return false;
     if (_old_cp->is_pseudo_string_at(cpi_old) || _new_cp->is_pseudo_string_at(cpi_new))
       return (_old_cp->is_pseudo_string_at(cpi_old) == _new_cp->is_pseudo_string_at(cpi_new));
-  } else if (tag_old.is_klass() || tag_old.is_unresolved_klass()) {
+  } else if (tag_old.is_klass() || tag_old.is_unresolved_klass() ||
+             tag_old.is_value_type() || tag_old.is_unresolved_value_type()) {
     // tag_old should be klass - 4881222
-    if (! (tag_new.is_unresolved_klass() || tag_new.is_klass()))
+    if (! (tag_new.is_unresolved_klass() || tag_new.is_klass() ||
+           tag_new.is_unresolved_value_type() || tag_new.is_value_type()))
       return false;
     if (_old_cp->klass_at_noresolve(cpi_old) !=
         _new_cp->klass_at_noresolve(cpi_new))
--- a/src/share/vm/runtime/deoptimization.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/runtime/deoptimization.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -1507,7 +1507,8 @@
 #if defined(COMPILER2) || defined(SHARK) || INCLUDE_JVMCI
 void Deoptimization::load_class_by_index(const constantPoolHandle& constant_pool, int index, TRAPS) {
   // in case of an unresolved klass entry, load the class.
-  if (constant_pool->tag_at(index).is_unresolved_klass()) {
+  if (constant_pool->tag_at(index).is_unresolved_klass() ||
+      constant_pool->tag_at(index).is_unresolved_value_type()) {
     Klass* tk = constant_pool->klass_at_ignore_error(index, CHECK);
     return;
   }
@@ -1696,7 +1697,8 @@
       bool unresolved = false;
       if (unloaded_class_index >= 0) {
         constantPoolHandle constants (THREAD, trap_method->constants());
-        if (constants->tag_at(unloaded_class_index).is_unresolved_klass()) {
+        if (constants->tag_at(unloaded_class_index).is_unresolved_klass() ||
+            constants->tag_at(unloaded_class_index).is_unresolved_value_type()) {
           class_name = constants->klass_name_at(unloaded_class_index);
           unresolved = true;
           if (xtty != NULL)
--- a/src/share/vm/runtime/vmStructs.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/runtime/vmStructs.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -2408,10 +2408,14 @@
   declare_constant(JVM_CONSTANT_InternalMin)                              \
   declare_constant(JVM_CONSTANT_UnresolvedClass)                          \
   declare_constant(JVM_CONSTANT_ClassIndex)                               \
+  declare_constant(JVM_CONSTANT_ValueIndex)                               \
   declare_constant(JVM_CONSTANT_StringIndex)                              \
   declare_constant(JVM_CONSTANT_UnresolvedClassInError)                   \
   declare_constant(JVM_CONSTANT_MethodHandleInError)                      \
   declare_constant(JVM_CONSTANT_MethodTypeInError)                        \
+  declare_constant(JVM_CONSTANT_Value)                                    \
+  declare_constant(JVM_CONSTANT_UnresolvedValue)                          \
+  declare_constant(JVM_CONSTANT_UnresolvedValueInError)                   \
   declare_constant(JVM_CONSTANT_InternalMax)                              \
                                                                           \
   /*****************************/                                         \
--- a/src/share/vm/utilities/constantTag.cpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/utilities/constantTag.cpp	Tue Jul 25 16:57:58 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -56,6 +56,13 @@
     case JVM_CONSTANT_MethodType :
     case JVM_CONSTANT_MethodTypeInError :
       return T_OBJECT;
+
+    case JVM_CONSTANT_Value :
+    case JVM_CONSTANT_ValueIndex :
+    case JVM_CONSTANT_UnresolvedValue :
+    case JVM_CONSTANT_UnresolvedValueInError :
+      return T_OBJECT; // Should this eventually be migrated to T_VALUETYPE?
+
     default:
       ShouldNotReachHere();
       return T_ILLEGAL;
@@ -67,6 +74,8 @@
   switch (_tag) {
   case JVM_CONSTANT_UnresolvedClassInError:
     return JVM_CONSTANT_UnresolvedClass;
+  case JVM_CONSTANT_UnresolvedValueInError:
+    return JVM_CONSTANT_UnresolvedValue;
   case JVM_CONSTANT_MethodHandleInError:
     return JVM_CONSTANT_MethodHandle;
   case JVM_CONSTANT_MethodTypeInError:
@@ -81,6 +90,8 @@
   switch (_tag) {
   case JVM_CONSTANT_UnresolvedClass:
     return JVM_CONSTANT_UnresolvedClassInError;
+  case JVM_CONSTANT_UnresolvedValue:
+    return JVM_CONSTANT_UnresolvedValueInError;
   case JVM_CONSTANT_MethodHandle:
     return JVM_CONSTANT_MethodHandleInError;
   case JVM_CONSTANT_MethodType:
@@ -135,6 +146,12 @@
       return "Unresolved Class Index";
     case JVM_CONSTANT_StringIndex :
       return "Unresolved String Index";
+    case JVM_CONSTANT_Value :
+      return "Value Type";
+    case JVM_CONSTANT_UnresolvedValue :
+      return "Unresolved Value Type";
+    case JVM_CONSTANT_UnresolvedValueInError :
+      return "Unresolved Value Type Error";
     default:
       ShouldNotReachHere();
       return "Illegal";
--- a/src/share/vm/utilities/constantTag.hpp	Thu Jul 20 10:42:05 2017 +0200
+++ b/src/share/vm/utilities/constantTag.hpp	Tue Jul 25 16:57:58 2017 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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,12 +38,16 @@
   JVM_CONSTANT_Invalid                  = 0,    // For bad value initialization
   JVM_CONSTANT_InternalMin              = 100,  // First implementation tag (aside from bad value of course)
   JVM_CONSTANT_UnresolvedClass          = 100,  // Temporary tag until actual use
-  JVM_CONSTANT_ClassIndex               = 101,  // Temporary tag while constructing constant pool
-  JVM_CONSTANT_StringIndex              = 102,  // Temporary tag while constructing constant pool
+  JVM_CONSTANT_ClassIndex               = 101,  // Temporary tag while constructing constant pool, class redefinition
+  JVM_CONSTANT_StringIndex              = 102,  // Temporary tag while constructing constant pool, class redefinition
   JVM_CONSTANT_UnresolvedClassInError   = 103,  // Error tag due to resolution error
   JVM_CONSTANT_MethodHandleInError      = 104,  // Error tag due to resolution error
   JVM_CONSTANT_MethodTypeInError        = 105,  // Error tag due to resolution error
-  JVM_CONSTANT_InternalMax              = 105   // Last implementation tag
+  JVM_CONSTANT_Value                    = 106,  // Internal derived value type
+  JVM_CONSTANT_ValueIndex               = 107,  // Temporary tag while construction constant pool, class redefinition
+  JVM_CONSTANT_UnresolvedValue          = 108,  // Temporary tag until actual use of derived value type
+  JVM_CONSTANT_UnresolvedValueInError   = 109,  // Error tag due to resolution error
+  JVM_CONSTANT_InternalMax              = 109   // Last implementation tag
 };
 
 
@@ -52,6 +56,7 @@
   jbyte _tag;
  public:
   bool is_klass() const             { return _tag == JVM_CONSTANT_Class; }
+  bool is_value_type() const        { return _tag == JVM_CONSTANT_Value; }
   bool is_field () const            { return _tag == JVM_CONSTANT_Fieldref; }
   bool is_method() const            { return _tag == JVM_CONSTANT_Methodref; }
   bool is_interface_method() const  { return _tag == JVM_CONSTANT_InterfaceMethodref; }
@@ -73,6 +78,14 @@
     return _tag == JVM_CONSTANT_UnresolvedClassInError;
   }
 
+  bool is_unresolved_value_type() const {
+    return _tag == JVM_CONSTANT_UnresolvedValue || _tag == JVM_CONSTANT_UnresolvedValueInError;
+  }
+
+  bool is_unresolved_value_type_in_error() const {
+    return _tag == JVM_CONSTANT_UnresolvedValueInError;
+  }
+
   bool is_method_handle_in_error() const {
     return _tag == JVM_CONSTANT_MethodHandleInError;
   }
@@ -81,6 +94,7 @@
   }
 
   bool is_klass_index() const       { return _tag == JVM_CONSTANT_ClassIndex; }
+  bool is_value_type_index() const  { return _tag == JVM_CONSTANT_ValueIndex; }
   bool is_string_index() const      { return _tag == JVM_CONSTANT_StringIndex; }
 
   bool is_klass_reference() const   { return is_klass_index() || is_unresolved_klass(); }
@@ -88,6 +102,8 @@
   bool is_field_or_method() const   { return is_field() || is_method() || is_interface_method(); }
   bool is_symbol() const            { return is_utf8(); }
 
+  bool is_value_type_or_reference() const { return is_value_type_index() || is_value_type() || is_unresolved_value_type(); }
+
   bool is_method_type() const              { return _tag == JVM_CONSTANT_MethodType; }
   bool is_method_handle() const            { return _tag == JVM_CONSTANT_MethodHandle; }
   bool is_invoke_dynamic() const           { return _tag == JVM_CONSTANT_InvokeDynamic; }
--- a/test/runtime/valhalla/valuetypes/UninitializedValueFieldsTest.java	Thu Jul 20 10:42:05 2017 +0200
+++ b/test/runtime/valhalla/valuetypes/UninitializedValueFieldsTest.java	Tue Jul 25 16:57:58 2017 -0400
@@ -3,11 +3,11 @@
 import jdk.test.lib.Asserts;
 
 /*
- * @test 
+ * @test
  * @summary Uninitialized value fields test
  * @library /test/lib
  * @compile -XDenableValueTypes Point.java UninitializedValueFieldsTest.java
- * @run main/othervm -noverify -Xint runtime.valhalla.valuetypes.UninitializedValueFieldsTest
+ * @run main/othervm -noverify -Xint -XX:+EnableValhalla runtime.valhalla.valuetypes.UninitializedValueFieldsTest
  */
 
 /*
@@ -21,17 +21,17 @@
     UninitializedValueFieldsTest() { }
 
     public static void main(String[] args) {
-	checkUninitializedPoint(UninitializedValueFieldsTest.staticPoint, 0, 0);
-	UninitializedValueFieldsTest.staticPoint = Point.createPoint(456, 678);
-	checkUninitializedPoint(UninitializedValueFieldsTest.staticPoint, 456, 678);
-	UninitializedValueFieldsTest test = new UninitializedValueFieldsTest();
-	checkUninitializedPoint(test.instancePoint, 0, 0);
-	test.instancePoint = Point.createPoint(123, 345);
-	checkUninitializedPoint(test.instancePoint, 123, 345);
+        checkUninitializedPoint(UninitializedValueFieldsTest.staticPoint, 0, 0);
+        UninitializedValueFieldsTest.staticPoint = Point.createPoint(456, 678);
+        checkUninitializedPoint(UninitializedValueFieldsTest.staticPoint, 456, 678);
+        UninitializedValueFieldsTest test = new UninitializedValueFieldsTest();
+        checkUninitializedPoint(test.instancePoint, 0, 0);
+        test.instancePoint = Point.createPoint(123, 345);
+        checkUninitializedPoint(test.instancePoint, 123, 345);
     }
 
     static void checkUninitializedPoint(Point p, int x, int y) {
-	Asserts.assertEquals(p.x, x, "invalid x value");
-	Asserts.assertEquals(p.y, y, "invalid y value");
+        Asserts.assertEquals(p.x, x, "invalid x value");
+        Asserts.assertEquals(p.y, y, "invalid y value");
     }
 }
--- a/test/runtime/valhalla/valuetypes/VTBufferTest.java	Thu Jul 20 10:42:05 2017 +0200
+++ b/test/runtime/valhalla/valuetypes/VTBufferTest.java	Tue Jul 25 16:57:58 2017 -0400
@@ -26,9 +26,9 @@
  * @summary Value Type interpreter value buffering test
  * @library /test/lib
  * @build ValueTypeGenerator
- * @run main/othervm -noverify -Xint VTBufferTest generate-and-run
- * @run main/othervm -noverify -Xint -XX:ValueTypesBufferMaxMemory=0 VTBufferTest generate-and-run
- * @run main/othervm -noverify -Xint -XX:BigValueTypeThreshold=196 VTBufferTest generate-and-run
+ * @run main/othervm -noverify -Xint -XX:+EnableValhalla VTBufferTest generate-and-run
+ * @run main/othervm -noverify -Xint -XX:+EnableValhalla -XX:ValueTypesBufferMaxMemory=0 VTBufferTest generate-and-run
+ * @run main/othervm -noverify -Xint -XX:+EnableValhalla -XX:BigValueTypeThreshold=196 VTBufferTest generate-and-run
  */
 
 /* This test generates its source code.
@@ -230,8 +230,8 @@
 
             JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
             StandardJavaFileManager fileManager = compiler.getStandardFileManager(null, null, null);
-	    List<String> optionList = new ArrayList<String>();
-	    optionList.addAll(Arrays.asList("-classpath",".","-XDenableValueTypes"));
+            List<String> optionList = new ArrayList<String>();
+            optionList.addAll(Arrays.asList("-classpath",".","-XDenableValueTypes"));
 
             Iterable<? extends JavaFileObject> compilationUnits1 =
                     fileManager.getJavaFileObjectsFromFiles(Arrays.asList(valueSources));
@@ -245,7 +245,7 @@
         if (execute) {
             startTime = ManagementFactory.getRuntimeMXBean().getUptime();
 
-	    ClassLoader cl = createClassLoader();
+            ClassLoader cl = createClassLoader();
             try {
                 iterate(100, 5000, cl);
             } catch(InvocationTargetException e) {
@@ -280,18 +280,18 @@
 
 
     ClassLoader createClassLoader() {
-	try{
-	    File file = new File(".");
-	    URL url = file.toURI().toURL();
-	    URL[] urls = new URL[]{url};
-	    ClassLoader cl = new URLClassLoader(urls);
-	    return cl;
-	} catch(Exception ex){
-	    ex.printStackTrace();
-	}
-	return null;
+        try{
+            File file = new File(".");
+            URL url = file.toURI().toURL();
+            URL[] urls = new URL[]{url};
+            ClassLoader cl = new URLClassLoader(urls);
+            return cl;
+        } catch(Exception ex){
+            ex.printStackTrace();
+        }
+        return null;
     }
-    
+
     public void iterate(int n, int m, ClassLoader cl) throws InvocationTargetException {
         for (int i = 0; i < n; i++) {
             Class loop = null;
@@ -319,22 +319,21 @@
     }
 
     public void printVTBufferStats() {
-	MBeanServerConnection mbs = ManagementFactory.getPlatformMBeanServer();
-	String MBeanName = "com.sun.management:type=DiagnosticCommand";
-	ObjectName beanName;
-	try {
+        MBeanServerConnection mbs = ManagementFactory.getPlatformMBeanServer();
+        String MBeanName = "com.sun.management:type=DiagnosticCommand";
+        ObjectName beanName;
+        try {
             beanName = new ObjectName(MBeanName);
         } catch (MalformedObjectNameException e) {
             String message = "MBean not found: " + MBeanName;
             throw new RuntimeException(message, e);
         }
-	String result = null;
-	try {
-	    result = (String)mbs.invoke(beanName,"vtbufferStats",new Object[0],new String[0]);
-	} catch(Exception e) {
-	    e.printStackTrace();
-	}
-	System.out.println(result);
+        String result = null;
+        try {
+            result = (String)mbs.invoke(beanName,"vtbufferStats",new Object[0],new String[0]);
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+        System.out.println(result);
     }
-
 }
--- a/test/runtime/valhalla/valuetypes/ValueTypeGetField.java	Thu Jul 20 10:42:05 2017 +0200
+++ b/test/runtime/valhalla/valuetypes/ValueTypeGetField.java	Tue Jul 25 16:57:58 2017 -0400
@@ -7,8 +7,8 @@
  * @summary Value Type get field test
  * @library /test/lib
  * @compile -XDenableValueTypes Point.java ValueTypeGetField.java
- * @run main/othervm -noverify -Xint runtime.valhalla.valuetypes.ValueTypeGetField
- * @run main/othervm -noverify -Xcomp runtime.valhalla.valuetypes.ValueTypeGetField
+ * @run main/othervm -noverify -Xint -XX:+EnableValhalla runtime.valhalla.valuetypes.ValueTypeGetField
+ * @run main/othervm -noverify -Xcomp -XX:+EnableValhalla runtime.valhalla.valuetypes.ValueTypeGetField
  */
 public class ValueTypeGetField {
 
@@ -18,54 +18,53 @@
     Point instancePoint1;
 
     static {
-	staticPoint0 = Point.createPoint(358, 406);
-	staticPoint1 = Point.createPoint(101, 2653);
+        staticPoint0 = Point.createPoint(358, 406);
+        staticPoint1 = Point.createPoint(101, 2653);
     }
-    
+
     ValueTypeGetField() {
-	instancePoint0 = Point.createPoint(1890, 1918);
-	instancePoint1 = Point.createPoint(91, 102);
+        instancePoint0 = Point.createPoint(1890, 1918);
+        instancePoint1 = Point.createPoint(91, 102);
     }
-    
+
     public static void main(String[] args) {
         ValueTypeGetField valueTypeGetField = new ValueTypeGetField();
-	System.gc(); // check that VTs survive GC
+        System.gc(); // check that VTs survive GC
         valueTypeGetField.run();
     }
 
     public void run() {
-	// testing initial configuration 
-	checkPoint(staticPoint0, 358, 406);
-	checkPoint(staticPoint1, 101, 2653);
-	checkPoint(instancePoint0, 1890, 1918);
-	checkPoint(instancePoint1, 91, 102);
-	// swapping static fields
-	Point p = staticPoint1;
-	staticPoint1 = staticPoint0;
-	staticPoint0 = p;
-	System.gc();
-	checkPoint(staticPoint0, 101, 2653);
-	checkPoint(staticPoint1, 358, 406);
-	//swapping instance fields
-	p = instancePoint1;
-	instancePoint1 = instancePoint0;
-	instancePoint0 = p;
-	System.gc();
-	checkPoint(instancePoint0, 91, 102);
-	checkPoint(instancePoint1, 1890, 1918);
-	// instance to static
-	staticPoint0 = instancePoint0;
-	System.gc();
-	checkPoint(staticPoint0, 91, 102);
-	// static to instance
-	instancePoint1 = staticPoint1;
-	System.gc();
-	checkPoint(instancePoint1, 358, 406);
+        // testing initial configuration
+        checkPoint(staticPoint0, 358, 406);
+        checkPoint(staticPoint1, 101, 2653);
+        checkPoint(instancePoint0, 1890, 1918);
+        checkPoint(instancePoint1, 91, 102);
+        // swapping static fields
+        Point p = staticPoint1;
+        staticPoint1 = staticPoint0;
+        staticPoint0 = p;
+        System.gc();
+        checkPoint(staticPoint0, 101, 2653);
+        checkPoint(staticPoint1, 358, 406);
+        //swapping instance fields
+        p = instancePoint1;
+        instancePoint1 = instancePoint0;
+        instancePoint0 = p;
+        System.gc();
+        checkPoint(instancePoint0, 91, 102);
+        checkPoint(instancePoint1, 1890, 1918);
+        // instance to static
+        staticPoint0 = instancePoint0;
+        System.gc();
+        checkPoint(staticPoint0, 91, 102);
+        // static to instance
+        instancePoint1 = staticPoint1;
+        System.gc();
+        checkPoint(instancePoint1, 358, 406);
     }
 
     static void checkPoint(Point p , int x, int y) {
-	Asserts.assertEquals(p.x, x, "invalid x value");
-	Asserts.assertEquals(p.y, y, "invalid y value");
+        Asserts.assertEquals(p.x, x, "invalid x value");
+        Asserts.assertEquals(p.y, y, "invalid y value");
     }
-    
 }