MikeInnes / WebAssembly.jl

Other
83 stars 11 forks source link

Add opcodes. In progress... #5

Open EricForgy opened 6 years ago

EricForgy commented 6 years ago

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

EricForgy commented 6 years ago

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).

MikeInnes commented 6 years ago

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.