Samsung / walrus

WebAssembly Lightweight RUntime
Apache License 2.0
37 stars 10 forks source link

Implement function to get size of byte codes #82

Closed kulcsaradam closed 1 year ago

kulcsaradam commented 1 year ago

Add size field to opcodes to track the size of generated byte code. Unimplemented instuctions' size is 0.

kulcsaradam commented 1 year ago

It should be correct now that there are two functions. Since the interpereter only ever really used the what would be the output of getBaseSize() in release mode.

kulcsaradam commented 1 year ago

I have added a header guard although I am unsure if it would cover every kind of looping. I have also added the suggested changes and new lines.

kulcsaradam commented 1 year ago

I have updated this patch to use functions introduced in pr #86.

I have also fixed a bug where while dumping the ByteCode there were Unreachable ByteCodes with incorrect pointers and when those were dumped it caused a crash.

zherczeg commented 1 year ago

I liked the global list better. It consumed less memory than the big switch in the code. But if others prefer this code, I am ok with it.

kulcsaradam commented 1 year ago

I have made the suggested changes.