Closed SoniEx2 closed 3 years ago
this doesn't export any of the lua symbols because emscripten doesn't support doing that, but, this is eris for lua 5.3, as a kotlin source file.
you can drop eris entirely too and dump/load the wasm memory instead. slightly less space-efficient tho.
Hey im making a port to 1.16 do you have some knowledge about wasm2kotlin
this lua is just the interpreter, without the necessary API symbols. because we fucked up. .-.
uh we'd recommend not implementing the native io.* APIs provided by C (just make them throw instead), nor any other blocking stuff. instead force lua to yield, so that you can save/load the whole wasm memory and not bother with eris at all. also wasm2kotlin has some issues - the generated files are sometimes too big for kotlinc. (kotlinc just completely refuses to compile files bigger than 20MB. it just ignores them entirely.)
anyway wasm2kotlin needs more work tbh, sorry. .-.
so we can keep JNI, LuaJ in the new version of OpenComputers?
JNI is a pain, and LuaJ is broken. wasm2kotlin is blocked on https://youtrack.jetbrains.com/issue/KT-43829 tbh.
why cant wasm2kotlin split files that are larger then 20MB?
kotlinc can't accept files larger than 20MB. wasm2kotlin outputs them just fine.
update: managed to get lua.kt down in size a bit.
it works!
@SoniEx2 make a PR for this and I can test it
you can use wasm2kotlin to make eris for the JVM. https://github.com/SoniEx2/wabt/tree/wasm2kotlin
then you can remove JNI, LuaJ and enable bytecode loading.
currently missing is porting the emscripten runtime to kotlin.