-
-
Save methodmissing/122862 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void | |
| gc_mark(ptr, lev) | |
| VALUE ptr; | |
| int lev; | |
| { | |
| register RVALUE *obj; | |
| obj = RANY(ptr); | |
| if (rb_special_const_p(ptr)) return; /* special const not marked */ | |
| if (obj->as.basic.flags == 0) return; /* free cell */ | |
| if (obj->as.basic.flags & FL_MARK) return; /* already marked */ | |
| obj->as.basic.flags |= FL_MARK; | |
| if (lev > GC_LEVEL_MAX || (lev == 0 && ruby_stack_check())) { | |
| if (!mark_stack_overflow) { | |
| if (mark_stack_ptr - mark_stack < MARK_STACK_MAX) { | |
| *mark_stack_ptr = ptr; | |
| mark_stack_ptr++; | |
| } | |
| else { | |
| mark_stack_overflow = 1; | |
| } | |
| } | |
| return; | |
| } | |
| gc_mark_children(ptr, lev+1); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #define IMMEDIATE_MASK 0x03 | |
| #define IMMEDIATE_P(x) ((VALUE)(x) & IMMEDIATE_MASK) | |
| #define SPECIAL_CONST_P(x) (IMMEDIATE_P(x) || !RTEST(x)) | |
| static inline int | |
| #if defined(HAVE_PROTOTYPES) | |
| rb_special_const_p(VALUE obj) | |
| #else | |
| rb_special_const_p(obj) | |
| VALUE obj; | |
| #endif | |
| { | |
| if (SPECIAL_CONST_P(obj)) return Qtrue; | |
| return Qfalse; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment