X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=src%2Fvm%2Fjit%2Fcodegen-common.h;h=cf1ad7d771a3f807472fb32185c86a5223dc175d;hb=b0dfcc457440aa84e2f1ccee8bcefad72615a344;hp=11612d10b242aee4682cc5d965612f189c38bc07;hpb=6fd72f4d63f219c79b2132dde9ec0aa5e6c1494b;p=cacao.git diff --git a/src/vm/jit/codegen-common.h b/src/vm/jit/codegen-common.h index 11612d10b..cf1ad7d77 100644 --- a/src/vm/jit/codegen-common.h +++ b/src/vm/jit/codegen-common.h @@ -22,8 +22,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - $Id: codegen-common.h 7596 2007-03-28 21:05:53Z twisti $ - */ @@ -32,20 +30,20 @@ /* forward typedefs ***********************************************************/ -typedef struct codegen_critical_section_t codegen_critical_section_t; -typedef struct codegendata codegendata; -typedef struct branchref branchref; -typedef struct branch_label_ref_t branch_label_ref_t; -typedef struct jumpref jumpref; -typedef struct dataref dataref; -typedef struct exceptionref exceptionref; -typedef struct patchref patchref; -typedef struct linenumberref linenumberref; +typedef struct codegendata codegendata; +typedef struct branchref branchref; +typedef struct branch_label_ref_t branch_label_ref_t; +typedef struct critical_section_ref_t critical_section_ref_t; +typedef struct jumpref jumpref; +typedef struct dataref dataref; +typedef struct exceptionref exceptionref; +typedef struct linenumberref linenumberref; #include "config.h" #include "vm/types.h" +#include "vm/builtin.h" #include "vm/global.h" #include "vm/jit/dseg.h" @@ -101,17 +99,6 @@ typedef struct linenumberref linenumberref; #define BRANCH_OPT_NONE 0 - -/************************* critical sections *********************************/ - -struct codegen_critical_section_t { - codegen_critical_section_t *next; - s4 mcodebegin; - s4 mcodeend; - s4 mcoderestart; -}; - - /* codegendata ****************************************************************/ struct codegendata { @@ -145,24 +132,12 @@ struct codegendata { dataref *datareferences; /* list of data segment references */ #endif -/* list *patchrefs; */ - patchref *patchrefs; - list *brancheslabel; - - linenumberref *linenumberreferences; /* list of line numbers and the */ - /* program counters of their first */ - /* instruction */ - s4 linenumbertablesizepos; - s4 linenumbertablestartpos; - s4 linenumbertab; + list_t *brancheslabel; + list_t *listcritical; /* list of critical sections */ + list_t *linenumbers; /* list of line numbers */ methodinfo *method; - codegen_critical_section_t *threadcrit; /* List of critical code regions */ - codegen_critical_section_t threadcritcurrent; - s4 threadcritcount; /* Number of critical regions */ - - s4 maxstack; s4 stackframesize; /* stackframe size of this method */ #if defined(ENABLE_REPLACEMENT) @@ -201,7 +176,17 @@ struct branch_label_ref_t { s4 condition; /* conditional branch condition */ s4 reg; /* register number to check */ u4 options; /* branch options */ - listnode linkage; + listnode_t linkage; +}; + + +/* critical_section_ref_t *****************************************************/ + +struct critical_section_ref_t { + s4 start; /* relative offset to method entry-point */ + s4 end; + s4 restart; + listnode_t linkage; }; @@ -222,18 +207,6 @@ struct dataref { }; -/* patchref *******************************************************************/ - -struct patchref { - s4 branchpos; /* relative offset to method entrypoint */ - s4 disp; /* displacement of ref in the data segment */ - functionptr patcher; /* patcher function to call */ - voidptr ref; /* reference passed */ -/* listnode linkage; */ - patchref *next; -}; - - /* linenumberref **************************************************************/ struct linenumberref { @@ -252,16 +225,6 @@ struct linenumberref { }; -/* methodtree_element *********************************************************/ - -typedef struct methodtree_element methodtree_element; - -struct methodtree_element { - u1 *startpc; - u1 *endpc; -}; - - /* function prototypes ********************************************************/ void codegen_init(void); @@ -287,16 +250,6 @@ void codegen_resolve_branchrefs(codegendata *cd, basicblock *bptr); void codegen_branch_label_add(codegendata *cd, s4 label, s4 condition, s4 reg, u4 options); - -void codegen_add_patch_ref(codegendata *cd, functionptr patcher, voidptr ref, - s4 disp); -/* XXX REMOVE ME: don't-break-trunk macro */ -#define codegen_addpatchref codegen_add_patch_ref - -void codegen_insertmethod(u1 *startpc, u1 *endpc); -u1 *codegen_get_pv_from_pc(u1 *pc); -u1 *codegen_get_pv_from_pc_nocheck(u1 *pc); - #if defined(ENABLE_REPLACEMENT) #if !defined(NDEBUG) void codegen_set_replacement_point_notrap(codegendata *cd, s4 type); @@ -309,16 +262,20 @@ void codegen_set_replacement_point(codegendata *cd); void codegen_finish(jitdata *jd); -codeinfo *codegen_createnativestub(functionptr f, methodinfo *m); #if defined(ENABLE_DISASSEMBLER) -void codegen_disassemble_nativestub(methodinfo *m, u1 *start, u1 *end); +void codegen_disassemble_stub(methodinfo *m, u1 *start, u1 *end); #endif -void codegen_start_native_call(u1 *datasp, u1 *pv, u1 *sp, u1 *ra); -java_objectheader *codegen_finish_native_call(u1 *datasp); +/* stub functions */ + +u1 *codegen_generate_stub_compiler(methodinfo *m); +void codegen_generate_stub_builtin(methodinfo *m, builtintable_entry *bte); +codeinfo *codegen_generate_stub_native(methodinfo *m, functionptr f); -u1 *createcompilerstub(methodinfo *m); -u1 *createnativestub(functionptr f, jitdata *jd, methoddesc *nmd); +#if !defined(JIT_COMPILER_VIA_SIGNAL) +void codegen_emit_stub_compiler(jitdata *jd); +#endif +void codegen_emit_stub_native(jitdata *jd, methoddesc *nmd, functionptr f, int skipparams); #if defined(ENABLE_INTRP) u1 *intrp_createcompilerstub(methodinfo *m); @@ -328,17 +285,29 @@ u1 *intrp_createnativestub(functionptr f, jitdata *jd, methoddesc *md); void removecompilerstub(u1 *stub); void removenativestub(u1 *stub); +java_handle_t *codegen_start_native_call(u1 *currentsp, u1 *pv); +java_object_t *codegen_finish_native_call(u1 *currentsp, u1 *pv); + s4 codegen_reg_of_var(u2 opcode, varinfo *v, s4 tempregnum); s4 codegen_reg_of_dst(jitdata *jd, instruction *iptr, s4 tempregnum); #if defined(ENABLE_THREADS) -void codegen_threadcritrestart(codegendata *cd, int offset); -void codegen_threadcritstart(codegendata *cd, int offset); -void codegen_threadcritstop(codegendata *cd, int offset); +void codegen_critical_section_new(codegendata *cd); +void codegen_critical_section_start(codegendata *cd); +void codegen_critical_section_end(codegendata *cd); + +# define CODEGEN_CRITICAL_SECTION_NEW codegen_critical_section_new(cd) +# define CODEGEN_CRITICAL_SECTION_START codegen_critical_section_start(cd) +# define CODEGEN_CRITICAL_SECTION_END codegen_critical_section_end(cd) +#else +# define CODEGEN_CRITICAL_SECTION_NEW /* no-op */ +# define CODEGEN_CRITICAL_SECTION_START /* no-op */ +# define CODEGEN_CRITICAL_SECTION_END /* no-op */ #endif -/* machine dependent functions */ -u1 *md_codegen_get_pv_from_pc(u1 *ra); +#if defined(ENABLE_SSA) +void codegen_emit_phi_moves(jitdata *jd, basicblock *bptr); +#endif #endif /* _CODEGEN_COMMON_H */