Commit graph

39 commits

Author SHA1 Message Date
luccie
120da3e3cd [MAIN]: Rewrote init_mods to load tar archives and run main.wasm 2025-08-11 18:36:00 +02:00
luccie
7836ebfcd3 [MODS]: Make sure only runtime and parser need to be defer freed 2025-08-10 23:28:57 +02:00
luccie
e0fe639f0e [MODS/VM]: Remove debugging message 2025-08-10 22:53:01 +02:00
luccie
d8642bfe0a [MODS/IR]: Fix a bug in fix_branches_for_block 2025-08-10 22:52:04 +02:00
luccie
b39fb34942 Added support for parsing tables 2025-08-10 22:10:23 +02:00
Lorenzo Torres
162800ac83 fixed formatting in mods/ir.zig 2025-08-07 04:08:45 +02:00
luccie-cmd
473c4aeffb [MODS/VM]: Actually respect the difference between signed and unsigned 2025-08-06 18:55:34 +02:00
luccie-cmd
8282a299b1 Rename preinit to init and add more instructions 2025-08-06 18:51:48 +02:00
luccie-cmd
98cbb47031 [MODS/WASM] Add some more instructions 2025-08-06 11:40:32 +02:00
luccie-cmd
a295365993 [MODS/WASM]: Get tables, elems, data and more VM instructions working 2025-08-05 22:59:41 +02:00
luccie-cmd
83d91cfffe Fixed the functions 2025-08-04 20:48:35 +02:00
luccie-cmd
6f942fe9c2 Add full support for globals 2025-08-04 19:33:05 +02:00
luccie-cmd
94195fc774 Added support for global variables 2025-08-04 19:21:12 +02:00
luccie-cmd
e0d44a5f84 Added support for importing functions and begin working on a modding tools 2025-08-04 16:03:06 +02:00
luccie-cmd
139e5aacbc Add parameter handling and remove redundant comments 2025-08-03 16:14:50 +02:00
Lorenzo Torres
e7e0927a83 Updated the source for master 2025-08-01 21:38:27 +02:00
Ernesto Lanchares
25e51f9aea Modified how exports work and fixed memory leaks.
Now exports are already defined by the mods api
(something like preinit, init, preframe,
postframe, deinit should be enough functions). At
the moment we only support preinit function.
2025-04-04 18:34:58 +02:00
luccie-cmd
28420f53b0 Added executing of and 2025-03-30 15:00:17 +02:00
luccie-cmd
916115c7cd Added parsing of and 2025-03-30 15:00:17 +02:00
Ernesto Lanchares
237ead3921 Fixed an error during ir parsing. 2025-03-30 14:36:51 +02:00
luccie-cmd
2dc07080dd Add every single instruction prototype for WASM VM 2025-03-29 20:17:52 +01:00
Ernesto Lanchares
16343878cd Started adding all of IR opcodes 2025-03-29 19:31:08 +01:00
Ernesto Lanchares
7023261320 Changed structs in the VM 2025-03-29 19:16:17 +01:00
luccie-cmd
8d39d3d4d0 Added executing of mod IR in the WASM VM 2025-03-28 19:48:15 +01:00
luccie-cmd
964c25a66c Remove testing 2025-03-28 19:48:15 +01:00
Ernesto Lanchares
6fe4855a67 IR can now parse itself. :)
Now we have to reimplement the vm. :_)
2025-03-27 17:05:50 +01:00
Ernesto Lanchares
dd3dc54b05 Fixing format.
Should we run zig fmt as a prehook? or maybe after
pushing?
2025-03-27 17:04:49 +01:00
luccie-cmd
6271509f2a Add testing for wasm VM
Signed-off-by: luccie-cmd <luccie@sideros.org>
2025-03-27 13:58:05 +01:00
luccie-cmd
1db7f9e506 Fix branching and VM
Signed-off-by: luccie-cmd <luccie@sideros.org>
2025-03-27 13:57:37 +01:00
luccie-cmd
bfe9fb5e63 Removed IR parsing and changed fatal bug of i64s being detected as i32s
Signed-off-by: luccie-cmd <luccie@sideros.org>
2025-03-27 13:56:37 +01:00
Ernesto Lanchares
09691ec4d9 Some progress on IR parsing.
Alhtough IR parsing is technically called while
parsing, since we lack the hability to parse
blocks or labels or if or any hard stuff really,
it does not affect code parsing. However it is
nice to have it there as zig compiles it :)
2025-03-24 22:38:12 +01:00
Ernesto Lanchares
942bb3525d Proposal for vector instructions IR
This proposal drops the memory alignment from u32
that is required by spec to a u16. But I think
u16 should be more than enough to represent any
real alignment.

Also this is closer to a custom asm than a IR but
whatever...
2025-03-24 19:41:17 +01:00
Lorenzo Torres
7660bc09bc fixed leb128 integer decoding 2025-03-23 22:40:03 +01:00
Ernesto Lanchares
874134f3ff PROPOSAL: IR
This is a proposal of a custom IR to run wasm.
At the moment only `ir.zig` has some parts related
to this IR. The idea of the IR is to be a subset
of the one defined in wasm. There are some gaps
(mostly in wasm instructions that have opcode
0xFC) but in wasm they don't use all of the
opcodes for some reason so maybe we could try to
utilize them and be a superset of wasm.
2025-03-23 19:32:10 +01:00
Ernesto Lanchares
b7854d7325 Big rework of the parser!
It now follows a more functional style but it
should be waaay easier to add functionality.

Probably the parser is a bit slower than the
previous one but the code is much cleaner and a
good enough compiler should be able to inline the
function calls and make it par with the previous
one.

As a TODO, runtime structs should not depends on
the parser, but I think that is a topic for
another commit.
2025-03-23 14:39:49 +01:00
luccie-cmd
94a4dc16c6 Fix formatting
Signed-off-by: luccie-cmd <luccie@sideros.org>
2025-03-21 22:49:43 +01:00
luccie-cmd
bbe9213573 Added block instruction in WASM VM
Signed-off-by: luccie-cmd <luccie@sideros.org>
2025-03-21 22:49:37 +01:00
Lorenzo Torres
d5d2f1b8d2 Fixed import section parsing 2025-03-19 20:33:13 +01:00
Lorenzo Torres
1d64275dee Refactored source code structure. 2025-03-17 19:44:08 +01:00