8222502: Replace 19,20 case alternatives with JVM_CONSTANT_Module/Package names
authorlfoltan
Tue, 23 Apr 2019 07:05:38 -0400
changeset 54595 a61da18408c1
parent 54594 e0516ee47c36
child 54596 86c1da00dd6a
8222502: Replace 19,20 case alternatives with JVM_CONSTANT_Module/Package names Summary: Add JVM_CONSTANT_Module and JVM_CONSTANT_Package to classfile_constants.h Reviewed-by: coleenp, hseigel
src/hotspot/share/classfile/classFileParser.cpp
src/hotspot/share/jvmci/vmStructs_jvmci.cpp
src/hotspot/share/runtime/vmStructs.cpp
src/java.base/share/native/include/classfile_constants.h.template
src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java
--- a/src/hotspot/share/classfile/classFileParser.cpp	Tue Apr 23 14:20:08 2019 +0530
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Tue Apr 23 07:05:38 2019 -0400
@@ -126,7 +126,8 @@
 #define JAVA_13_VERSION                   57
 
 void ClassFileParser::set_class_bad_constant_seen(short bad_constant) {
-  assert((bad_constant == 19 || bad_constant == 20) && _major_version >= JAVA_9_VERSION,
+  assert((bad_constant == JVM_CONSTANT_Module ||
+          bad_constant == JVM_CONSTANT_Package) && _major_version >= JAVA_9_VERSION,
          "Unexpected bad constant pool entry");
   if (_bad_constant_seen == 0) _bad_constant_seen = bad_constant;
 }
@@ -343,8 +344,8 @@
         }
         break;
       }
-      case 19:
-      case 20: {
+      case JVM_CONSTANT_Module:
+      case JVM_CONSTANT_Package: {
         // Record that an error occurred in these two cases but keep parsing so
         // that ACC_Module can be checked for in the access_flags.  Need to
         // throw NoClassDefFoundError in that case.
--- a/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Tue Apr 23 14:20:08 2019 +0530
+++ b/src/hotspot/share/jvmci/vmStructs_jvmci.cpp	Tue Apr 23 07:05:38 2019 -0400
@@ -417,6 +417,8 @@
   declare_constant(JVM_CONSTANT_MethodHandle)                             \
   declare_constant(JVM_CONSTANT_MethodType)                               \
   declare_constant(JVM_CONSTANT_InvokeDynamic)                            \
+  declare_constant(JVM_CONSTANT_Module)                                   \
+  declare_constant(JVM_CONSTANT_Package)                                  \
   declare_constant(JVM_CONSTANT_ExternalMax)                              \
                                                                           \
   declare_constant(JVM_CONSTANT_Invalid)                                  \
--- a/src/hotspot/share/runtime/vmStructs.cpp	Tue Apr 23 14:20:08 2019 +0530
+++ b/src/hotspot/share/runtime/vmStructs.cpp	Tue Apr 23 07:05:38 2019 -0400
@@ -2095,6 +2095,8 @@
   declare_constant(JVM_CONSTANT_MethodType)                               \
   declare_constant(JVM_CONSTANT_Dynamic)                                  \
   declare_constant(JVM_CONSTANT_InvokeDynamic)                            \
+  declare_constant(JVM_CONSTANT_Module)                                   \
+  declare_constant(JVM_CONSTANT_Package)                                  \
   declare_constant(JVM_CONSTANT_ExternalMax)                              \
                                                                           \
   declare_constant(JVM_CONSTANT_Invalid)                                  \
--- a/src/java.base/share/native/include/classfile_constants.h.template	Tue Apr 23 14:20:08 2019 +0530
+++ b/src/java.base/share/native/include/classfile_constants.h.template	Tue Apr 23 07:05:38 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2019, 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
@@ -109,7 +109,9 @@
     JVM_CONSTANT_MethodType             = 16,  // JSR 292
     JVM_CONSTANT_Dynamic                = 17,
     JVM_CONSTANT_InvokeDynamic          = 18,
-    JVM_CONSTANT_ExternalMax            = 18
+    JVM_CONSTANT_Module                 = 19,
+    JVM_CONSTANT_Package                = 20,
+    JVM_CONSTANT_ExternalMax            = 20 
 };
 
 /* JVM_CONSTANT_MethodHandle subtypes */
--- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Tue Apr 23 14:20:08 2019 +0530
+++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/ClassConstants.java	Tue Apr 23 07:05:38 2019 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -44,6 +44,8 @@
     public static final int JVM_CONSTANT_MethodType         = 16;
     public static final int JVM_CONSTANT_Dynamic            = 17;
     public static final int JVM_CONSTANT_InvokeDynamic      = 18;
+    public static final int JVM_CONSTANT_Module             = 19;
+    public static final int JVM_CONSTANT_Package            = 20;
 
     // JVM_CONSTANT_MethodHandle subtypes
     public static final int JVM_REF_getField                = 1;