-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix asc
compilation
#122
Fix asc
compilation
#122
Conversation
As explained here #120 (comment), I push the fix for issue #120 in this PR. @tolauwae When time allows can you please confirm that this PR also fixes the problem for you? I'll then accept the PR. |
|
@carllocos No it does not. I don't think the runtime argument is related to the issue. I have isolated a small piece of code that causes the bug, but it doesn't always fail. Haven't tracked down when it does work: export function invert(mode: PinVoltage): PinVoltage {
if (mode === PinVoltage.LOW) {
return PinVoltage.HIGH;
} else {
return PinVoltage.LOW;
}
} This is compiled to an implicit if, but it should be typed with (func $invert (param $mode i32) (result i32)
(if (result i32)
(i32.eq
(local.get $mode)
(global.get $PinVoltage.LOW)
)
(return
(global.get $PinVoltage.HIGH)
)
(return
(global.get $PinVoltage.LOW)
)
)
) This piece of code only fails for non-optimized compilation on my machine. |
asc
instead of globalasc
compilation
Also this was not a problem in the old version we were using ( |
@tolauwae This is a peculiar problem. Not necessarily related to the options passed to the |
@tolauwae can you please provide me with the source code of your example here above
When it fails is it for the same type error reason as mentioned here #120 (comment)? |
You mean an example that uses it? I can't seem to find it. The compile error was:
The wasm code I posted above is the correct I do know a newer version of the AssemblyScript compiler has been released since, maybe it is fixed by now. |
@carllocos just had a thought. If we use the source-map npm package to get the source mapping straight from AssemblyScript's own mapping, ie This way we can potentially circumvent the problem. Since the binary generated by And to be honest this was already a low priority TODO, since this is a faster, cleaner, and more stable approach. I have a day off today, so I will have a stab at the refactor on Monday. |
To compile ASC without any optimisation I removed the `03s` argument
AssemblyScript compiler can generate lines that contain the `@` symbol but have nothing to do with the source mapping (e.g., '000287d: 6e67 2e55 5446 382e 656e 636f 6465 4076 ng.UTF8.encode@v') which causes `extractLineInfo` to fail on those lines. This commit modifies the regex to only be true for lines that start with `@ {` which ensures that `extractLineInfo` is applied to real source map lines.
@tolauwae that is an excellent idea! However, I tried to work with the same source mapper some time ago but without success :/. The mappings seemed to be only between AssemblyScript and Javascript. I do not know exactly how to get the mappings between Wasm and AssemblyScript. If you have time maybe you can look at it. Maybe there is something that I missed. |
That would be a problem. I'll look in into it. |
@carllocos I refactored to use the AS source map. That works on my end, and the compilation problem should be circumvented now. |
dc02d45
to
7a8f018
Compare
✨ Changes
asc
instead of globalasc