aboutsummaryrefslogtreecommitdiff
path: root/environment.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-26 14:02:48 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-03-26 14:02:48 -0400
commit135e23094c42b33acdd05dd522bbe0fd691b9eee (patch)
tree68a675393083286a79d3f66e6f57aa4ac1ebd212 /environment.c
parent59b62035c1304b4c6c39b6d546b9c5187e8d0738 (diff)
Improve codegen for table/array iteration by inlining the iteration
macros
Diffstat (limited to 'environment.c')
-rw-r--r--environment.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/environment.c b/environment.c
index 806bc019..b96d51eb 100644
--- a/environment.c
+++ b/environment.c
@@ -176,12 +176,13 @@ env_t *new_compilation_unit(void)
binding_t *type_binding = Table_str_get(*env->globals, global_types[i].name);
assert(type_binding);
env_t *ns_env = Match(type_binding->type, TypeInfoType)->env;
- $ARRAY_FOREACH(global_types[i].namespace, j, ns_entry_t, entry, {
- type_t *type = parse_type_string(ns_env, entry.type_str);
+ for (int64_t j = 0; j < global_types[i].namespace.length; j++) {
+ ns_entry_t *entry = global_types[i].namespace.data + j*global_types[i].namespace.stride;
+ type_t *type = parse_type_string(ns_env, entry->type_str);
if (type->tag == ClosureType) type = Match(type, ClosureType)->fn;
- binding_t *b = new(binding_t, .code=entry.code, .type=type);
- set_binding(ns_env, entry.name, b);
- }, {})
+ binding_t *b = new(binding_t, .code=entry->code, .type=type);
+ set_binding(ns_env, entry->name, b);
+ }
}
return env;