Closed Dudeplayz closed 3 years ago
Thank @MaxGraey for your help here :-) It's really appreciated!
@MaxGraey There is still an error if a class variable is based on a constructor variable:
RuntimeError: memory access out of bounds
at ~lib/arraybuffer/ArrayBuffer#get:byteLength (wasm-function[26]:0xfd6)
at ~lib/typedarray/Uint8Array.wrap (wasm-function[31]:0x11c5)
at ~lib/typedarray/Uint8Array.wrap@varargs (wasm-function[32]:0x12a6)
at assembly/cpu/cpu/CPU#constructor (wasm-function[35]:0x1345)
I had to change this:
readonly progBytes : Uint8Array = Uint8Array.wrap(this.progMem.buffer);
constructor(public progMem: Uint16Array, private sramBytes: u64 = 8192) {
this.reset();
}
To that:
readonly progBytes : Uint8Array;
constructor(public progMem: Uint16Array, private sramBytes: u64 = 8192) {
this.progBytes = Uint8Array.wrap(this.progMem.buffer);
this.reset();
}
Could you create minimal example on WebAssembly Studio?
Without code I can't tell what's wrong. Plz open issue with minimal reproducible example
Yes, I will open an issue.
This issue collects conflicts of the current code base and AssemblyScript. See #35 and the research project.
Found problems:
types
file can be adapted to keep JS compatibilityICPU
andCPU
. (further research required)CPU
withprogMem
, which has to be declared outside the constructor and the following instantiations have to be done in the constructor body:(The research is still ongoing.)