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