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 /gc.c | |
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 'gc.c')
-rw-r--r-- | gc.c | 25 |
1 files changed, 23 insertions, 2 deletions
@@ -106,6 +106,7 @@ #include "symbol.h" #include "transient_heap.h" #include "vm_core.h" +#include "vm_callinfo.h" #include "builtin.h" @@ -2892,6 +2893,9 @@ obj_free(rb_objspace_t *objspace, VALUE obj) case imemo_parser_strterm: RB_DEBUG_COUNTER_INC(obj_imemo_parser_strterm); break; + case imemo_callinfo: + RB_DEBUG_COUNTER_INC(obj_imemo_callinfo); + break; default: /* unreachable */ break; @@ -5202,7 +5206,10 @@ gc_mark_ptr(rb_objspace_t *objspace, VALUE obj) if (LIKELY(objspace->mark_func_data == NULL)) { rgengc_check_relation(objspace, obj); if (!gc_mark_set(objspace, obj)) return; /* already marked */ - if (RB_TYPE_P(obj, T_NONE)) rb_bug("try to mark T_NONE object"); /* check here will help debugging */ + if (RB_TYPE_P(obj, T_NONE)) { + rp(obj); + rb_bug("try to mark T_NONE object"); /* check here will help debugging */ + } gc_aging(objspace, obj); gc_grey(objspace, obj); } @@ -5326,6 +5333,8 @@ gc_mark_imemo(rb_objspace_t *objspace, VALUE obj) case imemo_parser_strterm: rb_strterm_mark(obj); return; + case imemo_callinfo: + return; #if VM_CHECK_MODE > 0 default: VM_UNREACHABLE(gc_mark_imemo); @@ -8119,6 +8128,7 @@ gc_ref_update_imemo(rb_objspace_t *objspace, VALUE obj) break; case imemo_parser_strterm: case imemo_tmpbuf: + case imemo_callinfo: break; default: rb_bug("not reachable %d", imemo_type(obj)); @@ -11595,6 +11605,7 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) IMEMO_NAME(tmpbuf); IMEMO_NAME(ast); IMEMO_NAME(parser_strterm); + IMEMO_NAME(callinfo); #undef IMEMO_NAME default: UNREACHABLE; } @@ -11621,6 +11632,16 @@ rb_raw_obj_info(char *buff, const int buff_size, VALUE obj) rb_raw_iseq_info(BUFF_ARGS, iseq); break; } + case imemo_callinfo: + { + const struct rb_callinfo *ci = (const struct rb_callinfo *)obj; + APPENDF((BUFF_ARGS, "(mid:%s, flag:%x argc:%d, kwarg:%s)", + rb_id2name(vm_ci_mid(ci)), + vm_ci_flag(ci), + vm_ci_argc(ci), + vm_ci_kwarg(ci) ? "available" : "NULL")); + break; + } default: break; } @@ -11676,7 +11697,7 @@ rb_obj_info_dump(VALUE obj) fprintf(stderr, "rb_obj_info_dump: %s\n", rb_raw_obj_info(buff, 0x100, obj)); } -void +MJIT_FUNC_EXPORTED void rb_obj_info_dump_loc(VALUE obj, const char *file, int line, const char *func) { char buff[0x100]; |