changeset 49451:513403560750 lworld

Summary: Fix method supports_value_types() and ignore ACC_VALUE and ACC_FLATTENABLE in old class file versions. Reviewed-by: acorn
author hseigel
date Fri, 23 Mar 2018 11:58:08 -0400
parents e008cad90214
children ef8137c6c609
files src/hotspot/share/classfile/classFileParser.cpp src/hotspot/share/include/jvm.h
diffstat 2 files changed, 15 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/classfile/classFileParser.cpp	Fri Mar 23 16:27:17 2018 +0100
+++ b/src/hotspot/share/classfile/classFileParser.cpp	Fri Mar 23 11:58:08 2018 -0400
@@ -1596,9 +1596,15 @@
     // access_flags, name_index, descriptor_index, attributes_count
     cfs->guarantee_more(8, CHECK);
 
+    jint recognized_modifiers = JVM_RECOGNIZED_FIELD_MODIFIERS;
+    // JVM_ACC_FLATTENABLE is defined for class file version 55 and later
+    if (supports_value_types()) {
+      recognized_modifiers |= JVM_ACC_FLATTENABLE;
+    }
+
+    const jint flags = cfs->get_u2_fast() & recognized_modifiers;
+    verify_legal_field_modifiers(flags, is_interface, is_value_type, CHECK);
     AccessFlags access_flags;
-    const jint flags = cfs->get_u2_fast() & JVM_RECOGNIZED_FIELD_MODIFIERS;
-    verify_legal_field_modifiers(flags, is_interface, is_value_type, CHECK);
     access_flags.set_flags(flags);
 
     const u2 name_index = cfs->get_u2_fast();
@@ -3214,7 +3220,7 @@
     if (_major_version >= JAVA_9_VERSION) {
       recognized_modifiers |= JVM_ACC_MODULE;
     }
-    // JVM_ACC_VALUE is defined for class file version 53.1 and later
+    // JVM_ACC_VALUE is defined for class file version 55 and later
     if (supports_value_types()) {
       recognized_modifiers |= JVM_ACC_VALUE;
     }
@@ -4599,8 +4605,8 @@
 }
 
 bool ClassFileParser::supports_value_types() const {
-  // Value types are only supported by class file version 53.1 and later
-  return _major_version > JAVA_9_VERSION || (_major_version == JAVA_9_VERSION && _minor_version >= 1);
+  // Value types are only supported by class file version 55 and later
+  return _major_version >= JAVA_11_VERSION;
 }
 
 // Attach super classes and interface classes to class loader data
@@ -6180,7 +6186,7 @@
   if (_major_version >= JAVA_9_VERSION) {
     recognized_modifiers |= JVM_ACC_MODULE;
   }
-  // JVM_ACC_VALUE is defined for class file version 53.1 and later
+  // JVM_ACC_VALUE is defined for class file version 55 and later
   if (supports_value_types()) {
     recognized_modifiers |= JVM_ACC_VALUE;
   }
--- a/src/hotspot/share/include/jvm.h	Fri Mar 23 16:27:17 2018 +0100
+++ b/src/hotspot/share/include/jvm.h	Fri Mar 23 11:58:08 2018 -0400
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 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
@@ -1087,8 +1087,7 @@
                                         JVM_ACC_ABSTRACT | \
                                         JVM_ACC_ANNOTATION | \
                                         JVM_ACC_ENUM | \
-                                        JVM_ACC_SYNTHETIC | \
-                                        JVM_ACC_VALUE)
+                                        JVM_ACC_SYNTHETIC)
 
 #define JVM_RECOGNIZED_FIELD_MODIFIERS (JVM_ACC_PUBLIC | \
                                         JVM_ACC_PRIVATE | \
@@ -1098,8 +1097,7 @@
                                         JVM_ACC_VOLATILE | \
                                         JVM_ACC_TRANSIENT | \
                                         JVM_ACC_ENUM | \
-                                        JVM_ACC_SYNTHETIC | \
-                                        JVM_ACC_FLATTENABLE)
+                                        JVM_ACC_SYNTHETIC)
 
 #define JVM_RECOGNIZED_METHOD_MODIFIERS (JVM_ACC_PUBLIC | \
                                          JVM_ACC_PRIVATE | \