st : SomeType;
}
-foo_sum :: proc (use foo: ^Foo) -> i32 {
+foo_sum :: proc (use this: ^Foo) -> i32 {
+ this.foo_other();
return x + y;
}
+foo_other :: proc (use this: ^Foo) {
+ print(st as i32);
+}
+
asdf :: proc (pa: PrintableArray) {
for i: 0, pa.len print(pa.data[i] as i32);
}
print(st as i32);
}
-single_int : u8
+single_int : u32
-array : [N] Foo
N :: 1024
+array : [N] Foo
proc #export "main" {
print("Hello World! this is slightly longer\n");
print(__heap_start as i32);
- single_int = 10 as u8;
- print(single_int as i32);
+ single_int = 10;
+ print(single_int);
array[4].y = 1234;
print(array[4].y);
return v.x * u.x + v.y * u.y;
}
-asdf :: proc (use v: ^Vec2, use u: ^Vec2) -> f32 {
- return x + x;
-}
-
// SomeType :: enum (u32) { Value1, Value2 }
offset += alignment - (offset % alignment);
}
- ptr data = bh_alloc_array(global_heap_allocator, i8, size);
- memset(data, 0, size);
-
- WasmDatum datum = {
- .offset = offset,
- .length = size,
- .data = data
- };
+ // WasmDatum datum = {
+ // .offset = offset,
+ // .length = size,
+ // .data = NULL
+ // };
memres->addr = offset;
mod->next_datum_offset = offset + size;
- bh_arr_push(mod->data, datum);
+ // bh_arr_push(mod->data, datum);
}
OnyxWasmModule onyx_wasm_module_create(bh_allocator alloc) {
bh_buffer_append(&vec_buff, leb, leb_len);
bh_arr_each(WasmDatum, datum, module->data) {
+ if (datum->data == NULL) continue;
+
// NOTE: 0x00 memory index
bh_buffer_write_byte(&vec_buff, 0x00);