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 extern int nofCompilations;
00027 extern Compiler* theCompiler;
00028
00029 class CodeGenerator;
00030 class NLRTestNode;
00031
00032 class Compiler : public PrintableResourceObj {
00033
00034 private:
00035 GrowableArray<InlinedScope*> _scopeStack;
00036 int _totalNofBytes;
00037 int _special_handler_call_offset;
00038 int _entry_point_offset;
00039 int _verified_entry_point_offset;
00040 int _totalNofFloatTemporaries;
00041 int _float_section_size;
00042 int _float_section_start_offset;
00043 CodeBuffer* _code;
00044
00045 int _nextLevel;
00046 bool _noInlinableSends;
00047 bool _uses_inlining_database;
00048
00049 public:
00050 LookupKey* key;
00051 CompiledIC* ic;
00052 nmethod* parentNMethod;
00053 methodOop method;
00054 NonInlinedBlockScopeDesc* blockScope;
00055
00056 RScope* recompileeRScope;
00057 int countID;
00058
00059 jumpTableID main_jumpTable_id;
00060 jumpTableID promoted_jumpTable_id;
00061
00062 bool useUncommonTraps;
00063
00064 ScopeDescRecorder* rec;
00065 InlinedScope* topScope;
00066 BB* firstBB;
00067 GrowableArray<NLRTestNode*>* nlrTestPoints;
00068 GrowableArray<InlinedScope*>* scopes;
00069 GrowableArray<InlinedScope*>* contextList;
00070 GrowableArray<BlockPReg*>* blockClosures;
00071 Node* firstNode;
00072 PerformanceDebugger* reporter;
00073
00074 #ifdef DEBUG
00075 stringStream* messages;
00076 #endif
00077
00078 #ifdef LATER
00079 int inlineLimit[LastLimit];
00080 #endif
00081
00082
00083 private:
00084 void initialize(RScope* remote_scope = NULL);
00085 void initTopScope();
00086 void initLimits();
00087 void buildBBs();
00088 void fixupNLRTestPoints();
00089 void computeBlockInfo();
00090
00091 public:
00092 Compiler(LookupKey* k, methodOop m, CompiledIC* ic = NULL);
00093 Compiler(blockClosureOop blk, NonInlinedBlockScopeDesc* scope);
00094 Compiler(RScope* scope);
00095 ~Compiler() { finalize(); }
00096
00097 CodeBuffer* code() const;
00098 ScopeDescRecorder* scopeDescRecorder();
00099 nmethod* compile();
00100 void finalize();
00101
00102 int level() const;
00103 int version() const;
00104 int special_handler_call_offset() const { return _special_handler_call_offset ; }
00105 int entry_point_offset() const { return _entry_point_offset; }
00106 int verified_entry_point_offset() const { return _verified_entry_point_offset; }
00107 int get_invocation_counter_limit() const;
00108
00109 void set_special_handler_call_offset(int offset);
00110 void set_entry_point_offset(int offset);
00111 void set_verified_entry_point_offset(int offset);
00112
00113 int totalNofFloatTemporaries() const { assert(_totalNofFloatTemporaries >= 0, "not yet determined"); return _totalNofFloatTemporaries; }
00114 bool has_float_temporaries() const { return totalNofFloatTemporaries() > 0; }
00115 int float_section_size() const { return has_float_temporaries() ? _float_section_size : 0; }
00116 int float_section_start_offset() const { return has_float_temporaries() ? _float_section_start_offset : 0; }
00117
00118 void set_float_section_size(int size);
00119 void set_float_section_start_offset(int offset);
00120
00121 bool is_block_compile() const { return parentNMethod != NULL; }
00122 bool is_method_compile() const { return !is_block_compile(); }
00123 bool is_uncommon_compile() const;
00124 bool is_database_compile() const { return _uses_inlining_database; }
00125
00126 int number_of_noninlined_blocks() const;
00127 void copy_noninlined_block_info(nmethod* nm);
00128 void nofBytesCompiled(int n) { _totalNofBytes += n; }
00129 int totalNofBytes() const { return _totalNofBytes; }
00130
00131 int estimatedSize() const;
00132 InlinedScope* currentScope() const;
00133 void enterScope(InlinedScope* s);
00134 void exitScope (InlinedScope* s);
00135
00136 void allocateArgs(int nargs, bool isPrimCall);
00137 bool registerUninlinable(Inliner* inliner);
00138
00139 void print();
00140 void print_short();
00141 void print_key(outputStream* s);
00142 void print_code(bool suppressTrivial);
00143 };
00144
00145 #ifdef DEBUG
00146
00147
00148
00149 outputStream* cout(bool flag);
00150 void print_cout();
00151 #else
00152 #define cout(flag) if (flag) std
00153 #endif
00154
00155 #endif