Mercurial > hg > graal-compiler
comparison src/share/vm/ci/ciSymbol.hpp @ 2181:d25d4ca69222
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Wed, 16 Feb 2011 13:47:20 +0100 |
parents | 06f017f7daa7 3582bf76420e |
children | 9569fdf936ff |
comparison
equal
deleted
inserted
replaced
2108:50b45e2d9725 | 2181:d25d4ca69222 |
---|---|
26 #define SHARE_VM_CI_CISYMBOL_HPP | 26 #define SHARE_VM_CI_CISYMBOL_HPP |
27 | 27 |
28 #include "ci/ciObject.hpp" | 28 #include "ci/ciObject.hpp" |
29 #include "ci/ciObjectFactory.hpp" | 29 #include "ci/ciObjectFactory.hpp" |
30 #include "classfile/vmSymbols.hpp" | 30 #include "classfile/vmSymbols.hpp" |
31 #include "oops/symbolOop.hpp" | 31 #include "oops/symbol.hpp" |
32 | 32 |
33 // ciSymbol | 33 // ciSymbol |
34 // | 34 // |
35 // This class represents a symbolOop in the HotSpot virtual | 35 // This class represents a Symbol* in the HotSpot virtual |
36 // machine. | 36 // machine. |
37 class ciSymbol : public ciObject { | 37 class ciSymbol : public ResourceObj { |
38 Symbol* _symbol; | |
39 uint _ident; | |
40 | |
38 CI_PACKAGE_ACCESS | 41 CI_PACKAGE_ACCESS |
39 // These friends all make direct use of get_symbolOop: | 42 // These friends all make direct use of get_symbol: |
40 friend class ciEnv; | 43 friend class ciEnv; |
41 friend class ciInstanceKlass; | 44 friend class ciInstanceKlass; |
42 friend class ciSignature; | 45 friend class ciSignature; |
43 friend class ciMethod; | 46 friend class ciMethod; |
44 friend class ciObjArrayKlass; | 47 friend class ciObjArrayKlass; |
45 | 48 |
46 private: | 49 private: |
47 const vmSymbols::SID _sid; | 50 const vmSymbols::SID _sid; |
48 DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbolOop()) == _sid; } ) | 51 DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbol()) == _sid; } ) |
49 | 52 |
50 ciSymbol(symbolOop s); // normal case, for symbols not mentioned in vmSymbols | 53 ciSymbol(Symbol* s); // normal case, for symbols not mentioned in vmSymbols |
51 ciSymbol(symbolHandle s, vmSymbols::SID sid); // for use with vmSymbolHandles | 54 ciSymbol(Symbol* s, vmSymbols::SID sid); // for use with vmSymbols |
55 | |
56 Symbol* get_symbol() const { return _symbol; } | |
52 | 57 |
53 public: | 58 public: |
54 symbolOop get_symbolOop() const { return (symbolOop)get_oop(); } | 59 symbolOop get_symbolOop() const { return (symbolOop)get_oop(); } |
55 | 60 |
56 private: | 61 private: |
57 const char* type_string() { return "ciSymbol"; } | 62 const char* type_string() { return "ciSymbol"; } |
58 | 63 |
59 void print_impl(outputStream* st); | 64 void print_impl(outputStream* st); |
60 | 65 |
61 // This is public in symbolOop but private here, because the base can move: | 66 // This is public in Symbol* but private here, because the base can move: |
62 jbyte* base(); | 67 const jbyte* base(); |
63 | 68 |
64 // Make a ciSymbol from a C string (implementation). | 69 // Make a ciSymbol from a C string (implementation). |
65 static ciSymbol* make_impl(const char* s); | 70 static ciSymbol* make_impl(const char* s); |
66 | 71 |
72 void set_ident(uint id) { _ident = id; } | |
67 public: | 73 public: |
74 // A number unique to this object. | |
75 uint ident() { return _ident; } | |
76 | |
68 // The enumeration ID from vmSymbols, or vmSymbols::NO_SID if none. | 77 // The enumeration ID from vmSymbols, or vmSymbols::NO_SID if none. |
69 vmSymbols::SID sid() const { return _sid; } | 78 vmSymbols::SID sid() const { return _sid; } |
70 | 79 |
71 // The text of the symbol as a null-terminated utf8 string. | 80 // The text of the symbol as a null-terminated utf8 string. |
72 const char* as_utf8(); | 81 const char* as_utf8(); |
79 bool starts_with(const char* prefix, int len) const; | 88 bool starts_with(const char* prefix, int len) const; |
80 | 89 |
81 // Determines where the symbol contains the given substring. | 90 // Determines where the symbol contains the given substring. |
82 int index_of_at(int i, const char* str, int len) const; | 91 int index_of_at(int i, const char* str, int len) const; |
83 | 92 |
84 // What kind of ciObject is this? | |
85 bool is_symbol() { return true; } | |
86 | |
87 void print_symbol_on(outputStream* st); | 93 void print_symbol_on(outputStream* st); |
88 void print_symbol() { | 94 void print_symbol() { |
89 print_symbol_on(tty); | 95 print_symbol_on(tty); |
90 } | 96 } |
91 | 97 |
96 | 102 |
97 #define CI_SYMBOL_DECLARE(name, ignore_def) \ | 103 #define CI_SYMBOL_DECLARE(name, ignore_def) \ |
98 static ciSymbol* name() { return ciObjectFactory::vm_symbol_at(vmSymbols::VM_SYMBOL_ENUM_NAME(name)); } | 104 static ciSymbol* name() { return ciObjectFactory::vm_symbol_at(vmSymbols::VM_SYMBOL_ENUM_NAME(name)); } |
99 VM_SYMBOLS_DO(CI_SYMBOL_DECLARE, CI_SYMBOL_DECLARE) | 105 VM_SYMBOLS_DO(CI_SYMBOL_DECLARE, CI_SYMBOL_DECLARE) |
100 #undef CI_SYMBOL_DECLARE | 106 #undef CI_SYMBOL_DECLARE |
107 | |
108 void print() { | |
109 _symbol->print(); | |
110 } | |
111 | |
112 // Are two ciSymbols equal? | |
113 bool equals(ciSymbol* obj) { return this->_symbol == obj->get_symbol(); } | |
101 }; | 114 }; |
102 | 115 |
103 #endif // SHARE_VM_CI_CISYMBOL_HPP | 116 #endif // SHARE_VM_CI_CISYMBOL_HPP |