js 2.6.1 → 2.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2886bbeac0af159a2c25b2cceb53b967f4ef7928f2e8518648f0517f4b5a8a3b
4
- data.tar.gz: 598e83d78b499fabeb223f98b980f5716650246d42a24cd0cb327fd27ac95e10
3
+ metadata.gz: 153c572884d06b66e29644640877fa1b35d8d08725d44cafb0895e0269f40d8d
4
+ data.tar.gz: 67351a2724d1c4f74aba3506d14334bef7055918e564429ac9eaf73b277dbcac
5
5
  SHA512:
6
- metadata.gz: 56a2c02d0f6d42e27ff3d45385e1bcc1e7464d18ea0ed07e92cf08a8d7469cbb27cdc38f8ee69eb67ca3052455d1cd2a5a10016e338f03f3aa8bb3127a806ae0
7
- data.tar.gz: cffe906a9cfa1710d75f9df827bdc9b406009ddc90291fef4b036aa7c6e70a495de130883114762f83456dd69243134683bb7c4bef038069229385c97b89cd5d
6
+ metadata.gz: 7f5cfd35ce5a3242d83553dc3fe8e71664fcad0198535d85ee06adbad272cae7d3eddc2ade6e9852b4f81c559056f4f0904474f83ad6d0a000536a9b0d93a10b
7
+ data.tar.gz: bd603fe5fe568ec47898d1356a1e46f0bde720313c56b24e36b4f1f70d46f3995c87728621463d332ba37fd347f7ae7f78d218c99adf0d594f50954e21515a49
data/ext/js/js-core.c CHANGED
@@ -438,7 +438,7 @@ static VALUE _rb_js_import_from_js(VALUE obj) {
438
438
  * Returns +obj+ wrapped by JS class RbValue.
439
439
  */
440
440
  static VALUE _rb_js_obj_wrap(VALUE obj, VALUE wrapping) {
441
- #if JS_ENABLE_COMPONENT_MODEL
441
+ #ifdef JS_ENABLE_COMPONENT_MODEL
442
442
  rb_abi_stage_rb_value_to_js(wrapping);
443
443
  return jsvalue_s_new(rb_js_abi_host_rb_object_to_js_rb_value());
444
444
  #else
@@ -511,7 +511,7 @@ static VALUE _rb_js_false_to_js(VALUE obj) {
511
511
  * Returns +self+ as a JS::Object.
512
512
  */
513
513
  static VALUE _rb_js_proc_to_js(VALUE obj) {
514
- #if JS_ENABLE_COMPONENT_MODEL
514
+ #ifdef JS_ENABLE_COMPONENT_MODEL
515
515
  rb_abi_stage_rb_value_to_js(obj);
516
516
  return jsvalue_s_new(ruby_js_js_runtime_proc_to_js_function());
517
517
  #else
data/ext/js/witapi-core.c CHANGED
@@ -3,7 +3,11 @@
3
3
  #include "ruby.h"
4
4
  #include "ruby/version.h"
5
5
 
6
- static VALUE rb_eval_string_value_protect_thunk(VALUE str) {
6
+ #include "types.h"
7
+
8
+ static VALUE rb_eval_string_value_protect_thunk(VALUE ctx) {
9
+ const rb_abi_guest_string_t *cabi_str = (const rb_abi_guest_string_t *)ctx;
10
+ VALUE str = rb_utf8_str_new((const char *)cabi_str->ptr, cabi_str->len);
7
11
  const ID id_eval = rb_intern("eval");
8
12
  VALUE binding = rb_const_get(rb_cObject, rb_intern("TOPLEVEL_BINDING"));
9
13
  const VALUE file = rb_utf8_str_new("eval", 4);
@@ -11,14 +15,13 @@ static VALUE rb_eval_string_value_protect_thunk(VALUE str) {
11
15
  return rb_funcallv(rb_mKernel, id_eval, 3, args);
12
16
  }
13
17
 
14
- static VALUE rb_eval_string_value_protect(VALUE str, int *pstate) {
15
- return rb_protect(rb_eval_string_value_protect_thunk, str, pstate);
18
+ static VALUE rb_eval_string_value_protect(const rb_abi_guest_string_t *str,
19
+ int *pstate) {
20
+ return rb_protect(rb_eval_string_value_protect_thunk, (VALUE)str, pstate);
16
21
  }
17
22
 
18
23
  #define TAG_NONE 0
19
24
 
20
- #include "types.h"
21
-
22
25
  __attribute__((import_module("asyncify"), import_name("start_unwind"))) void
23
26
  asyncify_start_unwind(void *buf);
24
27
  #define asyncify_start_unwind(buf) \
@@ -200,15 +203,17 @@ void exports_ruby_js_ruby_runtime_rb_abi_value_destructor(
200
203
 
201
204
  void rb_abi_guest_ruby_show_version(void) { ruby_show_version(); }
202
205
 
203
- void rb_abi_guest_ruby_init(void) {
204
- RB_WASM_LIB_RT(ruby_init())
205
-
206
+ __attribute__((noinline)) static void rb_abi_guest_ruby_init_thunk(void) {
207
+ ruby_init();
206
208
  rb_abi_guest_arena_hash = rb_hash_new();
207
209
  rb_abi_guest_refcount_hash = rb_hash_new();
208
210
 
209
211
  rb_gc_register_mark_object(rb_abi_guest_arena_hash);
210
212
  rb_gc_register_mark_object(rb_abi_guest_refcount_hash);
211
213
  }
214
+ void rb_abi_guest_ruby_init(void) {
215
+ RB_WASM_LIB_RT(rb_abi_guest_ruby_init_thunk())
216
+ }
212
217
 
213
218
  void rb_abi_guest_ruby_sysinit(rb_abi_guest_list_string_t *args) {
214
219
  char **c_args;
@@ -234,12 +239,11 @@ void rb_abi_guest_ruby_init_loadpath(void) {
234
239
  RB_WASM_LIB_RT(ruby_init_loadpath())
235
240
  }
236
241
 
237
- void rb_abi_guest_rb_eval_string_protect(
242
+ __attribute__((noinline)) static void rb_abi_guest_rb_eval_string_protect_thunk(
238
243
  rb_abi_guest_string_t *str, rb_abi_guest_tuple2_rb_abi_value_s32_t *ret0) {
239
244
  VALUE retval;
240
245
  RB_WASM_DEBUG_LOG("rb_eval_string_protect: str = %s\n", str->ptr);
241
- VALUE utf8_str = rb_utf8_str_new((const char *)str->ptr, str->len);
242
- RB_WASM_LIB_RT(retval = rb_eval_string_value_protect(utf8_str, &ret0->f1));
246
+ retval = rb_eval_string_value_protect(str, &ret0->f1);
243
247
  RB_WASM_DEBUG_LOG("rb_eval_string_protect: retval = %p, state = %d\n",
244
248
  (void *)retval, ret0->f1);
245
249
 
@@ -248,6 +252,10 @@ void rb_abi_guest_rb_eval_string_protect(
248
252
  }
249
253
  ret0->f0 = rb_abi_guest_rb_abi_value_new((void *)retval);
250
254
  }
255
+ void rb_abi_guest_rb_eval_string_protect(
256
+ rb_abi_guest_string_t *str, rb_abi_guest_tuple2_rb_abi_value_s32_t *ret0) {
257
+ RB_WASM_LIB_RT(rb_abi_guest_rb_eval_string_protect_thunk(str, ret0));
258
+ }
251
259
 
252
260
  struct rb_funcallv_thunk_ctx {
253
261
  VALUE recv;
@@ -284,7 +292,9 @@ void rb_abi_guest_rb_funcallv_protect(
284
292
  }
285
293
 
286
294
  rb_abi_guest_rb_id_t rb_abi_guest_rb_intern(rb_abi_guest_string_t *name) {
287
- return rb_intern((const char *)name->ptr);
295
+ VALUE retval;
296
+ RB_WASM_LIB_RT(retval = rb_intern((const char *)name->ptr));
297
+ return (rb_abi_guest_rb_id_t)retval;
288
298
  }
289
299
 
290
300
  rb_abi_guest_own_rb_abi_value_t rb_abi_guest_rb_errinfo(void) {
@@ -294,16 +304,24 @@ rb_abi_guest_own_rb_abi_value_t rb_abi_guest_rb_errinfo(void) {
294
304
  return rb_abi_guest_rb_abi_value_new((void *)retval);
295
305
  }
296
306
 
297
- void rb_abi_guest_rb_clear_errinfo(void) { rb_set_errinfo(Qnil); }
307
+ void rb_abi_guest_rb_clear_errinfo(void) {
308
+ RB_WASM_LIB_RT(rb_set_errinfo(Qnil));
309
+ }
298
310
 
299
- void rb_abi_guest_rstring_ptr(rb_abi_guest_rb_abi_value_t value,
300
- rb_abi_guest_string_t *ret0) {
311
+ __attribute__((noinline)) static void
312
+ rb_abi_guest_rstring_ptr_thunk(rb_abi_guest_rb_abi_value_t value,
313
+ rb_abi_guest_string_t *ret0) {
301
314
  VALUE r_str = (VALUE)rb_abi_guest_rb_abi_value_get(&value);
302
315
  ret0->len = RSTRING_LEN(r_str);
303
316
  ret0->ptr = xmalloc(ret0->len);
304
317
  memcpy(ret0->ptr, RSTRING_PTR(r_str), ret0->len);
305
318
  }
306
319
 
320
+ void rb_abi_guest_rstring_ptr(rb_abi_guest_rb_abi_value_t value,
321
+ rb_abi_guest_string_t *ret0) {
322
+ RB_WASM_LIB_RT(rb_abi_guest_rstring_ptr_thunk(value, ret0));
323
+ }
324
+
307
325
  uint32_t rb_abi_guest_rb_abi_value_data_ptr(rb_abi_guest_rb_abi_value_t self) {
308
326
  VALUE obj = (VALUE)rb_abi_guest_rb_abi_value_get(&self);
309
327
  return (uint32_t)DATA_PTR(obj);
@@ -340,6 +358,8 @@ bool rb_abi_guest_rb_set_should_prohibit_rewind(bool value) {
340
358
  return old;
341
359
  }
342
360
 
361
+ #ifdef JS_ENABLE_COMPONENT_MODEL
362
+
343
363
  static VALUE rb_abi_export_stage = Qnil;
344
364
  static rb_abi_guest_own_rb_abi_value_t rb_abi_export_rb_value_to_js(void) {
345
365
  VALUE staged = rb_abi_export_stage;
@@ -354,8 +374,6 @@ void rb_abi_stage_rb_value_to_js(VALUE value) {
354
374
  rb_abi_export_stage = value;
355
375
  }
356
376
 
357
- #ifdef JS_ENABLE_COMPONENT_MODEL
358
-
359
377
  extern void __wasm_call_ctors(void);
360
378
  static inline void __wasm_call_ctors_if_needed(void) {
361
379
  static bool __wasm_call_ctors_done = false;
data/lib/js/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JS
2
- VERSION = "2.6.1"
2
+ VERSION = "2.6.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.1
4
+ version: 2.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuta Saito
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-22 00:00:00.000000000 Z
11
+ date: 2024-06-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: JavaScript bindings for ruby.wasm. This gem provides a way to use JavaScript
14
14
  functionalities from Ruby through WebAssembly.
@@ -52,7 +52,7 @@ licenses:
52
52
  - MIT
53
53
  metadata:
54
54
  source_code_uri: https://github.com/ruby/ruby.wasm/tree/main/packages/gems/js
55
- post_install_message:
55
+ post_install_message:
56
56
  rdoc_options: []
57
57
  require_paths:
58
58
  - lib
@@ -67,8 +67,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  requirements: []
70
- rubygems_version: 3.5.3
71
- signing_key:
70
+ rubygems_version: 3.5.9
71
+ signing_key:
72
72
  specification_version: 4
73
73
  summary: JavaScript bindings for ruby.wasm
74
74
  test_files: []