Path: blob/aarch64-shenandoah-jdk8u272-b10/jdk/src/share/classes/sun/tools/java/Constants.java
38918 views
/*1* Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/242526package sun.tools.java;2728/**29* This interface defines constant that are used30* throughout the compiler. It inherits from RuntimeConstants,31* which is an autogenerated class that contains contstants32* defined in the interpreter.33*34* WARNING: The contents of this source file are not part of any35* supported API. Code that depends on them does so at its own risk:36* they are subject to change or removal without notice.37*38* @author Arthur van Hoff39*/4041public42interface Constants extends RuntimeConstants {4344/*45* Enable/disable inclusion of certain debug tracing code in the46* compiler. When included, the tracing code may be selectively47* enabled at runtime, otherwise we save the space/time overhead.48* Should normally be 'false' for a release version.49*/50public static final boolean tracing = true;5152/*53* Frequently used identifiers54*/55Identifier idAppend = Identifier.lookup("append");56Identifier idClassInit = Identifier.lookup("<clinit>");57Identifier idCode = Identifier.lookup("Code");58Identifier idInit = Identifier.lookup("<init>");59Identifier idLength = Identifier.lookup("length");60Identifier idNull = Identifier.lookup("");61Identifier idStar = Identifier.lookup("*");62Identifier idSuper = Identifier.lookup("super");63Identifier idThis = Identifier.lookup("this");64Identifier idClass = Identifier.lookup("class");65Identifier idToString = Identifier.lookup("toString");66Identifier idValueOf = Identifier.lookup("valueOf");67Identifier idNew = Identifier.lookup("new");68Identifier idGetClass = Identifier.lookup("getClass");69Identifier idTYPE = Identifier.lookup("TYPE");70Identifier idFinallyReturnValue = Identifier.lookup("<return>");7172Identifier idJavaLang = Identifier.lookup("java.lang");7374Identifier idJavaLangCloneable = Identifier.lookup("java.lang.Cloneable");7576Identifier idJavaLangError = Identifier.lookup("java.lang.Error");77Identifier idJavaLangException = Identifier.lookup("java.lang.Exception");78Identifier idJavaLangObject = Identifier.lookup("java.lang.Object");79Identifier idJavaLangClass = Identifier.lookup("java.lang.Class");80Identifier idJavaLangRuntimeException =81Identifier.lookup("java.lang.RuntimeException");82Identifier idJavaLangString = Identifier.lookup("java.lang.String");83Identifier idJavaLangStringBuffer =84Identifier.lookup("java.lang.StringBuffer");85Identifier idJavaLangThrowable = Identifier.lookup("java.lang.Throwable");8687Identifier idJavaIoSerializable = Identifier.lookup("java.io.Serializable");888990Identifier idConstantValue = Identifier.lookup("ConstantValue");91Identifier idLocalVariableTable = Identifier.lookup("LocalVariableTable");92Identifier idLineNumberTable = Identifier.lookup("LineNumberTable");93// JCOV94Identifier idCoverageTable = Identifier.lookup("CoverageTable");95// end JCOV96Identifier idSourceFile = Identifier.lookup("SourceFile");97Identifier idDocumentation = Identifier.lookup("Documentation");98Identifier idDeprecated = Identifier.lookup("Deprecated");99Identifier idSynthetic = Identifier.lookup("Synthetic");100Identifier idExceptions = Identifier.lookup("Exceptions");101Identifier idInnerClasses = Identifier.lookup("InnerClasses");102103/* methods we need to know about */104Identifier idClone = Identifier.lookup("clone");105106107/* This is not a real signature marker, since it is also108* an identifier constituent character.109*/110char SIGC_INNERCLASS = '$';111String SIG_INNERCLASS = "$";112113String prefixThis = "this$";114String prefixVal = "val$";115String prefixLoc = "loc$";116String prefixAccess = "access$";117String prefixClass = "class$";118String prefixArray = "array$";119120/*121* Flags122*/123int F_VERBOSE = 1 << 0;124int F_DUMP = 1 << 1;125int F_WARNINGS = 1 << 2;126127// The meaning of -g has changed, so F_DEBUG flag is removed.128// public static final int F_DEBUG = 1 << 3;129int F_DEBUG_LINES = 1 << 12;130int F_DEBUG_VARS = 1 << 13;131int F_DEBUG_SOURCE = 1 << 18;132133// The meaning of -O has changed, so F_OPTIMIZE flag is removed.134// public static final int F_OPTIMIZE = 1 << 4;135int F_OPT = 1 << 14;136int F_OPT_INTERCLASS = 1 << 15;137138int F_DEPENDENCIES = 1 << 5;139140// JCOV141int F_COVERAGE = 1 << 6;142int F_COVDATA = 1 << 7;143// end JCOV144145int F_DEPRECATION = 1 << 9;146int F_PRINT_DEPENDENCIES = 1 << 10;147int F_VERSION12 = 1 << 11;148149150int F_ERRORSREPORTED = 1 << 16;151152int F_STRICTDEFAULT = 1 << 17;153154/*155* Modifiers.156*157* There has been much confusion regarding modifiers. There158* are a number of distinct usages:159*160* - in classfiles to annotate classes, as per JVM pg. 102.161* - in classfiles to annotate methods, as per JVM pg. 104.162* - in classfiles to annotate InnerClass attributes, as per163* http://java.sun.com/products/jdk/1.1/docs/guide/innerclasses164* - in the compiler to record java source level modifiers,165* as per JLS pg. 157 et al., plus misc. info such as whether166* a method is deprecated167* - in the JVM to record misc. info, such as whether a method has168* has been compiled169*170* To make matters worse, the terms "access flags" and "modifiers"171* are often used interchangably, and some information that might172* make sense as a flag is expressed using attributes (ie. Synthetic).173*174* The constants defined herein have been divided by whether they175* make sense only within the compiler (M_* and MM_*) or whether176* they only make sense to the JVM (ACC_* and ACCM_*). At an earlier177* time these were all lumped together. Future maintenance should178* strive to keep the distinction clear.179*180* Note that modifier M_STRICTFP is not in general recoverable from181* the ACC_STRICT bit in classfiles.182*183* Note also that the modifiers M_LOCAL and M_ANONYMOUS do not appear184* in the InnerClass attribute, as they are above the first 16 bits.185*/186187// Modifiers meaningful to both Java source and the JVM. These188// have been kept the same bit in the M_* and ACC_* forms189// to avoid destabilizing the compiler.190int M_PUBLIC = ACC_PUBLIC;191int M_PRIVATE = ACC_PRIVATE;192int M_PROTECTED = ACC_PROTECTED;193int M_STATIC = ACC_STATIC;194int M_TRANSIENT = ACC_TRANSIENT;195int M_SYNCHRONIZED = ACC_SYNCHRONIZED; // collides with ACC_SUPER196int M_ABSTRACT = ACC_ABSTRACT;197int M_NATIVE = ACC_NATIVE;198int M_FINAL = ACC_FINAL;199int M_VOLATILE = ACC_VOLATILE;200int M_INTERFACE = ACC_INTERFACE;201202// Modifiers not meaningful to the JVM. The JVM only allows 16 bits203// for modifiers, so keeping these in the unusable bits after the first204// 16 is a good idea.205int M_ANONYMOUS = 0x00010000;206int M_LOCAL = 0x00020000;207int M_DEPRECATED = 0x00040000;208int M_SYNTHETIC = 0x00080000;209int M_INLINEABLE = 0x00100000;210211int M_STRICTFP = 0x00200000;212213String paraDeprecated = "@deprecated";214215// Masks for modifiers that apply to Java source code216int MM_CLASS = M_PUBLIC217| M_INTERFACE218| M_FINAL219| M_ABSTRACT220| M_STRICTFP;221int MM_MEMBER = M_PUBLIC222| M_PRIVATE223| M_PROTECTED224| M_FINAL225| M_STATIC;226int MM_FIELD = MM_MEMBER227| M_TRANSIENT228| M_VOLATILE;229int MM_METHOD = MM_MEMBER230| M_SYNCHRONIZED231| M_ABSTRACT232| M_NATIVE233| M_STRICTFP;234235// Masks for modifiers that apply to class files.236// Note that the M_SYNTHETIC modifier is never written out to a class file.237// Synthetic members are indicated using the "Synthetic" attribute.238int ACCM_CLASS = ACC_PUBLIC239| ACC_INTERFACE240| ACC_FINAL241| ACC_ABSTRACT242| ACC_SUPER243| ACC_STRICT;244int ACCM_MEMBER = ACC_PUBLIC245| ACC_PRIVATE246| ACC_PROTECTED247| ACC_FINAL248| ACC_STATIC;249// The M_ANONYMOUS and M_LOCAL modifiers are not mentioned in the250// inner classes specification and are never written to classfiles.251// Also note that ACC_SUPER should never be set in an InnerClass252// attribute.253int ACCM_INNERCLASS = ACC_PUBLIC254| ACC_PRIVATE255| ACC_PROTECTED256| ACC_STATIC257| ACC_ABSTRACT258| ACC_FINAL259| ACC_INTERFACE260| ACC_STRICT;261int ACCM_FIELD = ACCM_MEMBER262| ACC_TRANSIENT263| ACC_VOLATILE;264int ACCM_METHOD = ACCM_MEMBER265| ACC_SYNCHRONIZED266| ACC_ABSTRACT267| ACC_NATIVE268| ACC_STRICT;269270/*271* Type codes272*/273int TC_BOOLEAN = 0;274int TC_BYTE = 1;275int TC_CHAR = 2;276int TC_SHORT = 3;277int TC_INT = 4;278int TC_LONG = 5;279int TC_FLOAT = 6;280int TC_DOUBLE = 7;281int TC_NULL = 8;282int TC_ARRAY = 9;283int TC_CLASS = 10;284int TC_VOID = 11;285int TC_METHOD = 12;286int TC_ERROR = 13;287288// JCOV289/*290* Cover's types291*/292int CT_FIRST_KIND = 1;293int CT_METHOD = 1;294int CT_FIKT_METHOD = 2;295int CT_BLOCK = 3;296int CT_FIKT_RET = 4;297int CT_CASE = 5;298int CT_SWITH_WO_DEF = 6;299int CT_BRANCH_TRUE = 7;300int CT_BRANCH_FALSE = 8;301int CT_LAST_KIND = 8;302// end JCOV303304/*305* Type Masks306*/307int TM_NULL = 1 << TC_NULL;308int TM_VOID = 1 << TC_VOID;309int TM_BOOLEAN = 1 << TC_BOOLEAN;310int TM_BYTE = 1 << TC_BYTE;311int TM_CHAR = 1 << TC_CHAR;312int TM_SHORT = 1 << TC_SHORT;313int TM_INT = 1 << TC_INT;314int TM_LONG = 1 << TC_LONG;315int TM_FLOAT = 1 << TC_FLOAT;316int TM_DOUBLE = 1 << TC_DOUBLE;317int TM_ARRAY = 1 << TC_ARRAY;318int TM_CLASS = 1 << TC_CLASS;319int TM_METHOD = 1 << TC_METHOD;320int TM_ERROR = 1 << TC_ERROR;321322int TM_INT32 = TM_BYTE | TM_SHORT | TM_CHAR | TM_INT;323int TM_NUM32 = TM_INT32 | TM_FLOAT;324int TM_NUM64 = TM_LONG | TM_DOUBLE;325int TM_INTEGER = TM_INT32 | TM_LONG;326int TM_REAL = TM_FLOAT | TM_DOUBLE;327int TM_NUMBER = TM_INTEGER | TM_REAL;328int TM_REFERENCE = TM_ARRAY | TM_CLASS | TM_NULL;329330/*331* Class status332*/333int CS_UNDEFINED = 0;334int CS_UNDECIDED = 1;335int CS_BINARY = 2;336int CS_SOURCE = 3;337int CS_PARSED = 4;338int CS_CHECKED = 5;339int CS_COMPILED = 6;340int CS_NOTFOUND = 7;341342343/*344* Attributes345*/346int ATT_ALL = 0xFFFFFFFF;347int ATT_CODE = 1 << 1;348int ATT_ALLCLASSES = 1 << 2;349350/*351* Number of bits used in file offsets. The line number and352* file offset are concatenated into a long, with enough room353* for other information to be added later if desired (such as354* token lengths). For the moment explicit bit manipulations355* are used to modify the fields. This makes sense for efficiency356* but at some point these ought to be better encapsulated.357*/358int WHEREOFFSETBITS = 32;359long MAXFILESIZE = (1L << WHEREOFFSETBITS) - 1;360long MAXLINENUMBER = (1L << (64 - WHEREOFFSETBITS)) - 1;361362/*363* Operators364*/365int COMMA = 0;366int ASSIGN = 1;367368int ASGMUL = 2;369int ASGDIV = 3;370int ASGREM = 4;371int ASGADD = 5;372int ASGSUB = 6;373int ASGLSHIFT = 7;374int ASGRSHIFT = 8;375int ASGURSHIFT = 9;376int ASGBITAND = 10;377int ASGBITOR = 11;378int ASGBITXOR = 12;379380int COND = 13;381int OR = 14;382int AND = 15;383int BITOR = 16;384int BITXOR = 17;385int BITAND = 18;386int NE = 19;387int EQ = 20;388int GE = 21;389int GT = 22;390int LE = 23;391int LT = 24;392int INSTANCEOF = 25;393int LSHIFT = 26;394int RSHIFT = 27;395int URSHIFT = 28;396int ADD = 29;397int SUB = 30;398int DIV = 31;399int REM = 32;400int MUL = 33;401int CAST = 34; // (x)y402int POS = 35; // +x403int NEG = 36; // -x404int NOT = 37;405int BITNOT = 38;406int PREINC = 39; // ++x407int PREDEC = 40; // --x408int NEWARRAY = 41;409int NEWINSTANCE = 42;410int NEWFROMNAME = 43;411int POSTINC = 44; // x++412int POSTDEC = 45; // x--413int FIELD = 46;414int METHOD = 47; // x(y)415int ARRAYACCESS = 48; // x[y]416int NEW = 49;417int INC = 50;418int DEC = 51;419420int CONVERT = 55; // implicit conversion421int EXPR = 56; // (x)422int ARRAY = 57; // {x, y, ...}423int GOTO = 58;424425/*426* Value tokens427*/428int IDENT = 60;429int BOOLEANVAL = 61;430int BYTEVAL = 62;431int CHARVAL = 63;432int SHORTVAL = 64;433int INTVAL = 65;434int LONGVAL = 66;435int FLOATVAL = 67;436int DOUBLEVAL = 68;437int STRINGVAL = 69;438439/*440* Type keywords441*/442int BYTE = 70;443int CHAR = 71;444int SHORT = 72;445int INT = 73;446int LONG = 74;447int FLOAT = 75;448int DOUBLE = 76;449int VOID = 77;450int BOOLEAN = 78;451452/*453* Expression keywords454*/455int TRUE = 80;456int FALSE = 81;457int THIS = 82;458int SUPER = 83;459int NULL = 84;460461/*462* Statement keywords463*/464int IF = 90;465int ELSE = 91;466int FOR = 92;467int WHILE = 93;468int DO = 94;469int SWITCH = 95;470int CASE = 96;471int DEFAULT = 97;472int BREAK = 98;473int CONTINUE = 99;474int RETURN = 100;475int TRY = 101;476int CATCH = 102;477int FINALLY = 103;478int THROW = 104;479int STAT = 105;480int EXPRESSION = 106;481int DECLARATION = 107;482int VARDECLARATION = 108;483484/*485* Declaration keywords486*/487int IMPORT = 110;488int CLASS = 111;489int EXTENDS = 112;490int IMPLEMENTS = 113;491int INTERFACE = 114;492int PACKAGE = 115;493494/*495* Modifier keywords496*/497int PRIVATE = 120;498int PUBLIC = 121;499int PROTECTED = 122;500int CONST = 123;501int STATIC = 124;502int TRANSIENT = 125;503int SYNCHRONIZED = 126;504int NATIVE = 127;505int FINAL = 128;506int VOLATILE = 129;507int ABSTRACT = 130;508int STRICTFP = 131;509510/*511* Punctuation512*/513int SEMICOLON = 135;514int COLON = 136;515int QUESTIONMARK = 137;516int LBRACE = 138;517int RBRACE = 139;518int LPAREN = 140;519int RPAREN = 141;520int LSQBRACKET = 142;521int RSQBRACKET = 143;522int THROWS = 144;523524/*525* Special tokens526*/527int ERROR = 145; // an error528int COMMENT = 146; // not used anymore.529int TYPE = 147;530int LENGTH = 148;531int INLINERETURN = 149;532int INLINEMETHOD = 150;533int INLINENEWINSTANCE = 151;534535/*536* Operator precedence537*/538int opPrecedence[] = {53910, 11, 11, 11, 11, 11, 11, 11, 11, 11,54011, 11, 11, 12, 13, 14, 15, 16, 17, 18,54118, 19, 19, 19, 19, 19, 20, 20, 20, 21,54221, 22, 22, 22, 23, 24, 24, 24, 24, 24,54324, 25, 25, 26, 26, 26, 26, 26, 26544};545546/*547* Operator names548*/549String opNames[] = {550",", "=", "*=", "/=", "%=",551"+=", "-=", "<<=", ">>=", ">>>=",552"&=", "|=", "^=", "?:", "||",553"&&", "|", "^", "&", "!=",554"==", ">=", ">", "<=", "<",555"instanceof", "<<", ">>", ">>>", "+",556"-", "/", "%", "*", "cast",557"+", "-", "!", "~", "++",558"--", "new", "new", "new", "++",559"--", "field","method","[]", "new",560"++", "--", null, null, null,561562"convert", "expr", "array", "goto", null,563564"Identifier", "boolean", "byte", "char", "short",565"int", "long", "float", "double", "string",566567"byte", "char", "short", "int", "long",568"float", "double", "void", "boolean", null,569570"true", "false", "this", "super", "null",571null, null, null, null, null,572573"if", "else", "for", "while","do",574"switch", "case", "default", "break", "continue",575"return", "try", "catch", "finally", "throw",576"stat", "expression", "declaration", "declaration", null,577578"import", "class", "extends", "implements", "interface",579"package", null, null, null, null,580581"private", "public", "protected", "const", "static",582"transient", "synchronized", "native", "final", "volatile",583"abstract", "strictfp", null, null, null,584585";", ":", "?", "{", "}",586"(", ")", "[", "]", "throws",587"error", "comment", "type", "length", "inline-return",588"inline-method", "inline-new"589};590}591592593