8339260: Move rarely used constants out of ClassFile

Reviewed-by: asotona
This commit is contained in:
Chen Liang 2024-09-26 06:34:18 +00:00
parent 47c10694c6
commit 8c8f0d85ce
37 changed files with 1545 additions and 1916 deletions

View file

@ -1,5 +1,5 @@
/*
* Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2022, 2024, 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
@ -24,6 +24,8 @@
*/
package java.lang.classfile.attribute;
import java.lang.classfile.instruction.CharacterRange;
import jdk.internal.classfile.impl.UnboundAttribute;
import jdk.internal.javac.PreviewFeature;
@ -70,17 +72,17 @@ public sealed interface CharacterRangeInfo
* The value of the flags item describes the kind of range. Multiple flags
* may be set within flags.
* <ul>
* <li>{@link java.lang.classfile.ClassFile#CRT_STATEMENT} Range is a Statement
* <li>{@link CharacterRange#FLAG_STATEMENT} Range is a Statement
* (except ExpressionStatement), StatementExpression {@jls 14.8}, as well as each
* VariableDeclaratorId = VariableInitializer of
* LocalVariableDeclarationStatement {@jls 14.4} or FieldDeclaration {@jls 8.3} in the
* grammar.
* <li>{@link java.lang.classfile.ClassFile#CRT_BLOCK} Range is a Block in the
* <li>{@link CharacterRange#FLAG_BLOCK} Range is a Block in the
* grammar.
* <li>{@link java.lang.classfile.ClassFile#CRT_ASSIGNMENT} Range is an assignment
* <li>{@link CharacterRange#FLAG_ASSIGNMENT} Range is an assignment
* expression - Expression1 AssignmentOperator Expression1 in the grammar as
* well as increment and decrement expressions (both prefix and postfix).
* <li>{@link java.lang.classfile.ClassFile#CRT_FLOW_CONTROLLER} An expression
* <li>{@link CharacterRange#FLAG_FLOW_CONTROLLER} An expression
* whose value will effect control flow. {@code Flowcon} in the following:
* <pre>
* if ( Flowcon ) Statement [else Statement]
@ -92,7 +94,7 @@ public sealed interface CharacterRangeInfo
* Flowcon &amp;&amp; Expression3
* Flowcon ? Expression : Expression1
* </pre>
* <li>{@link java.lang.classfile.ClassFile#CRT_FLOW_TARGET} Statement or
* <li>{@link CharacterRange#FLAG_FLOW_TARGET} Statement or
* expression effected by a CRT_FLOW_CONTROLLER. {@code Flowtarg} in the following:
* <pre>
* if ( Flowcon ) Flowtarg [else Flowtarg]
@ -103,11 +105,11 @@ public sealed interface CharacterRangeInfo
* Flowcon &amp;&amp; Flowtarg
* Flowcon ? Flowtarg : Flowtarg
* </pre>
* <li>{@link java.lang.classfile.ClassFile#CRT_INVOKE} Method invocation. For
* <li>{@link CharacterRange#FLAG_INVOKE} Method invocation. For
* example: Identifier Arguments.
* <li>{@link java.lang.classfile.ClassFile#CRT_CREATE} New object creation. For
* <li>{@link CharacterRange#FLAG_CREATE} New object creation. For
* example: new Creator.
* <li>{@link java.lang.classfile.ClassFile#CRT_BRANCH_TRUE} A condition encoded
* <li>{@link CharacterRange#FLAG_BRANCH_TRUE} A condition encoded
* in the branch instruction immediately contained in the code range for
* this item is not inverted towards the corresponding branch condition in
* the source code. I.e. actual jump occurs if and only if the the source
@ -119,7 +121,7 @@ public sealed interface CharacterRangeInfo
* if&lt;cond&gt;, ifnonull, ifnull or goto. CRT_BRANCH_TRUE and
* CRT_BRANCH_FALSE are special kinds of entries that can be used to
* determine what branch of a condition was chosen during the runtime.
* <li>{@link java.lang.classfile.ClassFile#CRT_BRANCH_FALSE} A condition encoded
* <li>{@link CharacterRange#FLAG_BRANCH_FALSE} A condition encoded
* in the branch instruction immediately contained in the code range for
* this item is inverted towards the corresponding branch condition in the
* source code. I.e. actual jump occurs if and only if the the source code
@ -134,6 +136,7 @@ public sealed interface CharacterRangeInfo
* All bits of the flags item not assigned above are reserved for future use. They should be set to zero in generated class files and should be ignored by Java virtual machine implementations.
*
* @return the flags
* @see CharacterRange#flags()
*/
int flags();