Skip to content

Commit

Permalink
wip dyld
Browse files Browse the repository at this point in the history
  • Loading branch information
yamt committed Jul 16, 2023
1 parent 037b6a0 commit d2b7c58
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/dyld.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ static const struct name name_memory_base =
static const struct name name_stack_pointer =
NAME_FROM_CSTR_LITERAL("__stack_pointer");

static const globaltype globaltype_i32_mut = {
.type = TYPE_i32,
.mut = GLOBAL_VAR,
};

static bool
is_global_i32_mut_import(const struct module *m, const struct import *im)
{
if (im->desc.type != IMPORT_GLOBAL) {
return false;
}
const struct globaltype *gt = &im->desc.u.globaltype;
return gt->mut && gt->t == TYPE_i32;
return gt->mut == GLOBAL_VAR && gt->t == TYPE_i32;
}

static bool
Expand Down Expand Up @@ -83,7 +88,7 @@ is_global_export(const struct module *m, const struct export *ex)
return false;
}
const struct globaltype *gt = module_globaltype(m, ex->desc.idx);
return !gt->mut && gt->t == TYPE_i32;
return gt->mut == GLOBAL_CONST && gt->t == TYPE_i32;
}

void
Expand Down

0 comments on commit d2b7c58

Please sign in to comment.