-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master' into Ractor-Local-GC-v…
…ersion-2
- Loading branch information
Showing
89 changed files
with
1,639 additions
and
671 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create_makefile('-test-/load/resolve_symbol_resolver') |
50 changes: 50 additions & 0 deletions
50
ext/-test-/load/resolve_symbol_resolver/resolve_symbol_resolver.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include <ruby.h> | ||
#include "ruby/internal/intern/load.h" | ||
|
||
typedef VALUE(*target_func)(VALUE); | ||
|
||
static target_func rst_any_method; | ||
|
||
VALUE | ||
rsr_any_method(VALUE klass) | ||
{ | ||
return rst_any_method((VALUE)NULL); | ||
} | ||
|
||
VALUE | ||
rsr_try_resolve_fname(VALUE klass) | ||
{ | ||
target_func rst_something_missing = | ||
(target_func) rb_ext_resolve_symbol("-test-/load/resolve_symbol_missing", "rst_any_method"); | ||
if (rst_something_missing == NULL) { | ||
// This should be done in Init_*, so the error is LoadError | ||
rb_raise(rb_eLoadError, "symbol not found: missing fname"); | ||
} | ||
return Qtrue; | ||
} | ||
|
||
VALUE | ||
rsr_try_resolve_sname(VALUE klass) | ||
{ | ||
target_func rst_something_missing = | ||
(target_func)rb_ext_resolve_symbol("-test-/load/resolve_symbol_target", "rst_something_missing"); | ||
if (rst_something_missing == NULL) { | ||
// This should be done in Init_*, so the error is LoadError | ||
rb_raise(rb_eLoadError, "symbol not found: missing sname"); | ||
} | ||
return Qtrue; | ||
} | ||
|
||
void | ||
Init_resolve_symbol_resolver(void) | ||
{ | ||
VALUE mod = rb_define_module("ResolveSymbolResolver"); | ||
rb_define_singleton_method(mod, "any_method", rsr_any_method, 0); | ||
rb_define_singleton_method(mod, "try_resolve_fname", rsr_try_resolve_fname, 0); | ||
rb_define_singleton_method(mod, "try_resolve_sname", rsr_try_resolve_sname, 0); | ||
|
||
rst_any_method = (target_func)rb_ext_resolve_symbol("-test-/load/resolve_symbol_target", "rst_any_method"); | ||
if (rst_any_method == NULL) { | ||
rb_raise(rb_eLoadError, "resolve_symbol_target is not loaded"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create_makefile('-test-/load/resolve_symbol_target') |
15 changes: 15 additions & 0 deletions
15
ext/-test-/load/resolve_symbol_target/resolve_symbol_target.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <ruby.h> | ||
#include "resolve_symbol_target.h" | ||
|
||
VALUE | ||
rst_any_method(VALUE klass) | ||
{ | ||
return rb_str_new_cstr("from target"); | ||
} | ||
|
||
void | ||
Init_resolve_symbol_target(void) | ||
{ | ||
VALUE mod = rb_define_module("ResolveSymbolTarget"); | ||
rb_define_singleton_method(mod, "any_method", rst_any_method, 0); | ||
} |
4 changes: 4 additions & 0 deletions
4
ext/-test-/load/resolve_symbol_target/resolve_symbol_target.def
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
LIBRARY resolve_symbol_target | ||
EXPORTS | ||
Init_resolve_symbol_target | ||
rst_any_method |
4 changes: 4 additions & 0 deletions
4
ext/-test-/load/resolve_symbol_target/resolve_symbol_target.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include <ruby.h> | ||
#include "ruby/internal/dllexport.h" | ||
|
||
RUBY_EXTERN VALUE rst_any_method(VALUE); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create_makefile('-test-/load/stringify_symbols') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#include <ruby.h> | ||
#include "ruby/internal/intern/load.h" | ||
#include "ruby/util.h" | ||
|
||
#if SIZEOF_INTPTR_T == SIZEOF_LONG_LONG | ||
# define UINTPTR2NUM ULL2NUM | ||
#elif SIZEOF_INTPTR_T == SIZEOF_LONG | ||
# define UINTPTR2NUM ULONG2NUM | ||
#else | ||
# define UINTPTR2NUM UINT2NUM | ||
#endif | ||
|
||
static VALUE | ||
stringify_symbol(VALUE klass, VALUE fname, VALUE sname) | ||
{ | ||
void *ptr = rb_ext_resolve_symbol(StringValueCStr(fname), StringValueCStr(sname)); | ||
if (ptr == NULL) { | ||
return Qnil; | ||
} | ||
uintptr_t uintptr = (uintptr_t)ptr; | ||
return UINTPTR2NUM(uintptr); | ||
} | ||
|
||
void | ||
Init_stringify_symbols(void) | ||
{ | ||
VALUE mod = rb_define_module("StringifySymbols"); | ||
rb_define_singleton_method(mod, "stringify_symbol", stringify_symbol, 2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create_makefile('-test-/load/stringify_target') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#include <ruby.h> | ||
#include "stringify_target.h" | ||
|
||
VALUE | ||
stt_any_method(VALUE klass) | ||
{ | ||
return rb_str_new_cstr("from target"); | ||
} | ||
|
||
void | ||
Init_stringify_target(void) | ||
{ | ||
VALUE mod = rb_define_module("StringifyTarget"); | ||
rb_define_singleton_method(mod, "any_method", stt_any_method, 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
LIBRARY stringify_target | ||
EXPORTS | ||
Init_stringify_target | ||
stt_any_method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#include <ruby.h> | ||
#include "ruby/internal/dllexport.h" | ||
|
||
RUBY_EXTERN VALUE stt_any_method(VALUE); |
Oops, something went wrong.