annotate agent/src/share/classes/sun/jvm/hotspot/oops/AccessFlags.java @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents 71afdabfd05b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
a61af66fc99e Initial load
duke
parents:
diff changeset
1 /*
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6100
diff changeset
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a61af66fc99e Initial load
duke
parents:
diff changeset
4 *
a61af66fc99e Initial load
duke
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
a61af66fc99e Initial load
duke
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
a61af66fc99e Initial load
duke
parents:
diff changeset
7 * published by the Free Software Foundation.
a61af66fc99e Initial load
duke
parents:
diff changeset
8 *
a61af66fc99e Initial load
duke
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
a61af66fc99e Initial load
duke
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a61af66fc99e Initial load
duke
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
a61af66fc99e Initial load
duke
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
a61af66fc99e Initial load
duke
parents:
diff changeset
13 * accompanied this code).
a61af66fc99e Initial load
duke
parents:
diff changeset
14 *
a61af66fc99e Initial load
duke
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
a61af66fc99e Initial load
duke
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
a61af66fc99e Initial load
duke
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a61af66fc99e Initial load
duke
parents:
diff changeset
18 *
1552
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
c18cbe5936b8 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 0
diff changeset
21 * questions.
0
a61af66fc99e Initial load
duke
parents:
diff changeset
22 *
a61af66fc99e Initial load
duke
parents:
diff changeset
23 */
a61af66fc99e Initial load
duke
parents:
diff changeset
24
a61af66fc99e Initial load
duke
parents:
diff changeset
25 package sun.jvm.hotspot.oops;
a61af66fc99e Initial load
duke
parents:
diff changeset
26
a61af66fc99e Initial load
duke
parents:
diff changeset
27 import sun.jvm.hotspot.runtime.ClassConstants;
a61af66fc99e Initial load
duke
parents:
diff changeset
28 import java.io.*;
a61af66fc99e Initial load
duke
parents:
diff changeset
29
a61af66fc99e Initial load
duke
parents:
diff changeset
30 public class AccessFlags implements /* imports */ ClassConstants {
a61af66fc99e Initial load
duke
parents:
diff changeset
31 public AccessFlags(long flags) {
a61af66fc99e Initial load
duke
parents:
diff changeset
32 this.flags = flags;
a61af66fc99e Initial load
duke
parents:
diff changeset
33 }
a61af66fc99e Initial load
duke
parents:
diff changeset
34
a61af66fc99e Initial load
duke
parents:
diff changeset
35 private long flags;
a61af66fc99e Initial load
duke
parents:
diff changeset
36
a61af66fc99e Initial load
duke
parents:
diff changeset
37 // Java access flags
a61af66fc99e Initial load
duke
parents:
diff changeset
38 public boolean isPublic () { return (flags & JVM_ACC_PUBLIC ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
39 public boolean isPrivate () { return (flags & JVM_ACC_PRIVATE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
40 public boolean isProtected () { return (flags & JVM_ACC_PROTECTED ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
41 public boolean isStatic () { return (flags & JVM_ACC_STATIC ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
42 public boolean isFinal () { return (flags & JVM_ACC_FINAL ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
43 public boolean isSynchronized() { return (flags & JVM_ACC_SYNCHRONIZED) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
44 public boolean isSuper () { return (flags & JVM_ACC_SUPER ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
45 public boolean isVolatile () { return (flags & JVM_ACC_VOLATILE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
46 public boolean isBridge () { return (flags & JVM_ACC_BRIDGE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
47 public boolean isTransient () { return (flags & JVM_ACC_TRANSIENT ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
48 public boolean isVarArgs () { return (flags & JVM_ACC_VARARGS ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
49 public boolean isNative () { return (flags & JVM_ACC_NATIVE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
50 public boolean isEnum () { return (flags & JVM_ACC_ENUM ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
51 public boolean isAnnotation () { return (flags & JVM_ACC_ANNOTATION ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
52 public boolean isInterface () { return (flags & JVM_ACC_INTERFACE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
53 public boolean isAbstract () { return (flags & JVM_ACC_ABSTRACT ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
54 public boolean isStrict () { return (flags & JVM_ACC_STRICT ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
55 public boolean isSynthetic () { return (flags & JVM_ACC_SYNTHETIC ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
56
a61af66fc99e Initial load
duke
parents:
diff changeset
57 public long getValue () { return flags; }
a61af66fc99e Initial load
duke
parents:
diff changeset
58
a61af66fc99e Initial load
duke
parents:
diff changeset
59 // Hotspot internal flags
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6100
diff changeset
60 // Method* flags
0
a61af66fc99e Initial load
duke
parents:
diff changeset
61 public boolean isMonitorMatching () { return (flags & JVM_ACC_MONITOR_MATCH ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
62 public boolean hasMonitorBytecodes () { return (flags & JVM_ACC_HAS_MONITOR_BYTECODES ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
63 public boolean hasLoops () { return (flags & JVM_ACC_HAS_LOOPS ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
64 public boolean loopsFlagInit () { return (flags & JVM_ACC_LOOPS_FLAG_INIT ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
65 public boolean queuedForCompilation() { return (flags & JVM_ACC_QUEUED ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
66 public boolean isNotOsrCompilable () { return (flags & JVM_ACC_NOT_OSR_COMPILABLE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
67 public boolean hasLineNumberTable () { return (flags & JVM_ACC_HAS_LINE_NUMBER_TABLE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
68 public boolean hasCheckedExceptions() { return (flags & JVM_ACC_HAS_CHECKED_EXCEPTIONS ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
69 public boolean hasJsrs () { return (flags & JVM_ACC_HAS_JSRS ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
70 public boolean isObsolete () { return (flags & JVM_ACC_IS_OBSOLETE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
71
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6100
diff changeset
72 // Klass* flags
0
a61af66fc99e Initial load
duke
parents:
diff changeset
73 public boolean hasMirandaMethods () { return (flags & JVM_ACC_HAS_MIRANDA_METHODS ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
74 public boolean hasVanillaConstructor() { return (flags & JVM_ACC_HAS_VANILLA_CONSTRUCTOR) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
75 public boolean hasFinalizer () { return (flags & JVM_ACC_HAS_FINALIZER ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
76 public boolean isCloneable () { return (flags & JVM_ACC_IS_CLONEABLE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
77
6725
da91efe96a93 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 6100
diff changeset
78 // Klass* and Method* flags
0
a61af66fc99e Initial load
duke
parents:
diff changeset
79 public boolean hasLocalVariableTable() { return (flags & JVM_ACC_HAS_LOCAL_VARIABLE_TABLE ) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
80
a61af66fc99e Initial load
duke
parents:
diff changeset
81 // field flags
a61af66fc99e Initial load
duke
parents:
diff changeset
82 public boolean fieldAccessWatched () { return (flags & JVM_ACC_FIELD_ACCESS_WATCHED) != 0; }
a61af66fc99e Initial load
duke
parents:
diff changeset
83 public boolean fieldModificationWatched() { return (flags & JVM_ACC_FIELD_MODIFICATION_WATCHED) != 0; }
6100
71afdabfd05b 7168280: Eliminate the generic signature index slot from field array for field without generic signature.
jiangli
parents: 1552
diff changeset
84 public boolean fieldHasGenericSignature() { return (flags & JVM_ACC_FIELD_HAS_GENERIC_SIGNATURE)!= 0; }
0
a61af66fc99e Initial load
duke
parents:
diff changeset
85
a61af66fc99e Initial load
duke
parents:
diff changeset
86 public void printOn(PrintStream tty) {
a61af66fc99e Initial load
duke
parents:
diff changeset
87 // prints only .class flags and not the hotspot internal flags
a61af66fc99e Initial load
duke
parents:
diff changeset
88 if (isPublic ()) tty.print("public " );
a61af66fc99e Initial load
duke
parents:
diff changeset
89 if (isPrivate ()) tty.print("private " );
a61af66fc99e Initial load
duke
parents:
diff changeset
90 if (isProtected ()) tty.print("protected " );
a61af66fc99e Initial load
duke
parents:
diff changeset
91 if (isStatic ()) tty.print("static " );
a61af66fc99e Initial load
duke
parents:
diff changeset
92 if (isFinal ()) tty.print("final " );
a61af66fc99e Initial load
duke
parents:
diff changeset
93 if (isSynchronized()) tty.print("synchronized ");
a61af66fc99e Initial load
duke
parents:
diff changeset
94 if (isVolatile ()) tty.print("volatile " );
a61af66fc99e Initial load
duke
parents:
diff changeset
95 if (isBridge ()) tty.print("bridge " );
a61af66fc99e Initial load
duke
parents:
diff changeset
96 if (isTransient ()) tty.print("transient " );
a61af66fc99e Initial load
duke
parents:
diff changeset
97 if (isVarArgs ()) tty.print("varargs " );
a61af66fc99e Initial load
duke
parents:
diff changeset
98 if (isNative ()) tty.print("native " );
a61af66fc99e Initial load
duke
parents:
diff changeset
99 if (isEnum ()) tty.print("enum " );
a61af66fc99e Initial load
duke
parents:
diff changeset
100 if (isInterface ()) tty.print("interface " );
a61af66fc99e Initial load
duke
parents:
diff changeset
101 if (isAbstract ()) tty.print("abstract " );
a61af66fc99e Initial load
duke
parents:
diff changeset
102 if (isStrict ()) tty.print("strict " );
a61af66fc99e Initial load
duke
parents:
diff changeset
103 if (isSynthetic ()) tty.print("synthetic " );
a61af66fc99e Initial load
duke
parents:
diff changeset
104 }
a61af66fc99e Initial load
duke
parents:
diff changeset
105
a61af66fc99e Initial load
duke
parents:
diff changeset
106 // get flags written to .class files
a61af66fc99e Initial load
duke
parents:
diff changeset
107 public int getStandardFlags() {
a61af66fc99e Initial load
duke
parents:
diff changeset
108 return (int) (flags & JVM_ACC_WRITTEN_FLAGS);
a61af66fc99e Initial load
duke
parents:
diff changeset
109 }
a61af66fc99e Initial load
duke
parents:
diff changeset
110 }