src/share/vm/ci/ciSymbol.hpp

changeset 2497
3582bf76420e
parent 2314
f95d63e2154a
child 2708
1d1603768966
     1.1 --- a/src/share/vm/ci/ciSymbol.hpp	Thu Jan 27 13:42:28 2011 -0800
     1.2 +++ b/src/share/vm/ci/ciSymbol.hpp	Thu Jan 27 16:11:27 2011 -0800
     1.3 @@ -28,15 +28,18 @@
     1.4  #include "ci/ciObject.hpp"
     1.5  #include "ci/ciObjectFactory.hpp"
     1.6  #include "classfile/vmSymbols.hpp"
     1.7 -#include "oops/symbolOop.hpp"
     1.8 +#include "oops/symbol.hpp"
     1.9  
    1.10  // ciSymbol
    1.11  //
    1.12 -// This class represents a symbolOop in the HotSpot virtual
    1.13 +// This class represents a Symbol* in the HotSpot virtual
    1.14  // machine.
    1.15 -class ciSymbol : public ciObject {
    1.16 +class ciSymbol : public ResourceObj {
    1.17 +  Symbol* _symbol;
    1.18 +  uint _ident;
    1.19 +
    1.20    CI_PACKAGE_ACCESS
    1.21 -  // These friends all make direct use of get_symbolOop:
    1.22 +  // These friends all make direct use of get_symbol:
    1.23    friend class ciEnv;
    1.24    friend class ciInstanceKlass;
    1.25    friend class ciSignature;
    1.26 @@ -45,24 +48,28 @@
    1.27  
    1.28  private:
    1.29    const vmSymbols::SID _sid;
    1.30 -  DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbolOop()) == _sid; } )
    1.31 +  DEBUG_ONLY( bool sid_ok() { return vmSymbols::find_sid(get_symbol()) == _sid; } )
    1.32  
    1.33 -  ciSymbol(symbolOop s);  // normal case, for symbols not mentioned in vmSymbols
    1.34 -  ciSymbol(symbolHandle s, vmSymbols::SID sid);   // for use with vmSymbolHandles
    1.35 +  ciSymbol(Symbol* s);  // normal case, for symbols not mentioned in vmSymbols
    1.36 +  ciSymbol(Symbol* s, vmSymbols::SID sid);   // for use with vmSymbols
    1.37  
    1.38 -  symbolOop get_symbolOop() const { return (symbolOop)get_oop(); }
    1.39 +  Symbol* get_symbol() const { return _symbol; }
    1.40  
    1.41    const char* type_string() { return "ciSymbol"; }
    1.42  
    1.43    void print_impl(outputStream* st);
    1.44  
    1.45 -  // This is public in symbolOop but private here, because the base can move:
    1.46 -  jbyte*      base();
    1.47 +  // This is public in Symbol* but private here, because the base can move:
    1.48 +  const jbyte* base();
    1.49  
    1.50    // Make a ciSymbol from a C string (implementation).
    1.51    static ciSymbol* make_impl(const char* s);
    1.52  
    1.53 +  void set_ident(uint id) { _ident = id; }
    1.54  public:
    1.55 +  // A number unique to this object.
    1.56 +  uint ident() { return _ident; }
    1.57 +
    1.58    // The enumeration ID from vmSymbols, or vmSymbols::NO_SID if none.
    1.59    vmSymbols::SID sid() const { return _sid; }
    1.60  
    1.61 @@ -79,9 +86,6 @@
    1.62    // Determines where the symbol contains the given substring.
    1.63    int index_of_at(int i, const char* str, int len) const;
    1.64  
    1.65 -  // What kind of ciObject is this?
    1.66 -  bool is_symbol() { return true; }
    1.67 -
    1.68    void print_symbol_on(outputStream* st);
    1.69    void print_symbol() {
    1.70      print_symbol_on(tty);
    1.71 @@ -96,6 +100,13 @@
    1.72    static ciSymbol* name() { return ciObjectFactory::vm_symbol_at(vmSymbols::VM_SYMBOL_ENUM_NAME(name)); }
    1.73    VM_SYMBOLS_DO(CI_SYMBOL_DECLARE, CI_SYMBOL_DECLARE)
    1.74  #undef CI_SYMBOL_DECLARE
    1.75 +
    1.76 +  void print() {
    1.77 +    _symbol->print();
    1.78 +  }
    1.79 +
    1.80 +  // Are two ciSymbols equal?
    1.81 +  bool equals(ciSymbol* obj) { return this->_symbol == obj->get_symbol(); }
    1.82  };
    1.83  
    1.84  #endif // SHARE_VM_CI_CISYMBOL_HPP

mercurial