From 5d49c02bee62736987a4837124bbbc7aa26fb730 Mon Sep 17 00:00:00 2001 From: Diego Pino Garcia Date: Fri, 9 Jun 2017 18:16:15 +0200 Subject: [PATCH 1/2] Make dynasm-driver a header and jit2 and jit3 main programs --- Makefile | 21 ++++++++++++--------- dynasm-driver.c => dynasm-driver.h | 2 -- jit2.dasc | 2 ++ jit3.dasc | 2 ++ 4 files changed, 16 insertions(+), 11 deletions(-) rename dynasm-driver.c => dynasm-driver.h (99%) diff --git a/Makefile b/Makefile index c9a4b08..b5b77b7 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,19 @@ -CFLAGS=-O3 -g -std=gnu99 -Ithird_party +CFLAGS=-O3 -g -std=gnu99 -Ithird_party -D DASM_VERSION=10300 all: jit1 jit2 jit3 jit1: jit1.c -jit2: dynasm-driver.c jit2.h - $(CC) $(CFLAGS) $(CPPFLAGS) -o jit2 dynasm-driver.c -DJIT=\"jit2.h\" -jit2.h: jit2.dasc - lua dynasm/dynasm.lua jit2.dasc > jit2.h +jit2: dynasm-driver.h jit2.c + $(CC) $(CFLAGS) $(CPPFLAGS) dynasm-driver.h jit2.c -o jit2 +jit2.c: jit2.dasc + lua third_party/dynasm/dynasm.lua jit2.dasc > jit2.c -jit3: dynasm-driver.c jit3.h - $(CC) $(CFLAGS) $(CPPFLAGS) -o jit3 dynasm-driver.c -DJIT=\"jit3.h\" -jit3.h: jit3.dasc - lua dynasm/dynasm.lua jit3.dasc > jit3.h +jit3: dynasm-driver.h jit3.c + $(CC) $(CFLAGS) $(CPPFLAGS) dynasm-driver.h jit3.c -o jit3 +jit3.c: jit3.dasc + lua third_party/dynasm/dynasm.lua jit3.dasc > jit3.c + +clean: + rm -f jit1 jit2 jit3 diff --git a/dynasm-driver.c b/dynasm-driver.h similarity index 99% rename from dynasm-driver.c rename to dynasm-driver.h index 48a3031..7477c92 100644 --- a/dynasm-driver.c +++ b/dynasm-driver.h @@ -11,8 +11,6 @@ void initjit(dasm_State **state, const void *actionlist); void *jitcode(dasm_State **state); void free_jitcode(void *code); -#include JIT - void initjit(dasm_State **state, const void *actionlist) { dasm_init(state, 1); dasm_setup(state, actionlist); diff --git a/jit2.dasc b/jit2.dasc index 8b1b39e..d013c61 100644 --- a/jit2.dasc +++ b/jit2.dasc @@ -1,6 +1,8 @@ // Most basic DynASM JIT; generates a trivial function that // returns a given value, and executes it. +#include "dynasm-driver.h" + // DynASM directives. |.arch x64 |.actionlist actions diff --git a/jit3.dasc b/jit3.dasc index 27f0a61..046b113 100644 --- a/jit3.dasc +++ b/jit3.dasc @@ -2,6 +2,8 @@ #include +#include "dynasm-driver.h" + |.arch x64 |.actionlist actions | From b77aae522f9a04afc5c259ed344497648c9b916a Mon Sep 17 00:00:00 2001 From: Diego Pino Garcia Date: Fri, 9 Jun 2017 18:28:08 +0200 Subject: [PATCH 2/2] Add gitignore --- .gitignore | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..665041b --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +jit1 +jit2 +jit3 +*.c +*.h +*.gch