diff options
| author | kr.angelov <kr.angelov@gmail.com> | 2013-09-25 07:53:10 +0000 |
|---|---|---|
| committer | kr.angelov <kr.angelov@gmail.com> | 2013-09-25 07:53:10 +0000 |
| commit | 4f05852b2298f47704342cfcb4b576933aa55ec7 (patch) | |
| tree | e258a306f65fa93dcc80ea5cd5f5a5c00ec2847e /src/runtime/c/pgf/jit.c | |
| parent | 82815c8262a52e10d0b3de0aeaf260e17b85a2e1 (diff) | |
added assertion in the JIT compiler which checks that we are not going outside of the compilation window
Diffstat (limited to 'src/runtime/c/pgf/jit.c')
| -rw-r--r-- | src/runtime/c/pgf/jit.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/runtime/c/pgf/jit.c b/src/runtime/c/pgf/jit.c index fe3f4dcc2..edb2ec97b 100644 --- a/src/runtime/c/pgf/jit.c +++ b/src/runtime/c/pgf/jit.c @@ -14,6 +14,7 @@ struct PgfJitState { GuPool* pool; jit_state jit; jit_insn *buf; + char *save_ip_ptr; GuBuf* patches; }; @@ -71,10 +72,10 @@ pgf_jit_init(GuPool* tmp_pool, GuPool* pool) PgfJitState* state = gu_new(PgfJitState, tmp_pool); state->tmp_pool = tmp_pool; state->pool = pool; - state->buf = NULL; state->patches = gu_new_buf(PgfCallPatch, tmp_pool); pgf_jit_alloc_page(state); + state->save_ip_ptr = jit_get_ip().ptr; return state; } @@ -82,11 +83,15 @@ pgf_jit_init(GuPool* tmp_pool, GuPool* pool) static void pgf_jit_make_space(PgfJitState* state) { + assert (state->save_ip_ptr + JIT_CODE_WINDOW > jit_get_ip().ptr); + size_t page_size = getpagesize(); if (jit_get_ip().ptr + JIT_CODE_WINDOW > ((char*) state->buf) + page_size) { jit_flush_code(state->buf, jit_get_ip().ptr); pgf_jit_alloc_page(state); } + + state->save_ip_ptr = jit_get_ip().ptr; } void |
