diff options
author | Koichi Sasada <[email protected]> | 2020-01-08 08:20:36 +0900 |
---|---|---|
committer | Koichi Sasada <[email protected]> | 2020-02-22 09:58:59 +0900 |
commit | f2286925f08406bc857f7b03ad6779a5d61443ae (patch) | |
tree | 62d056c0a8c253f17fccd4a506ddb6cbf1f7bed5 /vm_core.h | |
parent | a1eb1fabef1bca0696449cd358d93f5a644d5914 (diff) |
VALUE size packed callinfo (ci).
Now, rb_call_info contains how to call the method with tuple of
(mid, orig_argc, flags, kwarg). Most of cases, kwarg == NULL and
mid+argc+flags only requires 64bits. So this patch packed
rb_call_info to VALUE (1 word) on such cases. If we can not
represent it in VALUE, then use imemo_callinfo which contains
conventional callinfo (rb_callinfo, renamed from rb_call_info).
iseq->body->ci_kw_size is removed because all of callinfo is VALUE
size (packed ci or a pointer to imemo_callinfo).
To access ci information, we need to use these functions:
vm_ci_mid(ci), _flag(ci), _argc(ci), _kwarg(ci).
struct rb_call_info_kw_arg is renamed to rb_callinfo_kwarg.
rb_funcallv_with_cc() and rb_method_basic_definition_p_with_cc()
is temporary removed because cd->ci should be marked.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/2888
Diffstat (limited to 'vm_core.h')
-rw-r--r-- | vm_core.h | 54 |
1 files changed, 2 insertions, 52 deletions
@@ -245,16 +245,6 @@ union iseq_inline_storage_entry { struct iseq_inline_iv_cache_entry iv_cache; }; -struct rb_call_info_kw_arg { - int keyword_len; - VALUE keywords[1]; -}; - -struct rb_call_info_with_kwarg { - struct rb_call_info ci; - struct rb_call_info_kw_arg *kw_arg; -}; - struct rb_calling_info { VALUE block_handler; VALUE recv; @@ -262,11 +252,6 @@ struct rb_calling_info { int kw_splat; }; -struct rb_kwarg_call_data { - struct rb_call_cache cc; - struct rb_call_info_with_kwarg ci_kw; -}; - struct rb_execution_context_struct; typedef VALUE (*vm_call_handler)(struct rb_execution_context_struct *ec, struct rb_control_frame_struct *cfp, struct rb_calling_info *calling, struct rb_call_data *cd); @@ -426,12 +411,7 @@ struct rb_iseq_constant_body { struct rb_iseq_struct *local_iseq; /* local_iseq->flip_cnt can be modified */ union iseq_inline_storage_entry *is_entries; - struct rb_call_data *call_data; /* A buffer for two arrays: - * struct rb_call_data calls[ci_size]; - * struct rb_kwarg_call_data kw_calls[ci_kw_size]; - * Such that: - * struct rb_kwarg_call_data *kw_calls = &body->call_data[ci_size]; - */ + struct rb_call_data *call_data; //struct rb_call_data calls[ci_size]; struct { rb_snum_t flip_count; @@ -443,7 +423,6 @@ struct rb_iseq_constant_body { unsigned int local_table_size; unsigned int is_size; unsigned int ci_size; - unsigned int ci_kw_size; unsigned int stack_max; /* for stack overflow check */ char catch_except_p; /* If a frame of this ISeq may catch exception, set TRUE */ @@ -1090,35 +1069,6 @@ enum vm_check_match_type { #define VM_CHECKMATCH_TYPE_MASK 0x03 #define VM_CHECKMATCH_ARRAY 0x04 -enum vm_call_flag_bits { - VM_CALL_ARGS_SPLAT_bit, /* m(*args) */ - VM_CALL_ARGS_BLOCKARG_bit, /* m(&block) */ - VM_CALL_FCALL_bit, /* m(...) */ - VM_CALL_VCALL_bit, /* m */ - VM_CALL_ARGS_SIMPLE_bit, /* (ci->flag & (SPLAT|BLOCKARG)) && blockiseq == NULL && ci->kw_arg == NULL */ - VM_CALL_BLOCKISEQ_bit, /* has blockiseq */ - VM_CALL_KWARG_bit, /* has kwarg */ - VM_CALL_KW_SPLAT_bit, /* m(**opts) */ - VM_CALL_TAILCALL_bit, /* located at tail position */ - VM_CALL_SUPER_bit, /* super */ - VM_CALL_ZSUPER_bit, /* zsuper */ - VM_CALL_OPT_SEND_bit, /* internal flag */ - VM_CALL__END -}; - -#define VM_CALL_ARGS_SPLAT (0x01 << VM_CALL_ARGS_SPLAT_bit) -#define VM_CALL_ARGS_BLOCKARG (0x01 << VM_CALL_ARGS_BLOCKARG_bit) -#define VM_CALL_FCALL (0x01 << VM_CALL_FCALL_bit) -#define VM_CALL_VCALL (0x01 << VM_CALL_VCALL_bit) -#define VM_CALL_ARGS_SIMPLE (0x01 << VM_CALL_ARGS_SIMPLE_bit) -#define VM_CALL_BLOCKISEQ (0x01 << VM_CALL_BLOCKISEQ_bit) -#define VM_CALL_KWARG (0x01 << VM_CALL_KWARG_bit) -#define VM_CALL_KW_SPLAT (0x01 << VM_CALL_KW_SPLAT_bit) -#define VM_CALL_TAILCALL (0x01 << VM_CALL_TAILCALL_bit) -#define VM_CALL_SUPER (0x01 << VM_CALL_SUPER_bit) -#define VM_CALL_ZSUPER (0x01 << VM_CALL_ZSUPER_bit) -#define VM_CALL_OPT_SEND (0x01 << VM_CALL_OPT_SEND_bit) - enum vm_special_object_type { VM_SPECIAL_OBJECT_VMCORE = 1, VM_SPECIAL_OBJECT_CBASE, @@ -1137,7 +1087,7 @@ enum vm_svar_index { typedef struct iseq_inline_cache_entry *IC; typedef struct iseq_inline_iv_cache_entry *IVC; typedef union iseq_inline_storage_entry *ISE; -typedef struct rb_call_info *CALL_INFO; +typedef const struct rb_callinfo *CALL_INFO; typedef struct rb_call_cache *CALL_CACHE; typedef struct rb_call_data *CALL_DATA; |