src/hotspot/share/c1/c1_ValueType.hpp
author dlong
Wed, 31 Jan 2018 16:09:29 -0800
changeset 48856 c866eaca24cb
parent 47216 71c04702a3d5
child 51333 f6641fcf7b7e
permissions -rw-r--r--
8194984: 9 Null pointer dereference defect groups related to ciMethodData::bci_to_data() Reviewed-by: kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 13728
diff changeset
     2
 * Copyright (c) 1999, 2014, 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
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    25
#ifndef SHARE_VM_C1_C1_VALUETYPE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    26
#define SHARE_VM_C1_C1_VALUETYPE_HPP
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    27
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    28
#include "c1/c1_Compilation.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    29
#include "ci/ciConstant.hpp"
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    30
#include "ci/ciMethodData.hpp"
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
    31
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    32
// type hierarchy
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
class ValueType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
class   VoidType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
class   IntType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
class     IntConstant;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
class     IntInterval;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
class   LongType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
class     LongConstant;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
class   FloatType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
class     FloatConstant;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
class   DoubleType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
class     DoubleConstant;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
class   ObjectType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
class     ObjectConstant;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
class     ArrayType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
class       ArrayConstant;
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
    48
class         StableArrayConstant;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
class     InstanceType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
class       InstanceConstant;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    51
class   MetadataType;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
class     ClassType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
class       ClassConstant;
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    54
class     MethodType;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    55
class       MethodConstant;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    56
class     MethodDataType;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    57
class       MethodDataConstant;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
class   AddressType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
class     AddressConstant;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
class   IllegalType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
// predefined types
489c9b5090e2 Initial load
duke
parents:
diff changeset
    64
extern VoidType*       voidType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
extern IntType*        intType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
extern LongType*       longType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
extern FloatType*      floatType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
extern DoubleType*     doubleType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
extern ObjectType*     objectType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
extern ArrayType*      arrayType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
extern InstanceType*   instanceType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
extern ClassType*      classType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
extern AddressType*    addressType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
extern IllegalType*    illegalType;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
// predefined constants
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
extern IntConstant*    intZero;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
extern IntConstant*    intOne;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
extern ObjectConstant* objectNull;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    81
489c9b5090e2 Initial load
duke
parents:
diff changeset
    82
489c9b5090e2 Initial load
duke
parents:
diff changeset
    83
// tags
489c9b5090e2 Initial load
duke
parents:
diff changeset
    84
enum ValueTag {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    85
  // all legal tags must come first
489c9b5090e2 Initial load
duke
parents:
diff changeset
    86
  intTag,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    87
  longTag,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    88
  floatTag,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    89
  doubleTag,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    90
  objectTag,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    91
  addressTag,
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
    92
  metaDataTag,
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    93
  number_of_legal_tags,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    94
  // all other tags must follow afterwards
489c9b5090e2 Initial load
duke
parents:
diff changeset
    95
  voidTag = number_of_legal_tags,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    96
  illegalTag,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    97
  number_of_tags
489c9b5090e2 Initial load
duke
parents:
diff changeset
    98
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
    99
489c9b5090e2 Initial load
duke
parents:
diff changeset
   100
489c9b5090e2 Initial load
duke
parents:
diff changeset
   101
class ValueType: public CompilationResourceObj {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   102
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   103
  const int _size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   104
  const ValueTag _tag;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   105
  ValueType();
489c9b5090e2 Initial load
duke
parents:
diff changeset
   106
 protected:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   107
  ValueType(ValueTag tag, int size): _tag(tag), _size(size) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   108
489c9b5090e2 Initial load
duke
parents:
diff changeset
   109
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   110
  // initialization
5707
6c66849ed24e 6958292: C1: Enable parallel compilation
iveresov
parents: 5547
diff changeset
   111
  static void initialize(Arena* arena);
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   112
489c9b5090e2 Initial load
duke
parents:
diff changeset
   113
  // accessors
489c9b5090e2 Initial load
duke
parents:
diff changeset
   114
  virtual ValueType* base() const                = 0; // the 'canonical' type (e.g., intType for an IntConstant)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   115
  ValueTag tag() const { return _tag; }          // the 'canonical' tag  (useful for type matching)
489c9b5090e2 Initial load
duke
parents:
diff changeset
   116
  int size() const {                             // the size of an object of the type in words
489c9b5090e2 Initial load
duke
parents:
diff changeset
   117
    assert(_size > -1, "shouldn't be asking for size");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   118
    return _size;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   119
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   120
  virtual const char tchar() const               = 0; // the type 'character' for printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   121
  virtual const char* name() const               = 0; // the type name for printing
489c9b5090e2 Initial load
duke
parents:
diff changeset
   122
  virtual bool is_constant() const               { return false; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   123
489c9b5090e2 Initial load
duke
parents:
diff changeset
   124
  // testers
489c9b5090e2 Initial load
duke
parents:
diff changeset
   125
  bool is_void()                                 { return tag() == voidTag;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   126
  bool is_int()                                  { return tag() == intTag;    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   127
  bool is_long()                                 { return tag() == longTag;   }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   128
  bool is_float()                                { return tag() == floatTag;  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   129
  bool is_double()                               { return tag() == doubleTag; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   130
  bool is_object()                               { return as_ObjectType()   != NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   131
  bool is_array()                                { return as_ArrayType()    != NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   132
  bool is_instance()                             { return as_InstanceType() != NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   133
  bool is_class()                                { return as_ClassType()    != NULL; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   134
  bool is_method()                               { return as_MethodType()   != NULL; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   135
  bool is_method_data()                          { return as_MethodDataType() != NULL; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   136
  bool is_address()                              { return as_AddressType()  != NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   137
  bool is_illegal()                              { return tag() == illegalTag; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   138
489c9b5090e2 Initial load
duke
parents:
diff changeset
   139
  bool is_int_kind() const                       { return tag() == intTag || tag() == longTag; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   140
  bool is_float_kind() const                     { return tag() == floatTag || tag() == doubleTag; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   141
  bool is_object_kind() const                    { return tag() == objectTag; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   142
489c9b5090e2 Initial load
duke
parents:
diff changeset
   143
  bool is_single_word() const                    { return _size == 1; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   144
  bool is_double_word() const                    { return _size == 2; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   145
489c9b5090e2 Initial load
duke
parents:
diff changeset
   146
  // casting
489c9b5090e2 Initial load
duke
parents:
diff changeset
   147
  virtual VoidType*         as_VoidType()        { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   148
  virtual IntType*          as_IntType()         { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   149
  virtual LongType*         as_LongType()        { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   150
  virtual FloatType*        as_FloatType()       { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   151
  virtual DoubleType*       as_DoubleType()      { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   152
  virtual ObjectType*       as_ObjectType()      { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   153
  virtual ArrayType*        as_ArrayType()       { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   154
  virtual InstanceType*     as_InstanceType()    { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   155
  virtual ClassType*        as_ClassType()       { return NULL; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   156
  virtual MetadataType*     as_MetadataType()    { return NULL; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   157
  virtual MethodType*       as_MethodType()      { return NULL; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   158
  virtual MethodDataType*   as_MethodDataType()  { return NULL; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   159
  virtual AddressType*      as_AddressType()     { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   160
  virtual IllegalType*      as_IllegalType()     { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   161
489c9b5090e2 Initial load
duke
parents:
diff changeset
   162
  virtual IntConstant*      as_IntConstant()     { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   163
  virtual LongConstant*     as_LongConstant()    { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   164
  virtual FloatConstant*    as_FloatConstant()   { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   165
  virtual DoubleConstant*   as_DoubleConstant()  { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   166
  virtual ObjectConstant*   as_ObjectConstant()  { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   167
  virtual InstanceConstant* as_InstanceConstant(){ return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   168
  virtual ClassConstant*    as_ClassConstant()   { return NULL; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   169
  virtual MethodConstant*   as_MethodConstant()  { return NULL; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   170
  virtual MethodDataConstant* as_MethodDataConstant() { return NULL; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   171
  virtual ArrayConstant*    as_ArrayConstant()   { return NULL; }
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   172
  virtual StableArrayConstant* as_StableArrayConstant()   { return NULL; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   173
  virtual AddressConstant*  as_AddressConstant() { return NULL; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   174
489c9b5090e2 Initial load
duke
parents:
diff changeset
   175
  // type operations
489c9b5090e2 Initial load
duke
parents:
diff changeset
   176
  ValueType* meet(ValueType* y) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   177
  ValueType* join(ValueType* y) const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   178
489c9b5090e2 Initial load
duke
parents:
diff changeset
   179
  // debugging
24424
2658d7834c6e 8037816: Fix for 8036122 breaks build with Xcode5/clang
drchase
parents: 13728
diff changeset
   180
  void print(outputStream* s = tty)              { s->print("%s", name()); }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   181
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   182
489c9b5090e2 Initial load
duke
parents:
diff changeset
   183
489c9b5090e2 Initial load
duke
parents:
diff changeset
   184
class VoidType: public ValueType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   185
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   186
  VoidType(): ValueType(voidTag, 0) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   187
  virtual ValueType* base() const                { return voidType; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   188
  virtual const char tchar() const               { return 'v'; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   189
  virtual const char* name() const               { return "void"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   190
  virtual VoidType* as_VoidType()                { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   191
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   192
489c9b5090e2 Initial load
duke
parents:
diff changeset
   193
489c9b5090e2 Initial load
duke
parents:
diff changeset
   194
class IntType: public ValueType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   195
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   196
  IntType(): ValueType(intTag, 1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   197
  virtual ValueType* base() const                { return intType; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   198
  virtual const char tchar() const               { return 'i'; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   199
  virtual const char* name() const               { return "int"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   200
  virtual IntType* as_IntType()                  { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   201
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   202
489c9b5090e2 Initial load
duke
parents:
diff changeset
   203
489c9b5090e2 Initial load
duke
parents:
diff changeset
   204
class IntConstant: public IntType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   205
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   206
  jint _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   207
489c9b5090e2 Initial load
duke
parents:
diff changeset
   208
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   209
  IntConstant(jint value)                        { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   210
489c9b5090e2 Initial load
duke
parents:
diff changeset
   211
  jint value() const                             { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   212
489c9b5090e2 Initial load
duke
parents:
diff changeset
   213
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   214
  virtual IntConstant* as_IntConstant()          { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   215
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   216
489c9b5090e2 Initial load
duke
parents:
diff changeset
   217
489c9b5090e2 Initial load
duke
parents:
diff changeset
   218
class IntInterval: public IntType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   219
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   220
  jint _beg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   221
  jint _end;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   222
489c9b5090e2 Initial load
duke
parents:
diff changeset
   223
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   224
  IntInterval(jint beg, jint end) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   225
    assert(beg <= end, "illegal interval");
489c9b5090e2 Initial load
duke
parents:
diff changeset
   226
    _beg = beg;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   227
    _end = end;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   228
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   229
489c9b5090e2 Initial load
duke
parents:
diff changeset
   230
  jint beg() const                               { return _beg; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   231
  jint end() const                               { return _end; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   232
489c9b5090e2 Initial load
duke
parents:
diff changeset
   233
  virtual bool is_interval() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   234
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   235
489c9b5090e2 Initial load
duke
parents:
diff changeset
   236
489c9b5090e2 Initial load
duke
parents:
diff changeset
   237
class LongType: public ValueType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   238
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   239
  LongType(): ValueType(longTag, 2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   240
  virtual ValueType* base() const                { return longType; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   241
  virtual const char tchar() const               { return 'l'; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   242
  virtual const char* name() const               { return "long"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   243
  virtual LongType* as_LongType()                { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   244
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   245
489c9b5090e2 Initial load
duke
parents:
diff changeset
   246
489c9b5090e2 Initial load
duke
parents:
diff changeset
   247
class LongConstant: public LongType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   248
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   249
  jlong _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   250
489c9b5090e2 Initial load
duke
parents:
diff changeset
   251
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   252
  LongConstant(jlong value)                      { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   253
489c9b5090e2 Initial load
duke
parents:
diff changeset
   254
  jlong value() const                            { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   255
489c9b5090e2 Initial load
duke
parents:
diff changeset
   256
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   257
  virtual LongConstant* as_LongConstant()        { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   258
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   259
489c9b5090e2 Initial load
duke
parents:
diff changeset
   260
489c9b5090e2 Initial load
duke
parents:
diff changeset
   261
class FloatType: public ValueType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   262
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   263
  FloatType(): ValueType(floatTag, 1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   264
  virtual ValueType* base() const                { return floatType; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   265
  virtual const char tchar() const               { return 'f'; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   266
  virtual const char* name() const               { return "float"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   267
  virtual FloatType* as_FloatType()              { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   268
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   269
489c9b5090e2 Initial load
duke
parents:
diff changeset
   270
489c9b5090e2 Initial load
duke
parents:
diff changeset
   271
class FloatConstant: public FloatType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   272
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   273
  jfloat _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   274
489c9b5090e2 Initial load
duke
parents:
diff changeset
   275
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   276
  FloatConstant(jfloat value)                    { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   277
489c9b5090e2 Initial load
duke
parents:
diff changeset
   278
  jfloat value() const                           { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   279
489c9b5090e2 Initial load
duke
parents:
diff changeset
   280
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   281
  virtual FloatConstant* as_FloatConstant()      { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   282
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   283
489c9b5090e2 Initial load
duke
parents:
diff changeset
   284
489c9b5090e2 Initial load
duke
parents:
diff changeset
   285
class DoubleType: public ValueType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   286
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   287
  DoubleType(): ValueType(doubleTag, 2) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   288
  virtual ValueType* base() const                { return doubleType; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   289
  virtual const char tchar() const               { return 'd'; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   290
  virtual const char* name() const               { return "double"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   291
  virtual DoubleType* as_DoubleType()            { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   292
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   293
489c9b5090e2 Initial load
duke
parents:
diff changeset
   294
489c9b5090e2 Initial load
duke
parents:
diff changeset
   295
class DoubleConstant: public DoubleType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   296
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   297
  jdouble _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   298
489c9b5090e2 Initial load
duke
parents:
diff changeset
   299
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   300
  DoubleConstant(jdouble value)                  { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   301
489c9b5090e2 Initial load
duke
parents:
diff changeset
   302
  jdouble value() const                          { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   303
489c9b5090e2 Initial load
duke
parents:
diff changeset
   304
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   305
  virtual DoubleConstant* as_DoubleConstant()    { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   306
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   307
489c9b5090e2 Initial load
duke
parents:
diff changeset
   308
489c9b5090e2 Initial load
duke
parents:
diff changeset
   309
class ObjectType: public ValueType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   310
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   311
  ObjectType(): ValueType(objectTag, 1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   312
  virtual ValueType* base() const                { return objectType; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   313
  virtual const char tchar() const               { return 'a'; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   314
  virtual const char* name() const               { return "object"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   315
  virtual ObjectType* as_ObjectType()            { return this; }
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 7397
diff changeset
   316
  virtual ciObject* constant_value() const       { ShouldNotReachHere(); return NULL; }
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 7397
diff changeset
   317
  virtual ciType* exact_type() const             { return NULL; }
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   318
  bool is_loaded() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   319
  jobject encoding() const;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   320
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   321
489c9b5090e2 Initial load
duke
parents:
diff changeset
   322
489c9b5090e2 Initial load
duke
parents:
diff changeset
   323
class ObjectConstant: public ObjectType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   324
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   325
  ciObject* _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   326
489c9b5090e2 Initial load
duke
parents:
diff changeset
   327
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   328
  ObjectConstant(ciObject* value)                { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   329
489c9b5090e2 Initial load
duke
parents:
diff changeset
   330
  ciObject* value() const                        { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   331
489c9b5090e2 Initial load
duke
parents:
diff changeset
   332
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   333
  virtual ObjectConstant* as_ObjectConstant()    { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   334
  virtual ciObject* constant_value() const;
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 7397
diff changeset
   335
  virtual ciType* exact_type() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   336
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   337
489c9b5090e2 Initial load
duke
parents:
diff changeset
   338
489c9b5090e2 Initial load
duke
parents:
diff changeset
   339
class ArrayType: public ObjectType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   340
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   341
  virtual ArrayType* as_ArrayType()              { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   342
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   343
489c9b5090e2 Initial load
duke
parents:
diff changeset
   344
489c9b5090e2 Initial load
duke
parents:
diff changeset
   345
class ArrayConstant: public ArrayType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   346
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   347
  ciArray* _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   348
489c9b5090e2 Initial load
duke
parents:
diff changeset
   349
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   350
  ArrayConstant(ciArray* value)                  { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   351
489c9b5090e2 Initial load
duke
parents:
diff changeset
   352
  ciArray* value() const                         { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   353
489c9b5090e2 Initial load
duke
parents:
diff changeset
   354
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   355
  virtual ArrayConstant* as_ArrayConstant()      { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   356
  virtual ciObject* constant_value() const;
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 7397
diff changeset
   357
  virtual ciType* exact_type() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   358
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   359
36604
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   360
class StableArrayConstant: public ArrayConstant {
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   361
 private:
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   362
  jint _dimension;
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   363
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   364
 public:
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   365
  StableArrayConstant(ciArray* value, jint dimension) : ArrayConstant(value) {
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   366
    assert(dimension > 0, "not a stable array");
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   367
    _dimension = dimension;
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   368
  }
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   369
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   370
  jint dimension() const                              { return _dimension; }
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   371
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   372
  virtual StableArrayConstant* as_StableArrayConstant() { return this; }
e9c073b0c19e 8143407: C1: @Stable array support
vlivanov
parents: 24424
diff changeset
   373
};
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   374
489c9b5090e2 Initial load
duke
parents:
diff changeset
   375
class InstanceType: public ObjectType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   376
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   377
  virtual InstanceType* as_InstanceType()        { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   378
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   379
489c9b5090e2 Initial load
duke
parents:
diff changeset
   380
489c9b5090e2 Initial load
duke
parents:
diff changeset
   381
class InstanceConstant: public InstanceType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   382
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   383
  ciInstance* _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   384
489c9b5090e2 Initial load
duke
parents:
diff changeset
   385
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   386
  InstanceConstant(ciInstance* value)            { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   387
489c9b5090e2 Initial load
duke
parents:
diff changeset
   388
  ciInstance* value() const                      { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   389
489c9b5090e2 Initial load
duke
parents:
diff changeset
   390
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   391
  virtual InstanceConstant* as_InstanceConstant(){ return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   392
  virtual ciObject* constant_value() const;
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 7397
diff changeset
   393
  virtual ciType* exact_type() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   394
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   395
489c9b5090e2 Initial load
duke
parents:
diff changeset
   396
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   397
class MetadataType: public ValueType {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   398
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   399
  MetadataType(): ValueType(metaDataTag, 1) {}
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   400
  virtual ValueType* base() const                       { return objectType; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   401
  virtual const char tchar() const                      { return 'a'; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   402
  virtual const char* name() const                      { return "object"; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   403
  virtual MetadataType* as_MetadataType()               { return this; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   404
  bool is_loaded() const;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   405
  jobject encoding() const;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   406
  virtual ciMetadata* constant_value() const            { ShouldNotReachHere(); return NULL;  }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   407
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   408
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   409
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   410
class ClassType: public MetadataType {
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   411
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   412
  virtual ClassType* as_ClassType()              { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   413
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   414
489c9b5090e2 Initial load
duke
parents:
diff changeset
   415
489c9b5090e2 Initial load
duke
parents:
diff changeset
   416
class ClassConstant: public ClassType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   417
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   418
  ciInstanceKlass* _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   419
489c9b5090e2 Initial load
duke
parents:
diff changeset
   420
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   421
  ClassConstant(ciInstanceKlass* value)          { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   422
489c9b5090e2 Initial load
duke
parents:
diff changeset
   423
  ciInstanceKlass* value() const                 { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   424
489c9b5090e2 Initial load
duke
parents:
diff changeset
   425
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   426
  virtual ClassConstant* as_ClassConstant()      { return this; }
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   427
  virtual ciMetadata* constant_value() const            { return _value; }
13391
30245956af37 7023639: JSR 292 method handle invocation needs a fast path for compiled code
twisti
parents: 7397
diff changeset
   428
  virtual ciType* exact_type() const;
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   429
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   430
489c9b5090e2 Initial load
duke
parents:
diff changeset
   431
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   432
class MethodType: public MetadataType {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   433
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   434
  virtual MethodType* as_MethodType()                   { return this; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   435
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   436
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   437
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   438
class MethodConstant: public MethodType {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   439
 private:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   440
  ciMethod* _value;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   441
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   442
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   443
  MethodConstant(ciMethod* value)                       { _value = value; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   444
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   445
  ciMethod* value() const                               { return _value; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   446
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   447
  virtual bool is_constant() const                      { return true; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   448
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   449
  virtual MethodConstant* as_MethodConstant()           { return this; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   450
  virtual ciMetadata* constant_value() const            { return _value; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   451
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   452
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   453
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   454
class MethodDataType: public MetadataType {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   455
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   456
  virtual MethodDataType* as_MethodDataType()           { return this; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   457
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   458
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   459
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   460
class MethodDataConstant: public MethodDataType {
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   461
 private:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   462
  ciMethodData* _value;
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   463
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   464
 public:
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   465
  MethodDataConstant(ciMethodData* value)               { _value = value; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   466
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   467
  ciMethodData* value() const                           { return _value; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   468
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   469
  virtual bool is_constant() const                      { return true; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   470
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   471
  virtual MethodDataConstant* as_MethodDataConstant()   { return this; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   472
  virtual ciMetadata* constant_value() const            { return _value; }
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   473
};
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   474
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 13391
diff changeset
   475
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
   476
class AddressType: public ValueType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   477
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   478
  AddressType(): ValueType(addressTag, 1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   479
  virtual ValueType* base() const                { return addressType; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   480
  virtual const char tchar() const               { return 'r'; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   481
  virtual const char* name() const               { return "address"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   482
  virtual AddressType* as_AddressType()          { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   483
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   484
489c9b5090e2 Initial load
duke
parents:
diff changeset
   485
489c9b5090e2 Initial load
duke
parents:
diff changeset
   486
class AddressConstant: public AddressType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   487
 private:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   488
  jint _value;
489c9b5090e2 Initial load
duke
parents:
diff changeset
   489
489c9b5090e2 Initial load
duke
parents:
diff changeset
   490
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   491
  AddressConstant(jint value)                    { _value = value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   492
489c9b5090e2 Initial load
duke
parents:
diff changeset
   493
  jint value() const                             { return _value; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   494
489c9b5090e2 Initial load
duke
parents:
diff changeset
   495
  virtual bool is_constant() const               { return true; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   496
489c9b5090e2 Initial load
duke
parents:
diff changeset
   497
  virtual AddressConstant* as_AddressConstant()  { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   498
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   499
489c9b5090e2 Initial load
duke
parents:
diff changeset
   500
489c9b5090e2 Initial load
duke
parents:
diff changeset
   501
class IllegalType: public ValueType {
489c9b5090e2 Initial load
duke
parents:
diff changeset
   502
 public:
489c9b5090e2 Initial load
duke
parents:
diff changeset
   503
  IllegalType(): ValueType(illegalTag, -1) {}
489c9b5090e2 Initial load
duke
parents:
diff changeset
   504
  virtual ValueType* base() const                { return illegalType; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   505
  virtual const char tchar() const               { return ' '; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   506
  virtual const char* name() const               { return "illegal"; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   507
  virtual IllegalType* as_IllegalType()          { return this; }
489c9b5090e2 Initial load
duke
parents:
diff changeset
   508
};
489c9b5090e2 Initial load
duke
parents:
diff changeset
   509
489c9b5090e2 Initial load
duke
parents:
diff changeset
   510
489c9b5090e2 Initial load
duke
parents:
diff changeset
   511
// conversion between ValueTypes, BasicTypes, and ciConstants
489c9b5090e2 Initial load
duke
parents:
diff changeset
   512
ValueType* as_ValueType(BasicType type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   513
ValueType* as_ValueType(ciConstant value);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   514
BasicType  as_BasicType(ValueType* type);
489c9b5090e2 Initial load
duke
parents:
diff changeset
   515
489c9b5090e2 Initial load
duke
parents:
diff changeset
   516
inline ValueType* as_ValueType(ciType* type) { return as_ValueType(type->basic_type()); }
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
   517
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5707
diff changeset
   518
#endif // SHARE_VM_C1_C1_VALUETYPE_HPP