src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/BasicType.java
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 35217 hotspot/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/BasicType.java@ce4b5303a813
child 47601 f9ace8da5e9c
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
     2
 * Copyright (c) 2000, 2004, 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.runtime;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    26
489c9b5090e2 Initial load
duke
parents:
diff changeset
    27
/** Encapsulates the BasicType enum in globalDefinitions.hpp in the
489c9b5090e2 Initial load
duke
parents:
diff changeset
    28
    VM. */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    29
489c9b5090e2 Initial load
duke
parents:
diff changeset
    30
public class BasicType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    31
  public static final int tBoolean  = 4;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
  public static final int tChar     = 5;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
  public static final int tFloat    = 6;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
  public static final int tDouble   = 7;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
  public static final int tByte     = 8;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
  public static final int tShort    = 9;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
  public static final int tInt      = 10;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
  public static final int tLong     = 11;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
  public static final int tObject   = 12;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  public static final int tArray    = 13;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  public static final int tVoid     = 14;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  public static final int tAddress  = 15;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  public static final int tConflict = 16;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  public static final int tIllegal  = 99;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  public static final BasicType T_BOOLEAN = new BasicType(tBoolean);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
  public static final BasicType T_CHAR = new BasicType(tChar);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
  public static final BasicType T_FLOAT = new BasicType(tFloat);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
  public static final BasicType T_DOUBLE = new BasicType(tDouble);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
  public static final BasicType T_BYTE = new BasicType(tByte);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
  public static final BasicType T_SHORT = new BasicType(tShort);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
  public static final BasicType T_INT = new BasicType(tInt);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
  public static final BasicType T_LONG = new BasicType(tLong);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
  public static final BasicType T_OBJECT = new BasicType(tObject);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
  public static final BasicType T_ARRAY = new BasicType(tArray);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
  public static final BasicType T_VOID = new BasicType(tVoid);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
  public static final BasicType T_ADDRESS = new BasicType(tAddress);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
  public static final BasicType T_CONFLICT = new BasicType(tConflict);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
  public static final BasicType T_ILLEGAL = new BasicType(tIllegal);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
  public static int getTBoolean() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
    return tBoolean;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
  public static int getTChar() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
    return tChar;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
  public static int getTFloat() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    return tFloat;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
  public static int getTDouble() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    return tDouble;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
  public static int getTByte() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
    return tByte;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
  public static int getTShort() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
    return tShort;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  public static int getTInt() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
    return tInt;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  public static int getTLong() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
    return tLong;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    92
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  public static int getTObject() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
    return tObject;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  public static int getTArray() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
    return tArray;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
  public static int getTVoid() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
    return tVoid;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  public static int getTAddress() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
    return tAddress;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
  /** For stack value type with conflicting contents */
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  public static int getTConflict() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   111
    return tConflict;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  public static int getTIllegal() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
    return tIllegal;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
  public static BasicType charToBasicType(char c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
    switch( c ) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
    case 'B': return T_BYTE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
    case 'C': return T_CHAR;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
    case 'D': return T_DOUBLE;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
    case 'F': return T_FLOAT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
    case 'I': return T_INT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
    case 'J': return T_LONG;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
    case 'S': return T_SHORT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
    case 'Z': return T_BOOLEAN;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
    case 'V': return T_VOID;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
    case 'L': return T_OBJECT;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
    case '[': return T_ARRAY;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
    return T_ILLEGAL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   134
489c9b5090e2 Initial load
duke
parents:
diff changeset
   135
  public static int charToType(char c) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
    return charToBasicType(c).getType();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  public int getType() {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
    return type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  //-- Internals only below this point
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  private BasicType(int type) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
    this.type = type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  private int type;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
}