WebAssembly.jl
WebAssembly.jl copied to clipboard
Add opcodes. In progress...
There might be a better way, but just throwing something out there to get started.
The idea is to have every Instruction
have an opcode
field so we can write to bytecode via
Base.write(io::IO,is::Instruction) = write(io,is.opcode)
#2
With my early iterations of of this PR, it made some sense to have opcode
be a field for each Instrument
but now that I have the opcodes
Dict, it might be better to remove them and handle everything from the write
methods. I think that is how you intended.
If you think it is better NOT to have an opcode
for each Instruction
, let me know and I'll see about trying again (time permitting).
Yeah, I think it's better to not have the opcode field (consider that it doesn't vary per Return
object etc). You'll also have to handle things in a function for things that do vary, like Constant
.