webassembly: Change "stack" argument to "heapsize".

Because that's what mp_js_init() takes as its argument.

Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
Damien George 2022-11-03 17:36:14 +11:00
parent d65edaa232
commit 7a505d57dc

View File

@ -37,18 +37,18 @@ var mainProgram = function()
if (typeof window === 'undefined' && require.main === module) { if (typeof window === 'undefined' && require.main === module) {
var fs = require('fs'); var fs = require('fs');
var stack_size = 64 * 1024; var heap_size = 128 * 1024;
var contents = ''; var contents = '';
var repl = true; var repl = true;
for (var i = 0; i < process.argv.length; i++) { for (var i = 0; i < process.argv.length; i++) {
if (process.argv[i] === '-X' && i < process.argv.length - 1) { if (process.argv[i] === '-X' && i < process.argv.length - 1) {
if (process.argv[i + 1].includes('stack=')) { if (process.argv[i + 1].includes('heapsize=')) {
stack_size = parseInt(process.argv[i + 1].split('stack=')[1]); heap_size = parseInt(process.argv[i + 1].split('heapsize=')[1]);
if (process.argv[i + 1].substr(-1).toLowerCase() === 'k') { if (process.argv[i + 1].substr(-1).toLowerCase() === 'k') {
stack_size *= 1024; heap_size *= 1024;
} else if (process.argv[i + 1].substr(-1).toLowerCase() === 'm') { } else if (process.argv[i + 1].substr(-1).toLowerCase() === 'm') {
stack_size *= 1024 * 1024; heap_size *= 1024 * 1024;
} }
} }
} else if (process.argv[i].includes('.py')) { } else if (process.argv[i].includes('.py')) {
@ -56,7 +56,7 @@ var mainProgram = function()
repl = false;; repl = false;;
} }
} }
mp_js_init(stack_size); mp_js_init(heap_size);
if (repl) { if (repl) {
mp_js_init_repl(); mp_js_init_repl();