@@ -341,63 +341,91 @@ bool rb_abi_guest_rb_set_should_prohibit_rewind(bool value) {
341
341
}
342
342
343
343
#ifdef JS_ENABLE_COMPONENT_MODEL
344
+
345
+ extern void __wasm_call_ctors (void );
346
+ static inline void __wasm_call_ctors_if_needed (void ) {
347
+ static bool __wasm_call_ctors_done = false;
348
+ if (!__wasm_call_ctors_done ) {
349
+ __wasm_call_ctors_done = true;
350
+ __wasm_call_ctors ();
351
+ }
352
+ }
353
+
344
354
// Exported Functions from `ruby:js/ruby-runtime`
345
355
void exports_ruby_js_ruby_runtime_ruby_show_version (void ) {
356
+ __wasm_call_ctors_if_needed ();
346
357
rb_abi_guest_ruby_show_version ();
347
358
}
348
- void exports_ruby_js_ruby_runtime_ruby_init (void ) { rb_abi_guest_ruby_init (); }
359
+ void exports_ruby_js_ruby_runtime_ruby_init (void ) {
360
+ __wasm_call_ctors_if_needed ();
361
+ rb_abi_guest_ruby_init ();
362
+ }
349
363
void exports_ruby_js_ruby_runtime_ruby_sysinit (ext_list_string_t * args ) {
364
+ __wasm_call_ctors_if_needed ();
350
365
rb_abi_guest_ruby_sysinit (args );
351
366
}
352
367
exports_ruby_js_ruby_runtime_own_rb_iseq_t
353
368
exports_ruby_js_ruby_runtime_ruby_options (ext_list_string_t * args ) {
369
+ __wasm_call_ctors_if_needed ();
354
370
return rb_abi_guest_ruby_options (args );
355
371
}
356
372
void exports_ruby_js_ruby_runtime_ruby_script (ext_string_t * name ) {
373
+ __wasm_call_ctors_if_needed ();
357
374
rb_abi_guest_ruby_script (name );
358
375
}
359
376
void exports_ruby_js_ruby_runtime_ruby_init_loadpath (void ) {
377
+ __wasm_call_ctors_if_needed ();
360
378
rb_abi_guest_ruby_init_loadpath ();
361
379
}
362
380
void exports_ruby_js_ruby_runtime_rb_eval_string_protect (
363
381
ext_string_t * str ,
364
382
exports_ruby_js_ruby_runtime_tuple2_own_rb_abi_value_s32_t * ret ) {
383
+ __wasm_call_ctors_if_needed ();
365
384
rb_abi_guest_rb_eval_string_protect (str , ret );
366
385
}
367
386
void exports_ruby_js_ruby_runtime_rb_funcallv_protect (
368
387
exports_ruby_js_ruby_runtime_borrow_rb_abi_value_t recv ,
369
388
exports_ruby_js_ruby_runtime_rb_id_t mid ,
370
389
exports_ruby_js_ruby_runtime_list_borrow_rb_abi_value_t * args ,
371
390
exports_ruby_js_ruby_runtime_tuple2_own_rb_abi_value_s32_t * ret ) {
391
+ __wasm_call_ctors_if_needed ();
372
392
rb_abi_guest_rb_funcallv_protect (recv , mid , args , ret );
373
393
}
374
394
exports_ruby_js_ruby_runtime_rb_id_t
375
395
exports_ruby_js_ruby_runtime_rb_intern (ext_string_t * name ) {
396
+ __wasm_call_ctors_if_needed ();
376
397
return rb_abi_guest_rb_intern (name );
377
398
}
378
399
exports_ruby_js_ruby_runtime_own_rb_abi_value_t
379
400
exports_ruby_js_ruby_runtime_rb_errinfo (void ) {
401
+ __wasm_call_ctors_if_needed ();
380
402
return rb_abi_guest_rb_errinfo ();
381
403
}
382
404
void exports_ruby_js_ruby_runtime_rb_clear_errinfo (void ) {
405
+ __wasm_call_ctors_if_needed ();
383
406
rb_abi_guest_rb_clear_errinfo ();
384
407
}
385
408
void exports_ruby_js_ruby_runtime_rstring_ptr (
386
409
exports_ruby_js_ruby_runtime_borrow_rb_abi_value_t value ,
387
410
ext_string_t * ret ) {
411
+ __wasm_call_ctors_if_needed ();
388
412
rb_abi_guest_rstring_ptr (value , ret );
389
413
}
390
414
void exports_ruby_js_ruby_runtime_rb_vm_bugreport (void ) {
415
+ __wasm_call_ctors_if_needed ();
391
416
rb_abi_guest_rb_vm_bugreport ();
392
417
}
393
418
bool exports_ruby_js_ruby_runtime_rb_gc_enable (void ) {
419
+ __wasm_call_ctors_if_needed ();
394
420
return rb_abi_guest_rb_gc_enable ();
395
421
}
396
422
bool exports_ruby_js_ruby_runtime_rb_gc_disable (void ) {
423
+ __wasm_call_ctors_if_needed ();
397
424
return rb_abi_guest_rb_gc_disable ();
398
425
}
399
426
bool exports_ruby_js_ruby_runtime_rb_set_should_prohibit_rewind (
400
427
bool new_value ) {
428
+ __wasm_call_ctors_if_needed ();
401
429
return rb_abi_guest_rb_set_should_prohibit_rewind (new_value );
402
430
}
403
431
0 commit comments