src/share/vm/c1/c1_ValueType.hpp

changeset 4037
da91efe96a93
parent 3969
1d7922586cf6
child 6680
78bbf4d43a14
     1.1 --- a/src/share/vm/c1/c1_ValueType.hpp	Fri Aug 31 16:39:35 2012 -0700
     1.2 +++ b/src/share/vm/c1/c1_ValueType.hpp	Sat Sep 01 13:25:18 2012 -0400
     1.3 @@ -1,5 +1,5 @@
     1.4  /*
     1.5 - * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
     1.6 + * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
     1.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     1.8   *
     1.9   * This code is free software; you can redistribute it and/or modify it
    1.10 @@ -27,6 +27,7 @@
    1.11  
    1.12  #include "c1/c1_Compilation.hpp"
    1.13  #include "ci/ciConstant.hpp"
    1.14 +#include "ci/ciMethodData.hpp"
    1.15  
    1.16  // type hierarchy
    1.17  class ValueType;
    1.18 @@ -46,8 +47,13 @@
    1.19  class       ArrayConstant;
    1.20  class     InstanceType;
    1.21  class       InstanceConstant;
    1.22 +class   MetadataType;
    1.23  class     ClassType;
    1.24  class       ClassConstant;
    1.25 +class     MethodType;
    1.26 +class       MethodConstant;
    1.27 +class     MethodDataType;
    1.28 +class       MethodDataConstant;
    1.29  class   AddressType;
    1.30  class     AddressConstant;
    1.31  class   IllegalType;
    1.32 @@ -82,6 +88,7 @@
    1.33    doubleTag,
    1.34    objectTag,
    1.35    addressTag,
    1.36 +  metaDataTag,
    1.37    number_of_legal_tags,
    1.38    // all other tags must follow afterwards
    1.39    voidTag = number_of_legal_tags,
    1.40 @@ -123,6 +130,8 @@
    1.41    bool is_array()                                { return as_ArrayType()    != NULL; }
    1.42    bool is_instance()                             { return as_InstanceType() != NULL; }
    1.43    bool is_class()                                { return as_ClassType()    != NULL; }
    1.44 +  bool is_method()                               { return as_MethodType()   != NULL; }
    1.45 +  bool is_method_data()                          { return as_MethodDataType() != NULL; }
    1.46    bool is_address()                              { return as_AddressType()  != NULL; }
    1.47    bool is_illegal()                              { return tag() == illegalTag; }
    1.48  
    1.49 @@ -143,6 +152,9 @@
    1.50    virtual ArrayType*        as_ArrayType()       { return NULL; }
    1.51    virtual InstanceType*     as_InstanceType()    { return NULL; }
    1.52    virtual ClassType*        as_ClassType()       { return NULL; }
    1.53 +  virtual MetadataType*     as_MetadataType()    { return NULL; }
    1.54 +  virtual MethodType*       as_MethodType()      { return NULL; }
    1.55 +  virtual MethodDataType*   as_MethodDataType()  { return NULL; }
    1.56    virtual AddressType*      as_AddressType()     { return NULL; }
    1.57    virtual IllegalType*      as_IllegalType()     { return NULL; }
    1.58  
    1.59 @@ -153,6 +165,8 @@
    1.60    virtual ObjectConstant*   as_ObjectConstant()  { return NULL; }
    1.61    virtual InstanceConstant* as_InstanceConstant(){ return NULL; }
    1.62    virtual ClassConstant*    as_ClassConstant()   { return NULL; }
    1.63 +  virtual MethodConstant*   as_MethodConstant()  { return NULL; }
    1.64 +  virtual MethodDataConstant* as_MethodDataConstant() { return NULL; }
    1.65    virtual ArrayConstant*    as_ArrayConstant()   { return NULL; }
    1.66    virtual AddressConstant*  as_AddressConstant() { return NULL; }
    1.67  
    1.68 @@ -364,7 +378,20 @@
    1.69  };
    1.70  
    1.71  
    1.72 -class ClassType: public ObjectType {
    1.73 +class MetadataType: public ValueType {
    1.74 + public:
    1.75 +  MetadataType(): ValueType(metaDataTag, 1) {}
    1.76 +  virtual ValueType* base() const                       { return objectType; }
    1.77 +  virtual const char tchar() const                      { return 'a'; }
    1.78 +  virtual const char* name() const                      { return "object"; }
    1.79 +  virtual MetadataType* as_MetadataType()               { return this; }
    1.80 +  bool is_loaded() const;
    1.81 +  jobject encoding() const;
    1.82 +  virtual ciMetadata* constant_value() const            { ShouldNotReachHere(); return NULL;  }
    1.83 +};
    1.84 +
    1.85 +
    1.86 +class ClassType: public MetadataType {
    1.87   public:
    1.88    virtual ClassType* as_ClassType()              { return this; }
    1.89  };
    1.90 @@ -381,11 +408,55 @@
    1.91  
    1.92    virtual bool is_constant() const               { return true; }
    1.93    virtual ClassConstant* as_ClassConstant()      { return this; }
    1.94 -  virtual ciObject* constant_value() const;
    1.95 +  virtual ciMetadata* constant_value() const            { return _value; }
    1.96    virtual ciType* exact_type() const;
    1.97  };
    1.98  
    1.99  
   1.100 +class MethodType: public MetadataType {
   1.101 + public:
   1.102 +  virtual MethodType* as_MethodType()                   { return this; }
   1.103 +};
   1.104 +
   1.105 +
   1.106 +class MethodConstant: public MethodType {
   1.107 + private:
   1.108 +  ciMethod* _value;
   1.109 +
   1.110 + public:
   1.111 +  MethodConstant(ciMethod* value)                       { _value = value; }
   1.112 +
   1.113 +  ciMethod* value() const                               { return _value; }
   1.114 +
   1.115 +  virtual bool is_constant() const                      { return true; }
   1.116 +
   1.117 +  virtual MethodConstant* as_MethodConstant()           { return this; }
   1.118 +  virtual ciMetadata* constant_value() const            { return _value; }
   1.119 +};
   1.120 +
   1.121 +
   1.122 +class MethodDataType: public MetadataType {
   1.123 + public:
   1.124 +  virtual MethodDataType* as_MethodDataType()           { return this; }
   1.125 +};
   1.126 +
   1.127 +
   1.128 +class MethodDataConstant: public MethodDataType {
   1.129 + private:
   1.130 +  ciMethodData* _value;
   1.131 +
   1.132 + public:
   1.133 +  MethodDataConstant(ciMethodData* value)               { _value = value; }
   1.134 +
   1.135 +  ciMethodData* value() const                           { return _value; }
   1.136 +
   1.137 +  virtual bool is_constant() const                      { return true; }
   1.138 +
   1.139 +  virtual MethodDataConstant* as_MethodDataConstant()   { return this; }
   1.140 +  virtual ciMetadata* constant_value() const            { return _value; }
   1.141 +};
   1.142 +
   1.143 +
   1.144  class AddressType: public ValueType {
   1.145   public:
   1.146    AddressType(): ValueType(addressTag, 1) {}

mercurial