diff options
author | Alice Frosi <afrosi@redhat.com> | 2023-06-02 14:25:30 +0200 |
---|---|---|
committer | Alice Frosi <afrosi@redhat.com> | 2023-06-02 14:26:21 +0200 |
commit | fb2a89cbfc5049d360bb734b4896946e9963e39a (patch) | |
tree | 58e9c939ce7a1819bdfb803837b899b46da31e2e /cooker/emit.c | |
parent | 80309fbd77cbafa3784fa7295afb56c446d59b93 (diff) | |
download | seitan-fb2a89cbfc5049d360bb734b4896946e9963e39a.tar seitan-fb2a89cbfc5049d360bb734b4896946e9963e39a.tar.gz seitan-fb2a89cbfc5049d360bb734b4896946e9963e39a.tar.bz2 seitan-fb2a89cbfc5049d360bb734b4896946e9963e39a.tar.lz seitan-fb2a89cbfc5049d360bb734b4896946e9963e39a.tar.xz seitan-fb2a89cbfc5049d360bb734b4896946e9963e39a.tar.zst seitan-fb2a89cbfc5049d360bb734b4896946e9963e39a.zip |
cooker, seitan: fix some bugs for op call
cooker:
- added missing OP_CALL type
- local copy of the offset for the type STRUCT
- fix return offset
- added type LONG in emit_data
seitan:
- check context if NULL
- fix ptr dereference
- added a couple of debug print
- added error message in seitan for eval
Diffstat (limited to 'cooker/emit.c')
-rw-r--r-- | cooker/emit.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/cooker/emit.c b/cooker/emit.c index 705df4b..05e3f81 100644 --- a/cooker/emit.c +++ b/cooker/emit.c @@ -73,6 +73,7 @@ void emit_call(struct gluten_ctx *g, struct ns_spec *ns, long nr, unsigned ns_count, i; struct ns_spec *ctx; + op->type = OP_CALL; for (ns_count = 0; ns[ns_count].spec != NS_SPEC_NONE; ns_count++); if (ns_count) { @@ -92,14 +93,16 @@ void emit_call(struct gluten_ctx *g, struct ns_spec *ns, long nr, desc->arg_deref |= BIT(i) * is_ptr[i]; desc->context = o1; memcpy(desc->args, offset, sizeof(struct gluten_offset) * count); - desc->args[count + 1] = ret_offset; + desc->args[count] = ret_offset; debug(" %i: OP_CALL: %i, arguments:", g->ip.offset, nr); for (i = 0; i < count; i++) { debug("\t%i: %s %s%i", i, gluten_offset_name[offset[i].type], is_ptr[i] ? "*" : "", offset[i].offset); } - + if (desc->has_ret) + debug("\treturn: %s %i", gluten_offset_name[ret_offset.type], + offset[i].offset); call->desc = o2; if (++g->ip.offset > INST_MAX) @@ -298,6 +301,7 @@ static struct gluten_offset emit_data_do(struct gluten_ctx *g, } break; + case LONG: case U64: if (add) { *(uint64_t *)p |= value->v_num; |