Skip to content
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

WebAssembly does not support multi-file programs #2456

Open
ianyong opened this issue Apr 17, 2023 · 3 comments
Open

WebAssembly does not support multi-file programs #2456

ianyong opened this issue Apr 17, 2023 · 3 comments
Labels
Enhancement New feature request

Comments

@ianyong
Copy link
Member

ianyong commented Apr 17, 2023

Because Sourceror is not part of js-slang, the pre-processing step which handles imports & exports does not work with Sourceror. This means that the WebAssembly variants of Source do not support multi-file programs currently. Instead, only the entrypoint file is passed to Sourceror currently:

const entrypointCode = files[entrypointFilePath];
function call_variant(variant: Variant) {
if (variant === Variant.NON_DET) {
return entrypointCode.trim() === TRY_AGAIN
? call(resume, lastNonDetResult)
: call(runFilesInContext, files, entrypointFilePath, context, {
executionMethod: 'interpreter',
originalMaxExecTime: execTime,
stepLimit: stepLimit,
useSubst: substActiveAndCorrectChapter
});
} else if (variant === Variant.LAZY) {
return call(runFilesInContext, files, entrypointFilePath, context, {
scheduler: 'preemptive',
originalMaxExecTime: execTime,
stepLimit: stepLimit,
useSubst: substActiveAndCorrectChapter
});
} else if (variant === Variant.WASM) {
// Note: WASM does not support multiple file programs.
return call(wasm_compile_and_run, entrypointCode, context, actionType === EVAL_REPL);
} else {
throw new Error('Unknown variant: ' + variant);
}
}

@ianyong ianyong added the Enhancement New feature request label Apr 17, 2023
@martin-henz
Copy link
Member

"Source WebAssembly" has always been a kind of "proof of concept". There will be various efforts to integrate WebAssembly-based implementations in the next year. I feel that we can retire "Source WebAssembly" if it causes maintenance issues. @btzy any views on this?

@btzy
Copy link
Contributor

btzy commented Apr 25, 2023

If there's nobody around who is able and willing to maintain Sourceror then it would have to be retired at some point. Also because there's virtually nobody using it, there isn't really much motivation for anyone to keep it up to date. Are the "efforts to integrate WebAssembly-based implementations" actually going to bring something better?

@martin-henz
Copy link
Member

Are the "efforts to integrate WebAssembly-based implementations" actually going to bring something better?

Yes, I hope so. Check out this module to start:

source-academy/modules#204

We'll start using this for compiler work next semester.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New feature request
Projects
None yet
Development

No branches or pull requests

3 participants