diff options
author | Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> | 2020-12-18 15:52:13 -0500 |
---|---|---|
committer | Alan Wu <XrXr@users.noreply.github.com> | 2021-10-20 18:19:26 -0400 |
commit | 542f2ba09e1904fb7f43af34bc1527073daae964 (patch) | |
tree | d7d7345d317e9cca7b0f53a03e6ce900d7399332 /ujit_core.c | |
parent | df16bf97ece9c3f943750954c19d1caace089215 (diff) |
Use a versioning context when compiling blocks
Diffstat (limited to 'ujit_core.c')
-rw-r--r-- | ujit_core.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/ujit_core.c b/ujit_core.c index 0bffec7ebf..af0b8c86a5 100644 --- a/ujit_core.c +++ b/ujit_core.c @@ -133,8 +133,9 @@ uint8_t* branch_stub_hit(uint32_t branch_idx, uint32_t target_idx) { //fprintf(stderr, "compiling block\n"); + ctx_t ctx = branch->ctx; uint32_t num_instrs = 0; - block_ptr = ujit_compile_block(target.iseq, target.idx, &num_instrs); + block_ptr = ujit_compile_block(target.iseq, target.idx, &ctx, &num_instrs); st_insert(version_tbl, (st_data_t)&target, (st_data_t)block_ptr); branch->dst_addrs[target_idx] = block_ptr; } @@ -192,7 +193,7 @@ uint8_t* get_branch_target(codeblock_t* ocb, blockid_t target, uint32_t branch_i return stub_addr; } -void gen_branch(codeblock_t* cb, codeblock_t* ocb, blockid_t target0, blockid_t target1, branchgen_fn gen_fn) +void gen_branch(ctx_t* ctx, blockid_t target0, blockid_t target1, branchgen_fn gen_fn) { // Get branch targets or stubs (code pointers) uint8_t* dst_addr0 = get_branch_target(ocb, target0, num_branches, 0); @@ -207,6 +208,7 @@ void gen_branch(codeblock_t* cb, codeblock_t* ocb, blockid_t target0, blockid_t // Register this branch entry branch_t branch_entry = { + *ctx, start_pos, end_pos, { target0, target1 }, |