File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2424}
2525
2626# Support for compaction.
27+ have_func ( 'rb_gc_mark_movable' )
2728have_func ( 'stpcpy' )
2829have_func ( 'pthread_mutex_init' )
2930have_func ( 'rb_enc_interned_str' )
Original file line number Diff line number Diff line change 2222// #define BATCH_SIZE (4096 / sizeof(struct _leaf) - 1)
2323#define BATCH_SIZE 100
2424
25+ // Support for compaction
26+ #ifdef HAVE_RB_GC_MARK_MOVABLE
27+ #define mark rb_gc_mark_movable
28+ #else
29+ #define mark rb_gc_mark
30+ #endif
31+
2532typedef struct _batch {
2633 struct _batch * next ;
2734 int next_avail ;
@@ -684,7 +691,7 @@ static void mark_leaf(Leaf leaf) {
684691 } while (e != first );
685692 }
686693 break ;
687- case RUBY_VAL : rb_gc_mark_movable (leaf -> value ); break ;
694+ case RUBY_VAL : mark (leaf -> value ); break ;
688695
689696 default : break ;
690697 }
@@ -695,11 +702,11 @@ static void mark_doc(void *ptr) {
695702 if (NULL != ptr ) {
696703 Doc doc = (Doc )ptr ;
697704
698- rb_gc_mark_movable (doc -> self );
705+ mark (doc -> self );
699706 mark_leaf (doc -> data );
700707 }
701708}
702-
709+ #ifdef HAVE_RB_GC_MARK_MOVABLE
703710static void compact_leaf (Leaf leaf ) {
704711 switch (leaf -> value_type ) {
705712 case COL_VAL :
@@ -727,14 +734,17 @@ static void compact_doc(void *ptr) {
727734 compact_leaf (doc -> data );
728735 }
729736}
737+ #endif
730738
731739static const rb_data_type_t oj_doc_type = {
732740 "Oj/doc" ,
733741 {
734742 mark_doc ,
735743 free_doc_cb ,
736744 NULL ,
745+ #ifdef HAVE_RB_GC_MARK_MOVABLE
737746 compact_doc ,
747+ #endif
738748 },
739749 0 ,
740750 0 ,
You can’t perform that action at this time.
0 commit comments