aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Pall <mike>2010-08-08 18:03:20 +0200
committerMike Pall <mike>2010-08-08 18:03:20 +0200
commit0d6f6f3fa002373e160e70d00417dacba108296d (patch)
treebddb4be9061f35a86785c667f721171b3746b9e1
parentbe19218a6cb2f8b8682d655e51a3069c20db5bfb (diff)
downloadluajit-0d6f6f3fa002373e160e70d00417dacba108296d.tar.gz
luajit-0d6f6f3fa002373e160e70d00417dacba108296d.tar.bz2
luajit-0d6f6f3fa002373e160e70d00417dacba108296d.zip
Clean up some more DynASM target dependencies.
-rw-r--r--dynasm/dasm_proto.h5
-rw-r--r--dynasm/dasm_x86.h7
-rw-r--r--src/buildvm.c6
3 files changed, 7 insertions, 11 deletions
diff --git a/dynasm/dasm_proto.h b/dynasm/dasm_proto.h
index 3e77f70b..114f0fb8 100644
--- a/dynasm/dasm_proto.h
+++ b/dynasm/dasm_proto.h
@@ -29,9 +29,6 @@
29/* Internal DynASM encoder state. */ 29/* Internal DynASM encoder state. */
30typedef struct dasm_State dasm_State; 30typedef struct dasm_State dasm_State;
31 31
32/* Action list type. */
33typedef const unsigned char *dasm_ActList;
34
35 32
36/* Initialize and free DynASM state. */ 33/* Initialize and free DynASM state. */
37DASM_FDEF void dasm_init(Dst_DECL, int maxsection); 34DASM_FDEF void dasm_init(Dst_DECL, int maxsection);
@@ -44,7 +41,7 @@ DASM_FDEF void dasm_setupglobal(Dst_DECL, void **gl, unsigned int maxgl);
44DASM_FDEF void dasm_growpc(Dst_DECL, unsigned int maxpc); 41DASM_FDEF void dasm_growpc(Dst_DECL, unsigned int maxpc);
45 42
46/* Setup encoder. */ 43/* Setup encoder. */
47DASM_FDEF void dasm_setup(Dst_DECL, dasm_ActList actionlist); 44DASM_FDEF void dasm_setup(Dst_DECL, const void *actionlist);
48 45
49/* Feed encoder with actions. Calls are generated by pre-processor. */ 46/* Feed encoder with actions. Calls are generated by pre-processor. */
50DASM_FDEF void dasm_put(Dst_DECL, int start, ...); 47DASM_FDEF void dasm_put(Dst_DECL, int start, ...);
diff --git a/dynasm/dasm_x86.h b/dynasm/dasm_x86.h
index a1f08896..517ee4f6 100644
--- a/dynasm/dasm_x86.h
+++ b/dynasm/dasm_x86.h
@@ -47,6 +47,9 @@ enum {
47#define DASM_POS2SEC(pos) ((pos)>>24) 47#define DASM_POS2SEC(pos) ((pos)>>24)
48#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos)) 48#define DASM_POS2PTR(D, pos) (D->sections[DASM_POS2SEC(pos)].rbuf + (pos))
49 49
50/* Action list type. */
51typedef const unsigned char *dasm_ActList;
52
50/* Per-section structure. */ 53/* Per-section structure. */
51typedef struct dasm_Section { 54typedef struct dasm_Section {
52 int *rbuf; /* Biased buffer pointer (negative section bias). */ 55 int *rbuf; /* Biased buffer pointer (negative section bias). */
@@ -132,11 +135,11 @@ void dasm_growpc(Dst_DECL, unsigned int maxpc)
132} 135}
133 136
134/* Setup encoder. */ 137/* Setup encoder. */
135void dasm_setup(Dst_DECL, dasm_ActList actionlist) 138void dasm_setup(Dst_DECL, const void *actionlist)
136{ 139{
137 dasm_State *D = Dst_REF; 140 dasm_State *D = Dst_REF;
138 int i; 141 int i;
139 D->actionlist = actionlist; 142 D->actionlist = (dasm_ActList)actionlist;
140 D->status = DASM_S_OK; 143 D->status = DASM_S_OK;
141 D->section = &D->sections[0]; 144 D->section = &D->sections[0];
142 memset((void *)D->lglabels, 0, D->lgsize); 145 memset((void *)D->lglabels, 0, D->lgsize);
diff --git a/src/buildvm.c b/src/buildvm.c
index 8cceeb23..817d4bc4 100644
--- a/src/buildvm.c
+++ b/src/buildvm.c
@@ -189,7 +189,7 @@ static int build_code(BuildCtx *ctx)
189 ctx->npc = build_backend(ctx); 189 ctx->npc = build_backend(ctx);
190 190
191 /* Finalize the code. */ 191 /* Finalize the code. */
192 (void)dasm_checkstep(Dst, DASM_SECTION_CODE); 192 (void)dasm_checkstep(Dst, -1);
193 if ((status = dasm_link(Dst, &ctx->codesz))) return status; 193 if ((status = dasm_link(Dst, &ctx->codesz))) return status;
194 ctx->code = (uint8_t *)malloc(ctx->codesz); 194 ctx->code = (uint8_t *)malloc(ctx->codesz);
195 if ((status = dasm_encode(Dst, (void *)ctx->code))) return status; 195 if ((status = dasm_encode(Dst, (void *)ctx->code))) return status;
@@ -431,9 +431,7 @@ int main(int argc, char **argv)
431 } 431 }
432 432
433 switch (ctx->mode) { 433 switch (ctx->mode) {
434#if LJ_TARGET_X86ORX64
435 case BUILD_peobj: 434 case BUILD_peobj:
436#endif
437 case BUILD_raw: 435 case BUILD_raw:
438 binmode = 1; 436 binmode = 1;
439 break; 437 break;
@@ -461,11 +459,9 @@ int main(int argc, char **argv)
461 emit_asm(ctx); 459 emit_asm(ctx);
462 emit_asm_debug(ctx); 460 emit_asm_debug(ctx);
463 break; 461 break;
464#if LJ_TARGET_X86ORX64
465 case BUILD_peobj: 462 case BUILD_peobj:
466 emit_peobj(ctx); 463 emit_peobj(ctx);
467 break; 464 break;
468#endif
469 case BUILD_raw: 465 case BUILD_raw:
470 emit_raw(ctx); 466 emit_raw(ctx);
471 break; 467 break;