00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifdef DELTA_COMPILER
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035 class Recompilation;
00036 extern Recompilation* theRecompilation;
00037 extern nmethod* recompilee;
00038
00039 class Recompilation : public VM_Operation {
00040 private:
00041 oop _rcvr;
00042 methodOop _method;
00043 nmethod* _nm;
00044 nmethod* _newNM;
00045 deltaVFrame* _triggerVF;
00046 bool _isUncommon;
00047 bool _recompiledTrigger;
00048
00049 public:
00050 Recompilation(oop rcvr, methodOop method) {
00051 _method = method; _rcvr = rcvr; _nm = NULL; _isUncommon = false; init();
00052 }
00053 Recompilation(oop rcvr, nmethod* nm, bool unc = false) {
00054 _method = nm->method(); _rcvr = rcvr; _nm = nm; _isUncommon = unc; init();
00055 }
00056 ~Recompilation() { theRecompilation = NULL; }
00057 void doit();
00058 bool isCompiled() const { return _nm != NULL; }
00059 bool recompiledTrigger() const { return _recompiledTrigger; }
00060 char* result() const { return _newNM ? _newNM->verifiedEntryPoint() : NULL; }
00061 oop receiverOf(deltaVFrame* vf) const;
00062 char* name() { return "recompile"; }
00063
00064
00065 static char* methodOop_invocation_counter_overflow(oop rcvr, methodOop method);
00066 static char* nmethod_invocation_counter_overflow (oop rcvr, char* pc );
00067
00068 protected:
00069 void init();
00070 void recompile(Recompilee* r);
00071 void recompile_method(Recompilee* r);
00072 void recompile_block(Recompilee* r);
00073 bool handleStaleInlineCache(RFrame* first);
00074 };
00075
00076
00077
00078
00079
00080 class Recompilee : public ResourceObj {
00081 protected:
00082 RFrame* _rf;
00083 Recompilee(RFrame* rf) { _rf = rf; }
00084 public:
00085 virtual bool is_interpreted() const { return false; }
00086 virtual bool is_compiled() const { return false; }
00087 virtual LookupKey* key() const = 0;
00088 virtual methodOop method() const = 0;
00089 virtual nmethod* code() const { ShouldNotCallThis(); return NULL; }
00090 RFrame* rframe() const { return _rf; }
00091 static Recompilee* new_Recompilee(RFrame* rf);
00092 };
00093
00094 class InterpretedRecompilee : public Recompilee {
00095 LookupKey* _key;
00096 methodOop _method;
00097 public:
00098 InterpretedRecompilee(RFrame* rf, LookupKey* k, methodOop m) : Recompilee(rf) { _key = k; _method = m; }
00099 bool is_interpreted() const { return true; }
00100 LookupKey* key() const { return _key; }
00101 methodOop method() const { return _method; }
00102 };
00103
00104 class CompiledRecompilee : public Recompilee {
00105 nmethod* _nm;
00106 public:
00107 CompiledRecompilee(RFrame* rf, nmethod* nm) : Recompilee(rf) { _nm = nm; }
00108 bool is_compiled() const { return true; }
00109 LookupKey* key() const;
00110 methodOop method() const;
00111 nmethod* code() const { return _nm; }
00112 };
00113
00114
00115 #ifdef junk
00116 extern int nstages;
00117 extern smi* compileCounts;
00118 extern int* recompileLimits;
00119 #endif
00120 const int MaxRecompilationLevels = 4;
00121 const int MaxVersions = 4 - 1;
00122
00123
00124 #endif