diff options
author | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-05-29 16:04:53 +0900 |
---|---|---|
committer | 卜部昌平 <shyouhei@ruby-lang.org> | 2020-06-09 09:52:46 +0900 |
commit | 8f3d4090f037ae35fc9ba6380ee284aec837201f (patch) | |
tree | fcdc79400e8c8f05d99e018bde2f3002b3fa2c08 /vm.c | |
parent | 77293cef91a9aa424c086ae05f03211d9a8a87d3 (diff) | |
download | ruby-8f3d4090f037ae35fc9ba6380ee284aec837201f.tar.gz |
rb_equal_opt: fully static call data
This changeset reduces the generated binary of rb_equal_opt from 129 bytes
to 17 bytes on my machine, according to nm(1).
Diffstat (limited to 'vm.c')
-rw-r--r-- | vm.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -386,7 +386,13 @@ rb_serial_t ruby_vm_global_method_state = 1; rb_serial_t ruby_vm_global_constant_state = 1; rb_serial_t ruby_vm_class_serial = 1; -static const struct rb_callcache *vm_empty_cc; +static const struct rb_callcache vm_empty_cc = { + .flags = (T_IMEMO | (imemo_callcache << FL_USHIFT) | VM_CALLCACHE_UNMARKABLE), + .klass = Qfalse, + .cme_ = NULL, + .call_ = vm_call_general, + .aux_.v = 0, +}; static void thread_free(void *ptr); @@ -3424,10 +3430,6 @@ Init_vm_objects(void) vm->frozen_strings = st_init_table_with_size(&rb_fstring_hash_type, 10000); rb_objspace_gc_enable(vm->objspace); - - vm_empty_cc = vm_cc_new(0, NULL, vm_call_general); - FL_SET_RAW((VALUE)vm_empty_cc, VM_CALLCACHE_UNMARKABLE); - rb_gc_register_mark_object((VALUE)vm_empty_cc); } /* top self */ @@ -3799,7 +3801,7 @@ vm_collect_usage_register(int reg, int isset) MJIT_FUNC_EXPORTED const struct rb_callcache * rb_vm_empty_cc(void) { - return vm_empty_cc; + return &vm_empty_cc; } #endif /* #ifndef MJIT_HEADER */ |