@ruby/wasm-wasi 2.3.0-2023-12-02-a → 2.3.0-2023-12-04-a

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +179 -4
  2. package/dist/browser.script.umd.js +2 -0
  3. package/dist/browser.umd.js +2 -0
  4. package/dist/cjs/bindgen/intrinsics.d.ts +13 -0
  5. package/dist/cjs/bindgen/intrinsics.js +81 -0
  6. package/dist/cjs/bindgen/rb-abi-guest.js +236 -0
  7. package/dist/cjs/bindgen/rb-js-abi-host.js +283 -0
  8. package/dist/{browser.d.ts → cjs/browser.d.ts} +1 -1
  9. package/dist/cjs/browser.js +70 -0
  10. package/dist/{browser.script.d.ts → cjs/browser.script.d.ts} +1 -1
  11. package/dist/cjs/browser.script.js +90 -0
  12. package/dist/{index.d.ts → cjs/index.d.ts} +4 -2
  13. package/dist/cjs/index.js +600 -0
  14. package/dist/{node.d.ts → cjs/node.d.ts} +1 -1
  15. package/dist/cjs/node.js +23 -0
  16. package/dist/esm/bindgen/intrinsics.d.ts +13 -0
  17. package/dist/esm/bindgen/intrinsics.js +73 -0
  18. package/dist/esm/bindgen/rb-abi-guest.d.ts +140 -0
  19. package/dist/esm/bindgen/rb-abi-guest.js +230 -0
  20. package/dist/esm/bindgen/rb-js-abi-host.d.ts +53 -0
  21. package/dist/esm/bindgen/rb-js-abi-host.js +279 -0
  22. package/dist/esm/browser.d.ts +10 -0
  23. package/dist/esm/browser.js +66 -0
  24. package/dist/esm/browser.script.d.ts +5 -0
  25. package/dist/esm/browser.script.js +86 -0
  26. package/dist/esm/index.d.ts +194 -0
  27. package/dist/esm/index.js +592 -0
  28. package/dist/esm/node.d.ts +10 -0
  29. package/dist/esm/node.js +19 -0
  30. package/dist/esm/package.json +1 -0
  31. package/dist/index.umd.js +2 -0
  32. package/package.json +19 -33
  33. package/dist/browser.cjs.js +0 -3248
  34. package/dist/browser.esm.js +0 -3245
  35. package/dist/browser.script.cjs.js +0 -3375
  36. package/dist/browser.script.esm.js +0 -3372
  37. package/dist/index.cjs.js +0 -1192
  38. package/dist/index.esm.js +0 -1187
  39. package/dist/node.cjs.js +0 -1209
  40. package/dist/node.esm.js +0 -1207
  41. /package/dist/{bindgen → cjs/bindgen}/rb-abi-guest.d.ts +0 -0
  42. /package/dist/{bindgen → cjs/bindgen}/rb-js-abi-host.d.ts +0 -0
package/README.md CHANGED
@@ -1,8 +1,183 @@
1
1
  # @ruby/wasm-wasi
2
2
 
3
- This package is a template for each channel-specific package.
3
+ [![npm version](https://badge.fury.io/js/@ruby%2Fwasm-wasi.svg)](https://www.npmjs.com/package/@ruby/wasm-wasi)
4
4
 
5
- | Channel | Package |
6
- | ------- | ------------------------------------------------- |
5
+ This package core API for Ruby on WebAssembly targeting WASI-compatible environments. WebAssembly binaries are distributed in version-specific packages.
6
+
7
+ See [Cheat Sheet](https://github.com/ruby/ruby.wasm/blob/main/docs/cheat_sheet.md) for how to use this package.
8
+
9
+ ## Ruby Version Support
10
+
11
+ | Version | Package |
12
+ | ------- | -------------------------------------------------- |
7
13
  | `head` | [`@ruby/head-wasm-wasi`](./../ruby-head-wasm-wasi) |
8
- | `3.2` | [`@ruby/3.2-wasm-wasi`](./../ruby-3.2-wasm-wasi) |
14
+ | `3.2` | [`@ruby/3.2-wasm-wasi`](./../ruby-3.2-wasm-wasi) |
15
+
16
+ ## API
17
+
18
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
19
+
20
+ ### RubyVM
21
+
22
+ A Ruby VM instance
23
+
24
+ #### Examples
25
+
26
+ ```javascript
27
+ const wasi = new WASI();
28
+ const vm = new RubyVM();
29
+ const imports = {
30
+ wasi_snapshot_preview1: wasi.wasiImport,
31
+ };
32
+
33
+ vm.addToImports(imports);
34
+
35
+ const instance = await WebAssembly.instantiate(rubyModule, imports);
36
+ await vm.setInstance(instance);
37
+ wasi.initialize(instance);
38
+ vm.initialize();
39
+ ```
40
+
41
+ #### initialize
42
+
43
+ Initialize the Ruby VM with the given command line arguments
44
+
45
+ ##### Parameters
46
+
47
+ - `args` The command line arguments to pass to Ruby. Must be
48
+ an array of strings starting with the Ruby program name. (optional, default `["ruby.wasm","--disable-gems","-EUTF-8","-e_=0"]`)
49
+
50
+ #### setInstance
51
+
52
+ Set a given instance to interact JavaScript and Ruby's
53
+ WebAssembly instance. This method must be called before calling
54
+ Ruby API.
55
+
56
+ ##### Parameters
57
+
58
+ - `instance` The WebAssembly instance to interact with. Must
59
+ be instantiated from a Ruby built with JS extension, and built
60
+ with Reactor ABI instead of command line.
61
+
62
+ #### addToImports
63
+
64
+ Add intrinsic import entries, which is necessary to interact JavaScript
65
+ and Ruby's WebAssembly instance.
66
+
67
+ ##### Parameters
68
+
69
+ - `imports` The import object to add to the WebAssembly instance
70
+
71
+ #### printVersion
72
+
73
+ Print the Ruby version to stdout
74
+
75
+ #### eval
76
+
77
+ Runs a string of Ruby code from JavaScript
78
+
79
+ ##### Parameters
80
+
81
+ - `code` The Ruby code to run
82
+
83
+ ##### Examples
84
+
85
+ ```javascript
86
+ vm.eval("puts 'hello world'");
87
+ const result = vm.eval("1 + 2");
88
+ console.log(result.toString()); // 3
89
+ ```
90
+
91
+ Returns **any** the result of the last expression
92
+
93
+ #### evalAsync
94
+
95
+ Runs a string of Ruby code with top-level `JS::Object#await`
96
+ Returns a promise that resolves when execution completes.
97
+
98
+ ##### Parameters
99
+
100
+ - `code` The Ruby code to run
101
+
102
+ ##### Examples
103
+
104
+ ```javascript
105
+ const text = await vm.evalAsync(`
106
+ require 'js'
107
+ response = JS.global.fetch('https://example.com').await
108
+ response.text.await
109
+ `);
110
+ console.log(text.toString()); // <html>...</html>
111
+ ```
112
+
113
+ Returns **any** a promise that resolves to the result of the last expression
114
+
115
+ #### wrap
116
+
117
+ Wrap a JavaScript value into a Ruby JS::Object
118
+
119
+ ##### Parameters
120
+
121
+ - `value` The value to convert to RbValue
122
+
123
+ ##### Examples
124
+
125
+ ```javascript
126
+ const hash = vm.eval(`Hash.new`);
127
+ hash.call("store", vm.eval(`"key1"`), vm.wrap(new Object()));
128
+ ```
129
+
130
+ Returns **any** the RbValue object representing the given JS value
131
+
132
+ ### RbValue
133
+
134
+ A RbValue is an object that represents a value in Ruby
135
+
136
+ #### call
137
+
138
+ Call a given method with given arguments
139
+
140
+ ##### Parameters
141
+
142
+ - `callee` name of the Ruby method to call
143
+ - `args` **...any** arguments to pass to the method. Must be an array of RbValue
144
+
145
+ ##### Examples
146
+
147
+ ```javascript
148
+ const ary = vm.eval("[1, 2, 3]");
149
+ ary.call("push", 4);
150
+ console.log(ary.call("sample").toString());
151
+ ```
152
+
153
+ #### toPrimitive
154
+
155
+ - **See**: <https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toPrimitive>
156
+
157
+ ##### Parameters
158
+
159
+ - `hint` Preferred type of the result primitive value. `"number"`, `"string"`, or `"default"`.
160
+
161
+ #### toString
162
+
163
+ Returns a string representation of the value by calling `to_s`
164
+
165
+ #### toJS
166
+
167
+ Returns a JavaScript object representation of the value
168
+ by calling `to_js`.
169
+
170
+ Returns null if the value is not convertible to a JavaScript object.
171
+
172
+ ### RbError
173
+
174
+ **Extends Error**
175
+
176
+ Error class thrown by Ruby execution
177
+
178
+ ### RbFatalError
179
+
180
+ **Extends RbError**
181
+
182
+ Error class thrown by Ruby execution when it is not possible to recover.
183
+ This is usually caused when Ruby VM is in an inconsistent state.
@@ -2969,12 +2969,14 @@
2969
2969
  wrap(value) {
2970
2970
  return this.transport.importJsValue(value, this);
2971
2971
  }
2972
+ /** @private */
2972
2973
  privateObject() {
2973
2974
  return {
2974
2975
  transport: this.transport,
2975
2976
  exceptionFormatter: this.exceptionFormatter,
2976
2977
  };
2977
2978
  }
2979
+ /** @private */
2978
2980
  rbValueOfPointer(pointer) {
2979
2981
  const abiValue = new RbAbiValue(pointer, this.guest);
2980
2982
  return new RbValue(abiValue, this, this.privateObject());
@@ -2927,12 +2927,14 @@
2927
2927
  wrap(value) {
2928
2928
  return this.transport.importJsValue(value, this);
2929
2929
  }
2930
+ /** @private */
2930
2931
  privateObject() {
2931
2932
  return {
2932
2933
  transport: this.transport,
2933
2934
  exceptionFormatter: this.exceptionFormatter,
2934
2935
  };
2935
2936
  }
2937
+ /** @private */
2936
2938
  rbValueOfPointer(pointer) {
2937
2939
  const abiValue = new RbAbiValue(pointer, this.guest);
2938
2940
  return new RbValue(abiValue, this, this.privateObject());
@@ -0,0 +1,13 @@
1
+ export function data_view(mem: any): DataView;
2
+ export function to_uint32(val: any): number;
3
+ export function utf8_encode(s: any, realloc: any, memory: any): number;
4
+ export function throw_invalid_bool(): void;
5
+ export const UTF8_DECODER: TextDecoder;
6
+ export let UTF8_ENCODED_LEN: number;
7
+ export class Slab {
8
+ list: any[];
9
+ head: number;
10
+ insert(val: any): number;
11
+ get(idx: any): any;
12
+ remove(idx: any): any;
13
+ }
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.throw_invalid_bool = exports.Slab = exports.UTF8_ENCODED_LEN = exports.utf8_encode = exports.UTF8_DECODER = exports.to_uint32 = exports.data_view = void 0;
4
+ let DATA_VIEW = new DataView(new ArrayBuffer());
5
+ function data_view(mem) {
6
+ if (DATA_VIEW.buffer !== mem.buffer)
7
+ DATA_VIEW = new DataView(mem.buffer);
8
+ return DATA_VIEW;
9
+ }
10
+ exports.data_view = data_view;
11
+ function to_uint32(val) {
12
+ return val >>> 0;
13
+ }
14
+ exports.to_uint32 = to_uint32;
15
+ exports.UTF8_DECODER = new TextDecoder('utf-8');
16
+ const UTF8_ENCODER = new TextEncoder('utf-8');
17
+ function utf8_encode(s, realloc, memory) {
18
+ if (typeof s !== 'string')
19
+ throw new TypeError('expected a string');
20
+ if (s.length === 0) {
21
+ exports.UTF8_ENCODED_LEN = 0;
22
+ return 1;
23
+ }
24
+ let alloc_len = 0;
25
+ let ptr = 0;
26
+ let writtenTotal = 0;
27
+ while (s.length > 0) {
28
+ ptr = realloc(ptr, alloc_len, 1, alloc_len + s.length);
29
+ alloc_len += s.length;
30
+ const { read, written } = UTF8_ENCODER.encodeInto(s, new Uint8Array(memory.buffer, ptr + writtenTotal, alloc_len - writtenTotal));
31
+ writtenTotal += written;
32
+ s = s.slice(read);
33
+ }
34
+ if (alloc_len > writtenTotal)
35
+ ptr = realloc(ptr, alloc_len, 1, writtenTotal);
36
+ exports.UTF8_ENCODED_LEN = writtenTotal;
37
+ return ptr;
38
+ }
39
+ exports.utf8_encode = utf8_encode;
40
+ exports.UTF8_ENCODED_LEN = 0;
41
+ class Slab {
42
+ constructor() {
43
+ this.list = [];
44
+ this.head = 0;
45
+ }
46
+ insert(val) {
47
+ if (this.head >= this.list.length) {
48
+ this.list.push({
49
+ next: this.list.length + 1,
50
+ val: undefined,
51
+ });
52
+ }
53
+ const ret = this.head;
54
+ const slot = this.list[ret];
55
+ this.head = slot.next;
56
+ slot.next = -1;
57
+ slot.val = val;
58
+ return ret;
59
+ }
60
+ get(idx) {
61
+ if (idx >= this.list.length)
62
+ throw new RangeError('handle index not valid');
63
+ const slot = this.list[idx];
64
+ if (slot.next === -1)
65
+ return slot.val;
66
+ throw new RangeError('handle index not valid');
67
+ }
68
+ remove(idx) {
69
+ const ret = this.get(idx); // validate the slot
70
+ const slot = this.list[idx];
71
+ slot.val = undefined;
72
+ slot.next = this.head;
73
+ this.head = idx;
74
+ return ret;
75
+ }
76
+ }
77
+ exports.Slab = Slab;
78
+ function throw_invalid_bool() {
79
+ throw new RangeError("invalid variant discriminant for bool");
80
+ }
81
+ exports.throw_invalid_bool = throw_invalid_bool;
@@ -0,0 +1,236 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RbAbiValue = exports.RbIseq = exports.RbAbiGuest = void 0;
4
+ const intrinsics_js_1 = require("./intrinsics.js");
5
+ class RbAbiGuest {
6
+ constructor() {
7
+ this._resource0_slab = new intrinsics_js_1.Slab();
8
+ this._resource1_slab = new intrinsics_js_1.Slab();
9
+ }
10
+ addToImports(imports) {
11
+ if (!("canonical_abi" in imports))
12
+ imports["canonical_abi"] = {};
13
+ imports.canonical_abi['resource_drop_rb-iseq'] = i => {
14
+ this._resource0_slab.remove(i).drop();
15
+ };
16
+ imports.canonical_abi['resource_clone_rb-iseq'] = i => {
17
+ const obj = this._resource0_slab.get(i);
18
+ return this._resource0_slab.insert(obj.clone());
19
+ };
20
+ imports.canonical_abi['resource_get_rb-iseq'] = i => {
21
+ return this._resource0_slab.get(i)._wasm_val;
22
+ };
23
+ imports.canonical_abi['resource_new_rb-iseq'] = i => {
24
+ const registry = this._registry0;
25
+ return this._resource0_slab.insert(new RbIseq(i, this));
26
+ };
27
+ imports.canonical_abi['resource_drop_rb-abi-value'] = i => {
28
+ this._resource1_slab.remove(i).drop();
29
+ };
30
+ imports.canonical_abi['resource_clone_rb-abi-value'] = i => {
31
+ const obj = this._resource1_slab.get(i);
32
+ return this._resource1_slab.insert(obj.clone());
33
+ };
34
+ imports.canonical_abi['resource_get_rb-abi-value'] = i => {
35
+ return this._resource1_slab.get(i)._wasm_val;
36
+ };
37
+ imports.canonical_abi['resource_new_rb-abi-value'] = i => {
38
+ const registry = this._registry1;
39
+ return this._resource1_slab.insert(new RbAbiValue(i, this));
40
+ };
41
+ }
42
+ async instantiate(module, imports) {
43
+ imports = imports || {};
44
+ this.addToImports(imports);
45
+ if (module instanceof WebAssembly.Instance) {
46
+ this.instance = module;
47
+ }
48
+ else if (module instanceof WebAssembly.Module) {
49
+ this.instance = await WebAssembly.instantiate(module, imports);
50
+ }
51
+ else if (module instanceof ArrayBuffer || module instanceof Uint8Array) {
52
+ const { instance } = await WebAssembly.instantiate(module, imports);
53
+ this.instance = instance;
54
+ }
55
+ else {
56
+ const { instance } = await WebAssembly.instantiateStreaming(module, imports);
57
+ this.instance = instance;
58
+ }
59
+ this._exports = this.instance.exports;
60
+ this._registry0 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-iseq']);
61
+ this._registry1 = new FinalizationRegistry(this._exports['canonical_abi_drop_rb-abi-value']);
62
+ }
63
+ rubyShowVersion() {
64
+ this._exports['ruby-show-version: func() -> ()']();
65
+ }
66
+ rubyInit() {
67
+ this._exports['ruby-init: func() -> ()']();
68
+ }
69
+ rubySysinit(arg0) {
70
+ const memory = this._exports.memory;
71
+ const realloc = this._exports["cabi_realloc"];
72
+ const vec1 = arg0;
73
+ const len1 = vec1.length;
74
+ const result1 = realloc(0, 0, 4, len1 * 8);
75
+ for (let i = 0; i < vec1.length; i++) {
76
+ const e = vec1[i];
77
+ const base = result1 + i * 8;
78
+ const ptr0 = (0, intrinsics_js_1.utf8_encode)(e, realloc, memory);
79
+ const len0 = intrinsics_js_1.UTF8_ENCODED_LEN;
80
+ (0, intrinsics_js_1.data_view)(memory).setInt32(base + 4, len0, true);
81
+ (0, intrinsics_js_1.data_view)(memory).setInt32(base + 0, ptr0, true);
82
+ }
83
+ this._exports['ruby-sysinit: func(args: list<string>) -> ()'](result1, len1);
84
+ }
85
+ rubyOptions(arg0) {
86
+ const memory = this._exports.memory;
87
+ const realloc = this._exports["cabi_realloc"];
88
+ const vec1 = arg0;
89
+ const len1 = vec1.length;
90
+ const result1 = realloc(0, 0, 4, len1 * 8);
91
+ for (let i = 0; i < vec1.length; i++) {
92
+ const e = vec1[i];
93
+ const base = result1 + i * 8;
94
+ const ptr0 = (0, intrinsics_js_1.utf8_encode)(e, realloc, memory);
95
+ const len0 = intrinsics_js_1.UTF8_ENCODED_LEN;
96
+ (0, intrinsics_js_1.data_view)(memory).setInt32(base + 4, len0, true);
97
+ (0, intrinsics_js_1.data_view)(memory).setInt32(base + 0, ptr0, true);
98
+ }
99
+ const ret = this._exports['ruby-options: func(args: list<string>) -> handle<rb-iseq>'](result1, len1);
100
+ return this._resource0_slab.remove(ret);
101
+ }
102
+ rubyScript(arg0) {
103
+ const memory = this._exports.memory;
104
+ const realloc = this._exports["cabi_realloc"];
105
+ const ptr0 = (0, intrinsics_js_1.utf8_encode)(arg0, realloc, memory);
106
+ const len0 = intrinsics_js_1.UTF8_ENCODED_LEN;
107
+ this._exports['ruby-script: func(name: string) -> ()'](ptr0, len0);
108
+ }
109
+ rubyInitLoadpath() {
110
+ this._exports['ruby-init-loadpath: func() -> ()']();
111
+ }
112
+ rbEvalStringProtect(arg0) {
113
+ const memory = this._exports.memory;
114
+ const realloc = this._exports["cabi_realloc"];
115
+ const ptr0 = (0, intrinsics_js_1.utf8_encode)(arg0, realloc, memory);
116
+ const len0 = intrinsics_js_1.UTF8_ENCODED_LEN;
117
+ const ret = this._exports['rb-eval-string-protect: func(str: string) -> tuple<handle<rb-abi-value>, s32>'](ptr0, len0);
118
+ return [this._resource1_slab.remove((0, intrinsics_js_1.data_view)(memory).getInt32(ret + 0, true)), (0, intrinsics_js_1.data_view)(memory).getInt32(ret + 4, true)];
119
+ }
120
+ rbFuncallvProtect(arg0, arg1, arg2) {
121
+ const memory = this._exports.memory;
122
+ const realloc = this._exports["cabi_realloc"];
123
+ const obj0 = arg0;
124
+ if (!(obj0 instanceof RbAbiValue))
125
+ throw new TypeError('expected instance of RbAbiValue');
126
+ const vec2 = arg2;
127
+ const len2 = vec2.length;
128
+ const result2 = realloc(0, 0, 4, len2 * 4);
129
+ for (let i = 0; i < vec2.length; i++) {
130
+ const e = vec2[i];
131
+ const base = result2 + i * 4;
132
+ const obj1 = e;
133
+ if (!(obj1 instanceof RbAbiValue))
134
+ throw new TypeError('expected instance of RbAbiValue');
135
+ (0, intrinsics_js_1.data_view)(memory).setInt32(base + 0, this._resource1_slab.insert(obj1.clone()), true);
136
+ }
137
+ const ret = this._exports['rb-funcallv-protect: func(recv: handle<rb-abi-value>, mid: u32, args: list<handle<rb-abi-value>>) -> tuple<handle<rb-abi-value>, s32>'](this._resource1_slab.insert(obj0.clone()), (0, intrinsics_js_1.to_uint32)(arg1), result2, len2);
138
+ return [this._resource1_slab.remove((0, intrinsics_js_1.data_view)(memory).getInt32(ret + 0, true)), (0, intrinsics_js_1.data_view)(memory).getInt32(ret + 4, true)];
139
+ }
140
+ rbIntern(arg0) {
141
+ const memory = this._exports.memory;
142
+ const realloc = this._exports["cabi_realloc"];
143
+ const ptr0 = (0, intrinsics_js_1.utf8_encode)(arg0, realloc, memory);
144
+ const len0 = intrinsics_js_1.UTF8_ENCODED_LEN;
145
+ const ret = this._exports['rb-intern: func(name: string) -> u32'](ptr0, len0);
146
+ return ret >>> 0;
147
+ }
148
+ rbErrinfo() {
149
+ const ret = this._exports['rb-errinfo: func() -> handle<rb-abi-value>']();
150
+ return this._resource1_slab.remove(ret);
151
+ }
152
+ rbClearErrinfo() {
153
+ this._exports['rb-clear-errinfo: func() -> ()']();
154
+ }
155
+ rstringPtr(arg0) {
156
+ const memory = this._exports.memory;
157
+ const obj0 = arg0;
158
+ if (!(obj0 instanceof RbAbiValue))
159
+ throw new TypeError('expected instance of RbAbiValue');
160
+ const ret = this._exports['rstring-ptr: func(value: handle<rb-abi-value>) -> string'](this._resource1_slab.insert(obj0.clone()));
161
+ const ptr1 = (0, intrinsics_js_1.data_view)(memory).getInt32(ret + 0, true);
162
+ const len1 = (0, intrinsics_js_1.data_view)(memory).getInt32(ret + 4, true);
163
+ const result1 = intrinsics_js_1.UTF8_DECODER.decode(new Uint8Array(memory.buffer, ptr1, len1));
164
+ this._exports["cabi_post_rstring-ptr"](ret);
165
+ return result1;
166
+ }
167
+ rbVmBugreport() {
168
+ this._exports['rb-vm-bugreport: func() -> ()']();
169
+ }
170
+ rbGcEnable() {
171
+ const ret = this._exports['rb-gc-enable: func() -> bool']();
172
+ const bool0 = ret;
173
+ return bool0 == 0 ? false : (bool0 == 1 ? true : (0, intrinsics_js_1.throw_invalid_bool)());
174
+ }
175
+ rbGcDisable() {
176
+ const ret = this._exports['rb-gc-disable: func() -> bool']();
177
+ const bool0 = ret;
178
+ return bool0 == 0 ? false : (bool0 == 1 ? true : (0, intrinsics_js_1.throw_invalid_bool)());
179
+ }
180
+ rbSetShouldProhibitRewind(arg0) {
181
+ const ret = this._exports['rb-set-should-prohibit-rewind: func(new-value: bool) -> bool'](arg0 ? 1 : 0);
182
+ const bool0 = ret;
183
+ return bool0 == 0 ? false : (bool0 == 1 ? true : (0, intrinsics_js_1.throw_invalid_bool)());
184
+ }
185
+ }
186
+ exports.RbAbiGuest = RbAbiGuest;
187
+ class RbIseq {
188
+ constructor(wasm_val, obj) {
189
+ this._wasm_val = wasm_val;
190
+ this._obj = obj;
191
+ this._refcnt = 1;
192
+ obj._registry0.register(this, wasm_val, this);
193
+ }
194
+ clone() {
195
+ this._refcnt += 1;
196
+ return this;
197
+ }
198
+ drop() {
199
+ this._refcnt -= 1;
200
+ if (this._refcnt !== 0)
201
+ return;
202
+ this._obj._registry0.unregister(this);
203
+ const dtor = this._obj._exports['canonical_abi_drop_rb-iseq'];
204
+ const wasm_val = this._wasm_val;
205
+ delete this._obj;
206
+ delete this._refcnt;
207
+ delete this._wasm_val;
208
+ dtor(wasm_val);
209
+ }
210
+ }
211
+ exports.RbIseq = RbIseq;
212
+ class RbAbiValue {
213
+ constructor(wasm_val, obj) {
214
+ this._wasm_val = wasm_val;
215
+ this._obj = obj;
216
+ this._refcnt = 1;
217
+ obj._registry1.register(this, wasm_val, this);
218
+ }
219
+ clone() {
220
+ this._refcnt += 1;
221
+ return this;
222
+ }
223
+ drop() {
224
+ this._refcnt -= 1;
225
+ if (this._refcnt !== 0)
226
+ return;
227
+ this._obj._registry1.unregister(this);
228
+ const dtor = this._obj._exports['canonical_abi_drop_rb-abi-value'];
229
+ const wasm_val = this._wasm_val;
230
+ delete this._obj;
231
+ delete this._refcnt;
232
+ delete this._wasm_val;
233
+ dtor(wasm_val);
234
+ }
235
+ }
236
+ exports.RbAbiValue = RbAbiValue;