00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef DELTA_COMPILER
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class ScopeDesc;
00036 class PcDesc;
00037 class relocInfo;
00038
00039 class ZombieLink;
00040
00041 class zone: public CHeapObj {
00042 public:
00043 Heap* methodHeap;
00044 Heap* picHeap;
00045 codeTable* methodTable;
00046 jumpTable _jump_table;
00047
00048 public:
00049
00050 nmethod* lookup(LookupKey* key) { return methodTable->lookup(key); }
00051
00052 protected:
00053 nmethod* LRUhand;
00054
00055 bool _needsCompaction;
00056 bool _needsLRUSweep;
00057 bool _needsSweep;
00058
00059 int compactTime;
00060 int compactDuration;
00061
00062 double minFreeFrac;
00063
00064 public:
00065 zone(int& size);
00066
00067 void* operator new(size_t size) { return AllocateHeap(size, "nmethod zone header"); }
00068
00069 void clear();
00070
00071 int capacity() const { return methodHeap->capacity(); }
00072
00073 jumpTable* jump_table() const { return (jumpTable*)&_jump_table; }
00074
00075 void verify_if_often();
00076
00077 int used();
00078 int numberOfNMethods() const { return jump_table()->usedIDs; }
00079
00080 nmethod* allocate(int size);
00081
00082 void free(nmethod* m);
00083 void addToCodeTable(nmethod* nm);
00084
00085 void compact(bool forced = false);
00086 bool needsCompaction() const { return _needsCompaction; }
00087 bool needsWork() const { return needsCompaction() || _needsSweep; }
00088 bool needsSweep() const { return _needsSweep; }
00089 void doWork();
00090 void doSweep();
00091 void flush();
00092 void flushZombies();
00093 void flushUnused();
00094
00095
00096 void clear_inline_caches();
00097
00098 void cleanup_inline_caches();
00099
00100 int findReplCandidates(int needed);
00101
00102 bool isDeltaPC(void* p) const;
00103 bool contains(void *p) const { return methodHeap->contains(p); }
00104
00105 nmethod* findNMethod(void* start) const;
00106 nmethod* findNMethod_maybe(void* start) const;
00107
00108 void nmethods_do(void f(nmethod* nm));
00109 void PICs_do(void f(PIC* pic));
00110
00111
00112 void oops_do(void f(oop*));
00113
00114 void switch_pointers(oop from, oop to);
00115 void verify();
00116
00117 void print();
00118
00119 void print_nmethod_histogram(int size);
00120
00121 nmethod* first_nm() const { return (nmethod*)(methodHeap->firstUsed()); }
00122 nmethod* next_nm(nmethod* p) const { return (nmethod*)(methodHeap->nextUsed(p)); }
00123
00124 PIC* first_pic() const { return (PIC*)(picHeap->firstUsed()); }
00125 PIC* next_pic(PIC* p) const { return (PIC*)(picHeap->nextUsed(p)); }
00126
00127 char* instsStart();
00128 int instsSize();
00129 int LRU_time();
00130 int sweeper(int maxVisit, int maxReclaim,
00131 int* nvisited = NULL, int* nbytesReclaimed = NULL);
00132 int nextNMethodID();
00133
00134 public:
00135 void mark_dependents_for_deoptimization();
00136 void mark_all_for_deoptimization();
00137 void unmark_all_for_deoptimization();
00138 void make_marked_nmethods_zombies();
00139
00140 protected:
00141 void print_helper(bool stats);
00142 void adjustPolicy();
00143 int flushNextMethod(int needed);
00144 inline nmethod* next_circular_nm(nmethod* nm);
00145
00146 friend void moveInsts(char* from, char* to, int size);
00147 friend void printAllNMethods();
00148 friend void sweepTrigger();
00149 };
00150
00151
00152
00153 class LRUcount : ValueObj {
00154 public:
00155 uint16 unused;
00156 uint16 lastUsed;
00157
00158 LRUcount() { ShouldNotCallThis(); }
00159 void set(int i) { *(int*)this = i; }
00160 };
00161
00162 extern LRUcount* LRUtable;
00163 extern int* LRUflag;
00164 #endif