File tree Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Expand file tree Collapse file tree 2 files changed +14
-3
lines changed Original file line number Diff line number Diff line change 1
1
import { main } from "@ruby/wasm-wasi/dist/browser.script"
2
2
import * as pkg from "../package.json"
3
3
4
- main ( pkg )
4
+ main ( pkg , {
5
+ env : {
6
+ // WORKAROUND(katei): setjmp consumes a LOT of stack in Ruby 3.2,
7
+ // so we extend default Fiber stack size as well as main stack
8
+ // size allocated by wasm-ld's --stack-size. 8MB is enough for
9
+ // most cases. See https://github.com/ruby/ruby.wasm/issues/273
10
+ "RUBY_FIBER_MACHINE_STACK_SIZE" : "8388608"
11
+ }
12
+ } )
Original file line number Diff line number Diff line change 1
1
import { DefaultRubyVM } from "./browser" ;
2
2
3
- export const main = async ( pkg : { name : string ; version : string } ) => {
3
+ export const main = async (
4
+ pkg : { name : string ; version : string } ,
5
+ options ?: Parameters < typeof DefaultRubyVM > [ 1 ] ,
6
+ ) => {
4
7
const response = fetch (
5
8
`https://cdn.jsdelivr.net/npm/${ pkg . name } @${ pkg . version } /dist/ruby+stdlib.wasm` ,
6
9
) ;
7
10
const module = await compileWebAssemblyModule ( response ) ;
8
- const { vm } = await DefaultRubyVM ( module ) ;
11
+ const { vm } = await DefaultRubyVM ( module , options ) ;
9
12
10
13
vm . printVersion ( ) ;
11
14
You can’t perform that action at this time.
0 commit comments