home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 20 / AACD20.BIN / AACD / Programming / Jikes / Source / src / lookup.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-02-24  |  17.0 KB  |  834 lines

  1. // $Id: lookup.h,v 1.23 2001/02/17 08:08:54 mdejong Exp $
  2. //
  3. // This software is subject to the terms of the IBM Jikes Compiler
  4. // License Agreement available at the following URL:
  5. // http://www.ibm.com/research/jikes.
  6. // Copyright (C) 1996, 1998, International Business Machines Corporation
  7. // and others.  All Rights Reserved.
  8. // You must accept the terms of that agreement to use this software.
  9. //
  10. #ifndef lookup_INCLUDED
  11. #define lookup_INCLUDED
  12.  
  13. #include "platform.h"
  14. #include "tuple.h"
  15. #include "long.h"
  16. #include "double.h"
  17.  
  18. #ifdef HAVE_TIME_H
  19. #include <time.h>
  20. #endif
  21.  
  22. #ifdef HAVE_WCHAR_H
  23. # include <wchar.h>
  24. #endif
  25.  
  26. #ifdef    HAVE_JIKES_NAMESPACE
  27. namespace Jikes {    // Open namespace Jikes block
  28. #endif
  29.  
  30. class Control;
  31. class Symbol;
  32. class PackageSymbol;
  33. class TypeSymbol;
  34. class MethodSymbol;
  35. class MethodShadowSymbol;
  36. class BlockSymbol;
  37. class VariableSymbol;
  38. class VariableShadowSymbol;
  39. class LabelSymbol;
  40. class LiteralSymbol;
  41. class NameSymbol;
  42.  
  43. class PathSymbol;
  44. class DirectorySymbol;
  45. class FileSymbol;
  46.  
  47. class ShadowSymbol;
  48.  
  49. class LiteralValue;
  50. class IntLiteralValue;
  51. class LongLiteralValue;
  52. class FloatLiteralValue;
  53. class DoubleLiteralValue;
  54. class Utf8LiteralValue;
  55.  
  56. class Utf8LiteralTable;
  57. class NameLookupTable;
  58. class TypeLookupTable;
  59. class LiteralLookupTable;
  60.  
  61. class AstBinaryExpression;
  62. class AstExpression;
  63.  
  64. class Hash
  65. {
  66. public:
  67.     //
  68.     // HASH takes as argument a pointer to a character string
  69.     // and its length which it hashes it into a location in the name
  70.     // hash table.
  71.     //
  72.     inline static unsigned Function(wchar_t *head, int len)
  73.     {
  74.         unsigned long hash_value = head[len >> 1]; // start with center (or unique) letter
  75.         wchar_t *tail = &head[len - 1];
  76.  
  77.         for (int i = 0; i < 5 && head < tail; i++)
  78.         {
  79.             unsigned k = *tail--;
  80.             hash_value += ((k << 7) + *head++);
  81.         }
  82.  
  83.         return hash_value;
  84.     }
  85.  
  86.     //
  87.     // Same as above function for a regular "char" string.
  88.     //
  89.     inline static unsigned Function(const char *head, int len)
  90.     {
  91.         unsigned long hash_value = head[len >> 1]; // start with center (or unique) letter
  92.         const char *tail = &head[len - 1];
  93.  
  94.         for (int i = 0; i < 5 && head < tail; i++)
  95.         {
  96.             unsigned k = *tail--;
  97.             hash_value += ((k << 7) + *head++);
  98.         }
  99.  
  100.         return hash_value;
  101.     }
  102.  
  103.     inline static unsigned Function(LongInt value)
  104.     {
  105.         return value.hashCode();
  106.     }
  107.  
  108.     inline static unsigned Function(IEEEfloat value)
  109.     {
  110.         return value.hashCode();
  111.     }
  112.  
  113.     inline static unsigned Function(IEEEdouble value)
  114.     {
  115.         return value.hashCode();
  116.     }
  117. };
  118.  
  119.  
  120. class DirectoryEntry
  121. {
  122. public:
  123.     DirectoryEntry *next;
  124.     char *name;
  125.     int length;
  126.  
  127.     DirectoryEntry() : next(NULL),
  128.                        name(NULL),
  129.                        length(0),
  130.                        directory(NULL),
  131.                        mtime_(0)
  132.     {
  133.         image = this;
  134.     }
  135.  
  136.     virtual ~DirectoryEntry()
  137.     {
  138.         delete [] name;
  139.     }
  140.  
  141.  
  142.     inline void Initialize(DirectorySymbol *directory_, char *name_, int length_)
  143.     {
  144.         directory = directory_;
  145.         length = length_;
  146.         name = new char[length + 1];
  147.         memmove(name, name_, length * sizeof(char));
  148.         name[length] = U_NULL;
  149.  
  150.         return;
  151.     }
  152.  
  153.     inline void Initialize(DirectoryEntry *entry, char *name_, int length_)
  154.     {
  155.         Initialize(entry -> directory, name_, length_);
  156.     }
  157.  
  158.     time_t Mtime();
  159.  
  160.     bool IsDummy() { return this != image; }
  161.  
  162.     //
  163.     // See FoldedDirectoryEntry for an explanation of the use of this function
  164.     //
  165.     virtual DirectoryEntry *Image() { return this; }
  166.  
  167. protected:
  168.     DirectorySymbol *directory;
  169.     DirectoryEntry *image;
  170.     time_t mtime_;
  171. };
  172.  
  173.  
  174. #ifdef WIN32_FILE_SYSTEM
  175. //
  176. // This object is needed only for systems such as Windows NT/95/98 that
  177. // treat filenames in a case-insensitive fashion.
  178. //
  179. class FoldedDirectoryEntry : public DirectoryEntry
  180. {
  181. public:
  182.     FoldedDirectoryEntry(DirectoryEntry *image_) { DirectoryEntry::image = image_; }
  183.     virtual ~FoldedDirectoryEntry() {}
  184.  
  185.     virtual DirectoryEntry *Image() { return image; }
  186. };
  187. #endif
  188.  
  189.  
  190. class SystemTable
  191. {
  192.     enum
  193.     {
  194.         DEFAULT_HASH_SIZE = 13,
  195.         MAX_HASH_SIZE = 1021
  196.     };
  197.  
  198. public:
  199.  
  200.     SystemTable(int = DEFAULT_HASH_SIZE);
  201.     virtual ~SystemTable();
  202.  
  203.     DirectorySymbol *FindDirectorySymbol(dev_t, ino_t);
  204.     void InsertDirectorySymbol(dev_t, ino_t, DirectorySymbol *);
  205.  
  206. private:
  207.     class Element
  208.     {
  209.     public:
  210.         Element(dev_t device_, ino_t inode_, DirectorySymbol *directory_symbol_) : device(device_),
  211.                                                                                    inode(inode_),
  212.                                                                                    directory_symbol(directory_symbol_)
  213.         {}
  214.  
  215.         Element *next;
  216.         dev_t device;
  217.         ino_t inode;
  218.         DirectorySymbol *directory_symbol;
  219.     };
  220.  
  221.     Tuple<Element *> directories;
  222.  
  223.     Element **base;
  224.     int hash_size;
  225.  
  226.     static int primes[];
  227.     int prime_index;
  228.  
  229.     int hash(dev_t device, ino_t inode) { return (device + inode) % hash_size; }
  230.  
  231.     void Rehash();
  232. };
  233.  
  234.  
  235. class DirectoryTable
  236. {
  237. public:
  238.     Tuple<DirectoryEntry *> entry_pool;
  239.  
  240.     DirectoryTable(int estimate = 1024);
  241.     ~DirectoryTable();
  242.  
  243.     DirectoryEntry *FindEntry(char *, int);
  244.     DirectoryEntry *InsertEntry(DirectorySymbol *, char *, int);
  245.  
  246. #ifdef WIN32_FILE_SYSTEM
  247.     //
  248.     // See FoldedDirectoryEntry for an explanation of the use of this function
  249.     //
  250.     DirectoryEntry *FindCaseInsensitiveEntry(char *, int);
  251.     void InsertCaseInsensitiveEntry(DirectoryEntry *);
  252. #endif
  253.  
  254. private:
  255.     enum
  256.     {
  257.         DEFAULT_HASH_SIZE = 1021,
  258.         MAX_HASH_SIZE = 8191
  259.     };
  260.  
  261.     DirectoryEntry **base;
  262.     int hash_size;
  263.  
  264.     static int primes[];
  265.     int prime_index;
  266.  
  267.     inline static unsigned Hash(const char *head, int len) { return Hash::Function(head, len); }
  268.  
  269.     void Rehash();
  270. };
  271.  
  272.  
  273. class Symbol
  274. {
  275. public:
  276.     Symbol  *next;
  277.  
  278.     enum SymbolKind
  279.     {
  280.          NONE,
  281.          NAME,
  282.          PACKAGE,
  283.          TYPE, // class or interface
  284.          METHOD,
  285.          BLOCK,
  286.          VARIABLE,
  287.          LABEL,
  288.          LITERAL,
  289.  
  290.          PATH,
  291.          _DIRECTORY,
  292.          _FILE,
  293.  
  294.          _num_kinds
  295.     };
  296.  
  297.     SymbolKind Kind() { return _kind; }
  298.     virtual wchar_t *Name()   { return (wchar_t *) NULL; }
  299.     virtual size_t NameLength() { return 0; }
  300.     virtual NameSymbol *Identity() { return (NameSymbol *) NULL; }
  301.  
  302.     PackageSymbol        *PackageCast()        { return (PackageSymbol *) (_kind == PACKAGE ? this : NULL); }
  303.     TypeSymbol           *TypeCast()           { return (TypeSymbol *) (_kind == TYPE ? this : NULL); }
  304.     MethodSymbol         *MethodCast()         { return (MethodSymbol *) (_kind == METHOD ? this : NULL); }
  305.     BlockSymbol          *BlockCast()          { return (BlockSymbol *) (_kind == BLOCK ? this : NULL); }
  306.     VariableSymbol       *VariableCast()       { return (VariableSymbol *) (_kind == VARIABLE ? this : NULL); }
  307.     LabelSymbol          *LabelCast()          { return (LabelSymbol *) (_kind == LABEL ? this : NULL); }
  308.     LiteralSymbol        *LiteralCast()        { return (LiteralSymbol *) (_kind == LITERAL ? this : NULL); }
  309.     NameSymbol           *NameCast()           { return (NameSymbol *) (_kind == NAME ? this : NULL); }
  310.  
  311.     PathSymbol           *PathCast()           { return (PathSymbol *) (_kind == PATH ? this : NULL); }
  312.     DirectorySymbol      *DirectoryCast()      { return (DirectorySymbol *) (_kind == _DIRECTORY ? this : NULL); }
  313.     FileSymbol           *FileCast()           { return (FileSymbol *) (_kind == _FILE ? this : NULL); }
  314.  
  315.     virtual ~Symbol() {}
  316.  
  317. protected:
  318.     SymbolKind _kind;
  319. };
  320.  
  321.  
  322. class LiteralValue
  323. {
  324. public:
  325.     LiteralValue *next;
  326.     int index;
  327.  
  328.     virtual ~LiteralValue() {}
  329. };
  330.  
  331.  
  332. class IntLiteralValue : public LiteralValue
  333. {
  334. public:
  335.     int value;
  336.  
  337.     virtual ~IntLiteralValue() {}
  338.  
  339.     void Initialize(int value_, int index_)
  340.     {
  341.         value = value_;
  342.         index = index_;
  343.     }
  344. };
  345.  
  346.  
  347. class LongLiteralValue : public LiteralValue
  348. {
  349. public:
  350.     LongInt value;
  351.  
  352.     virtual ~LongLiteralValue() {}
  353.  
  354.     void Initialize(LongInt value_, int index_)
  355.     {
  356.         value = value_;
  357.         index = index_;
  358.     }
  359. };
  360.  
  361.  
  362. class FloatLiteralValue : public LiteralValue
  363. {
  364. public:
  365.     IEEEfloat value;
  366.  
  367.     virtual ~FloatLiteralValue() {}
  368.  
  369.     void Initialize(IEEEfloat value_, int index_)
  370.     {
  371.         value = value_;
  372.         index = index_;
  373.     }
  374. };
  375.  
  376.  
  377. class DoubleLiteralValue : public LiteralValue
  378. {
  379. public:
  380.     IEEEdouble value;
  381.  
  382.     virtual ~DoubleLiteralValue() {}
  383.  
  384.     void Initialize(IEEEdouble value_, int index_)
  385.     {
  386.         value = value_;
  387.         index = index_;
  388.     }
  389. };
  390.  
  391.  
  392. class Utf8LiteralValue : public LiteralValue
  393. {
  394. public:
  395.     char *value;
  396.     int  length;
  397.  
  398.     Utf8LiteralValue() : value(NULL)
  399.     {}
  400.  
  401.     virtual ~Utf8LiteralValue()
  402.     {
  403.         delete [] value;
  404.     }
  405.  
  406.     void Initialize(const char *value_, int length_, unsigned hash_address_, int index_)
  407.     {
  408.         length = length_;
  409.         value = new char[length + 1];
  410.         memmove(value, value_, length * sizeof(char));
  411.         value[length] = U_NULL;
  412.  
  413.         hash_address = hash_address_;
  414.         index = index_;
  415.     }
  416.  
  417. private:
  418.  
  419.     friend class Utf8LiteralTable;
  420.  
  421.     unsigned hash_address;
  422. };
  423.  
  424.  
  425. class NameSymbol : public Symbol
  426. {
  427. public:
  428.     int index;
  429.     Utf8LiteralValue *Utf8_literal;
  430.  
  431.     virtual wchar_t *Name()   { return name_; }
  432.     virtual size_t NameLength() { return length; }
  433.     virtual NameSymbol *Identity() { return this; }
  434.     char *Utf8Name() { return (char *) (Utf8_literal ? Utf8_literal -> value : NULL); }
  435.     int Utf8NameLength() { return (Utf8_literal ? Utf8_literal -> length : 0); }
  436.  
  437.     NameSymbol() : name_(NULL)
  438.     {}
  439.  
  440.     virtual ~NameSymbol()
  441.     {
  442.         delete [] name_;
  443.     }
  444.  
  445.     inline void Initialize(wchar_t *str, int length_, unsigned hash_address_, int index_)
  446.     {
  447.         Symbol::_kind = NAME;
  448.  
  449.         hash_address = hash_address_;
  450.         index = index_;
  451.  
  452.         length = length_;
  453.         name_ = new wchar_t[length + 1];
  454.         memmove(name_, str, length * sizeof(wchar_t));
  455.         name_[length] = U_NULL;
  456.  
  457.         Utf8_literal = NULL;
  458.  
  459.         return;
  460.     }
  461.  
  462. private:
  463.  
  464.     friend class NameLookupTable;
  465.  
  466.     wchar_t *name_;
  467.     int length;
  468.     unsigned hash_address;
  469. };
  470.  
  471.  
  472. class NameLookupTable
  473. {
  474. public:
  475.     Tuple<NameSymbol *> symbol_pool;
  476.  
  477.     NameLookupTable(int estimate = 16384);
  478.     ~NameLookupTable();
  479.  
  480.     NameSymbol *FindOrInsertName(wchar_t *, size_t);
  481.  
  482. private:
  483.     enum
  484.     {
  485.         DEFAULT_HASH_SIZE = 4093,
  486.         MAX_HASH_SIZE = 32771
  487.     };
  488.  
  489.     NameSymbol **base;
  490.     int hash_size;
  491.  
  492.     static int primes[];
  493.     int prime_index;
  494.  
  495.     inline static unsigned Hash(wchar_t *head, int len) { return Hash::Function(head, len); }
  496.  
  497.     void Rehash();
  498. };
  499.  
  500.  
  501. class TypeLookupTable
  502. {
  503. public:
  504.     TypeLookupTable(int estimate = 16384);
  505.     ~TypeLookupTable();
  506.  
  507.     TypeSymbol *FindType(const char *, int);
  508.     void InsertType(TypeSymbol *);
  509.     void SetEmpty();
  510.  
  511. private:
  512.     Tuple<TypeSymbol *> symbol_pool;
  513.  
  514.     enum
  515.     {
  516.         DEFAULT_HASH_SIZE = 4093,
  517.         MAX_HASH_SIZE = 32771
  518.     };
  519.  
  520.     TypeSymbol **base;
  521.     int hash_size;
  522.  
  523.     static int primes[];
  524.     int prime_index;
  525.  
  526.     inline static unsigned Hash(const char *head, int len) { return Hash::Function(head, len); }
  527.  
  528.     void Rehash();
  529. };
  530.  
  531.  
  532. class LiteralSymbol : public Symbol
  533. {
  534. public:
  535.     LiteralValue *value;
  536.  
  537.     virtual wchar_t *Name()   { return name_; }
  538.     virtual size_t NameLength() { return length; }
  539.     virtual NameSymbol *Identity() { return (NameSymbol *) NULL; }
  540.  
  541.     LiteralSymbol() : name_(NULL)
  542.     {}
  543.  
  544.     virtual ~LiteralSymbol()
  545.     {
  546.         delete [] name_;
  547.     }
  548.  
  549.     void Initialize(wchar_t *str, unsigned hash_address_, int length_)
  550.     {
  551.         Symbol::_kind = LITERAL;
  552.  
  553.         hash_address = hash_address_;
  554.  
  555.         length = length_;
  556.         name_ = new wchar_t[length + 1];
  557.         memmove(name_, str, length * sizeof(wchar_t));
  558.         name_[length] = U_NULL;
  559.  
  560.         value = NULL;
  561.     }
  562.  
  563. private:
  564.  
  565.     friend class LiteralLookupTable;
  566.  
  567.     wchar_t *name_;
  568.     int length;
  569.     unsigned hash_address;
  570. };
  571.  
  572.  
  573. class LiteralLookupTable
  574. {
  575. public:
  576.     Tuple<LiteralSymbol *> symbol_pool;
  577.  
  578.     LiteralLookupTable();
  579.     ~LiteralLookupTable();
  580.  
  581.     LiteralSymbol *FindOrInsertLiteral(wchar_t *, size_t);
  582.  
  583. private:
  584.     enum
  585.     {
  586.         DEFAULT_HASH_SIZE = 1021,
  587.         MAX_HASH_SIZE = 8191
  588.     };
  589.  
  590.     LiteralSymbol **base;
  591.     int hash_size;
  592.  
  593.     static int primes[];
  594.     int prime_index;
  595.  
  596.     inline static unsigned Hash(wchar_t *head, int len) { return Hash::Function(head, len); }
  597.  
  598.     void Rehash();
  599. };
  600.  
  601.  
  602. class IntLiteralTable
  603. {
  604. public:
  605.     Tuple<IntLiteralValue *> symbol_pool;
  606.  
  607.     IntLiteralTable(LiteralValue *);
  608.     ~IntLiteralTable();
  609.  
  610.     LiteralValue *FindOrInsertNull()
  611.     {
  612.         return FindOrInsert(0);
  613.     }
  614.  
  615.     LiteralValue *FindOrInsertChar(LiteralSymbol *);
  616.     LiteralValue *FindOrInsertInt(LiteralSymbol *);
  617.     LiteralValue *FindOrInsertHexInt(LiteralSymbol *);
  618.     LiteralValue *FindOrInsertOctalInt(LiteralSymbol *);
  619.     LiteralValue *FindOrInsertNegativeInt(LiteralSymbol *);
  620.  
  621.     IntLiteralValue *FindOrInsert(int);
  622.     IntLiteralValue *Find(int);
  623.  
  624. #ifdef JIKES_DEBUG
  625.     //
  626.     // To prevent arithmentic conversion to allow illegal calls inadvertently.
  627.     // Since the return type is wrong, compilation will fail !
  628.     //
  629.     void FindOrInsert(LongInt) {}
  630.     void FindOrInsert(float)   {}
  631.     void FindOrInsert(double)  {}
  632. #endif
  633.  
  634. private:
  635.     enum
  636.     {
  637.         DEFAULT_HASH_SIZE = 4093,
  638.         MAX_HASH_SIZE = 32771
  639.     };
  640.  
  641.     IntLiteralValue **base;
  642.     int hash_size;
  643.  
  644.     static int primes[];
  645.     int prime_index;
  646.  
  647.     static int int32_limit;
  648.  
  649.     LiteralValue *bad_value;
  650.  
  651.     void Rehash();
  652. };
  653.  
  654.  
  655. class LongLiteralTable
  656. {
  657. public:
  658.     Tuple<LongLiteralValue *> symbol_pool;
  659.  
  660.     LongLiteralTable(LiteralValue *);
  661.     ~LongLiteralTable();
  662.  
  663.     LiteralValue *FindOrInsertLong(LiteralSymbol *);
  664.     LiteralValue *FindOrInsertHexLong(LiteralSymbol *);
  665.     LiteralValue *FindOrInsertOctalLong(LiteralSymbol *);
  666.     LiteralValue *FindOrInsertNegativeLong(LiteralSymbol *);
  667.  
  668.     LongLiteralValue *FindOrInsert(LongInt);
  669.  
  670. #ifdef JIKES_DEBUG
  671.     //
  672.     // To prevent arithmentic conversion to allow illegal calls inadvertently.
  673.     //
  674.     void FindOrInsert(int)    {}
  675.     void FindOrInsert(float)  {}
  676.     void FindOrInsert(double) {}
  677. #endif
  678.  
  679. private:
  680.  
  681.     enum
  682.     {
  683.         DEFAULT_HASH_SIZE = 1021,
  684.         MAX_HASH_SIZE = 8191
  685.     };
  686.  
  687.     LongLiteralValue **base;
  688.     int hash_size;
  689.  
  690.     static int primes[];
  691.     int prime_index;
  692.  
  693.     static LongInt int64_limit;
  694.  
  695.     LiteralValue *bad_value;
  696.  
  697.     inline static unsigned Hash(LongInt value) { return Hash::Function(value); }
  698.  
  699.     void Rehash();
  700. };
  701.  
  702.  
  703. class FloatLiteralTable
  704. {
  705. public:
  706.     Tuple<FloatLiteralValue *> symbol_pool;
  707.  
  708.     FloatLiteralTable(LiteralValue *);
  709.     ~FloatLiteralTable();
  710.  
  711.     LiteralValue *FindOrInsertFloat(LiteralSymbol *);
  712.  
  713.     FloatLiteralValue *FindOrInsert(IEEEfloat);
  714.  
  715. #ifdef JIKES_DEBUG
  716.     //
  717.     // To prevent arithmentic conversion to allow illegal calls inadvertently.
  718.     //
  719.     void FindOrInsert(int)     {}
  720.     void FindOrInsert(LongInt) {}
  721.     void FindOrInsert(double)  {}
  722. #endif
  723.  
  724. private:
  725.  
  726.     enum
  727.     {
  728.         DEFAULT_HASH_SIZE = 1021,
  729.         MAX_HASH_SIZE = 8191
  730.     };
  731.  
  732.     FloatLiteralValue **base;
  733.     int hash_size;
  734.  
  735.     static int primes[];
  736.     int prime_index;
  737.  
  738.     LiteralValue *bad_value;
  739.  
  740.     inline static unsigned Hash(IEEEfloat value) { return Hash::Function(value); }
  741.  
  742.     void Rehash();
  743. };
  744.  
  745.  
  746. class DoubleLiteralTable
  747. {
  748. public:
  749.     Tuple<DoubleLiteralValue *> symbol_pool;
  750.  
  751.     DoubleLiteralTable(LiteralValue *);
  752.     ~DoubleLiteralTable();
  753.  
  754.     LiteralValue *FindOrInsertDouble(LiteralSymbol *);
  755.  
  756.     DoubleLiteralValue *FindOrInsert(IEEEdouble);
  757.  
  758. #ifdef JIKES_DEBUG
  759.     //
  760.     // To prevent arithmentic conversion to allow illegal calls inadvertently.
  761.     //
  762.     void FindOrInsert(int)     {}
  763.     void FindOrInsert(LongInt) {}
  764.     void FindOrInsert(float)   {}
  765. #endif
  766.  
  767. private:
  768.  
  769.     enum
  770.     {
  771.         DEFAULT_HASH_SIZE = 1021,
  772.         MAX_HASH_SIZE = 8191
  773.     };
  774.  
  775.     DoubleLiteralValue **base;
  776.     int hash_size;
  777.  
  778.     static int primes[];
  779.     int prime_index;
  780.  
  781.     LiteralValue *bad_value;
  782.  
  783.     inline static unsigned Hash(IEEEdouble value) { return Hash::Function(value); }
  784.  
  785.     void Rehash();
  786. };
  787.  
  788.  
  789. class Utf8LiteralTable
  790. {
  791. public:
  792.     Tuple<Utf8LiteralValue *> symbol_pool;
  793.  
  794.     Utf8LiteralTable(LiteralValue *);
  795.     ~Utf8LiteralTable();
  796.  
  797.     LiteralValue *FindOrInsertString(LiteralSymbol *);
  798.  
  799.     Utf8LiteralValue *FindOrInsert(const char *, int);
  800.     Utf8LiteralValue *FindOrInsert(wchar_t);
  801.  
  802.     void CheckStringConstant(AstExpression *expr);
  803.  
  804. private:
  805.  
  806.     Tuple<Utf8LiteralValue *> *utf8_literals;
  807.     void EvaluateConstant(AstExpression *, int, int);
  808.     bool IsConstant(AstExpression *, Symbol *);
  809.  
  810.     enum
  811.     {
  812.         DEFAULT_HASH_SIZE = 4093,
  813.         MAX_HASH_SIZE = 32771
  814.     };
  815.  
  816.     Utf8LiteralValue **base;
  817.     int hash_size;
  818.  
  819.     static int primes[];
  820.     int prime_index;
  821.  
  822.     LiteralValue *bad_value;
  823.  
  824.     inline static unsigned Hash(const char *head, int len) { return Hash::Function(head, len); }
  825.  
  826.     void Rehash();
  827. };
  828.  
  829. #ifdef    HAVE_JIKES_NAMESPACE
  830. }            // Close namespace Jikes block
  831. #endif
  832.  
  833. #endif
  834.