Restructure irep->outer chain; fix #3804

Instead of `irep -> proc` chain, we use `irep -> irep` chain to
avoid GC bugs like #3804. We added `target_class` reference to
`mrb_irep` struct. That means one more word consumption per `irep`.
This commit is contained in:
Yukihiro "Matz" Matsumoto
2017-09-04 06:51:31 +09:00
parent 8a5d783f2e
commit 3acaa44a70
7 changed files with 41 additions and 25 deletions
+2 -1
View File
@@ -46,7 +46,8 @@ typedef struct mrb_irep {
int ilen, plen, slen, rlen, refcnt;
struct RProc *outer; /* Refers outer scope */
struct mrb_irep *outer; /* Refers outer scope */
struct RClass *target_class;
} mrb_irep;
#define MRB_ISEQ_NO_FREE 1
-2
View File
@@ -57,8 +57,6 @@ struct RProc {
#define MRB_PROC_STRICT_P(p) (((p)->flags & MRB_PROC_STRICT) != 0)
#define MRB_PROC_ORPHAN 512
#define MRB_PROC_ORPHAN_P(p) (((p)->flags & MRB_PROC_ORPHAN) != 0)
#define MRB_PROC_CLASS 1024
#define MRB_PROC_CLASS_P(p) (((p)->flags & MRB_PROC_CLASS) != 0)
#define mrb_proc_ptr(v) ((struct RProc*)(mrb_ptr(v)))