Skip to content

Commit 3aae3b7

Browse files
committed
updated for version 7.4.168
Problem: Can't compile with Ruby 2.1.0. Solution: Add support for new GC. (Kohei Suzuki)
1 parent d09d83e commit 3aae3b7

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/if_ruby.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,12 @@
9696
# define rb_num2int rb_num2int_stub
9797
#endif
9898

99+
# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21
100+
/* Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses
101+
* rb_gc_writebarrier_unprotect_promoted if USE_RGENGC */
102+
# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub
103+
# endif
104+
99105
#include <ruby.h>
100106
#ifdef RUBY19_OR_LATER
101107
# include <ruby/encoding.h>
@@ -373,6 +379,10 @@ static VALUE (*dll_rb_require) (const char*);
373379
static void* (*ruby_process_options)(int, char**);
374380
# endif
375381

382+
# if defined(USE_RGENGC) && USE_RGENGC
383+
static void (*dll_rb_gc_writebarrier_unprotect_promoted)(VALUE);
384+
# endif
385+
376386
# if defined(RUBY19_OR_LATER) && !defined(PROTO)
377387
SIGNED_VALUE rb_num2long_stub(VALUE x)
378388
{
@@ -406,6 +416,13 @@ VALUE rb_num2ulong(VALUE x)
406416
# endif
407417
# endif
408418

419+
# if defined(USE_RGENGC) && USE_RGENGC
420+
void rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj)
421+
{
422+
return dll_rb_gc_writebarrier_unprotect_promoted(obj);
423+
}
424+
# endif
425+
409426
static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */
410427

411428
/*
@@ -520,6 +537,9 @@ static struct
520537
{"rb_ia64_bsp", (RUBY_PROC*)&dll_rb_ia64_bsp},
521538
# endif
522539
{"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack},
540+
# endif
541+
# if defined(USE_RGENGC) && USE_RGENGC
542+
{"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted},
523543
# endif
524544
{"", NULL},
525545
};

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ static char *(features[]) =
738738

739739
static int included_patches[] =
740740
{ /* Add new patch number below this line */
741+
/**/
742+
168,
741743
/**/
742744
167,
743745
/**/

0 commit comments

Comments
 (0)