diff options
author | Koichi Sasada <[email protected]> | 2020-07-03 16:56:44 +0900 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-03 16:56:44 +0900 |
commit | a0f12a0258e4020bd657ee80b7d8f22bd33ea223 (patch) | |
tree | f6ebafa85cba2bddddc090f8d3c3b74c2c9f374b /tool/ruby_vm | |
parent | 8655c2e69041cc812d30c2e951a8ac9ea7a60c47 (diff) |
Use ID instead of GENTRY for gvars. (#3278)
Use ID instead of GENTRY for gvars.
Global variables are compiled into GENTRY (a pointer to struct
rb_global_entry). This patch replace this GENTRY to ID and
make the code simple.
We need to search GENTRY from ID every time (st_lookup), so
additional overhead will be introduced.
However, the performance of accessing global variables is not
important now a day and this simplicity helps Ractor development.
Notes
Notes:
Merged-By: ko1 <[email protected]>
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r-- | tool/ruby_vm/models/typemap.rb | 1 | ||||
-rw-r--r-- | tool/ruby_vm/views/_leaf_helpers.erb | 57 |
2 files changed, 0 insertions, 58 deletions
diff --git a/tool/ruby_vm/models/typemap.rb b/tool/ruby_vm/models/typemap.rb index c4b13f67f9..ed3aea7d2e 100644 --- a/tool/ruby_vm/models/typemap.rb +++ b/tool/ruby_vm/models/typemap.rb @@ -14,7 +14,6 @@ RubyVM::Typemap = { "..." => %w[. TS_VARIABLE], "CALL_DATA" => %w[C TS_CALLDATA], "CDHASH" => %w[H TS_CDHASH], - "GENTRY" => %w[G TS_GENTRY], "IC" => %w[K TS_IC], "IVC" => %w[A TS_IVC], "ID" => %w[I TS_ID], diff --git a/tool/ruby_vm/views/_leaf_helpers.erb b/tool/ruby_vm/views/_leaf_helpers.erb index ac60f2dcbc..2637f8777d 100644 --- a/tool/ruby_vm/views/_leaf_helpers.erb +++ b/tool/ruby_vm/views/_leaf_helpers.erb @@ -8,63 +8,6 @@ %; #line <%= __LINE__ + 1 %> <%=cstr __FILE__ %> -static bool -leafness_of_getglobal(VALUE gentry) -{ - const struct rb_global_entry *e = (void *)gentry; - - if (UNLIKELY(rb_gvar_is_traced(e))) { - return false; - } - else { - /* We cannot write this function using a switch() because a - * case label cannot be a function pointer. */ - static rb_gvar_getter_t *const allowlist[] = { - rb_gvar_val_getter, - rb_gvar_var_getter, - /* rb_gvar_undef_getter issues rb_warning() */ - }; - rb_gvar_getter_t *f = rb_gvar_getter_function_of(e); - int i; - - for (i = 0; i < numberof(allowlist); i++) { - if (f == allowlist[i]) { - return true; - } - } - return false; - } -} - -static bool -leafness_of_setglobal(VALUE gentry) -{ - const struct rb_global_entry *e = (void *)gentry; - - if (UNLIKELY(rb_gvar_is_traced(e))) { - return false; - } - else { - /* We cannot write this function using a switch() because a - * case label cannot be a function pointer. */ - static rb_gvar_setter_t *const allowlist[] = { - rb_gvar_val_setter, - /* rb_gvar_readonly_setter issues rb_name_error() */ - rb_gvar_var_setter, - rb_gvar_undef_setter, - }; - rb_gvar_setter_t *f = rb_gvar_setter_function_of(e); - int i; - - for (i = 0; i < numberof(allowlist); i++) { - if (f == allowlist[i]) { - return true; - } - } - return false; - } -} - #include "iseq.h" static bool |