# HG changeset patch # User Bram Moolenaar # Date 1391636475 -3600 # Node ID e61a2b709f693eea9108d475b9bab5ed10ac675d # Parent 7e65f6e3c2fbb1378680c8e4945d8e11753721e7 updated for version 7.4.168 Problem: Can't compile with Ruby 2.1.0. Solution: Add support for new GC. (Kohei Suzuki) diff --git a/src/if_ruby.c b/src/if_ruby.c --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -96,6 +96,12 @@ # define rb_num2int rb_num2int_stub #endif +# if defined(DYNAMIC_RUBY_VER) && DYNAMIC_RUBY_VER >= 21 +/* Ruby 2.1 adds new GC called RGenGC and RARRAY_PTR uses + * rb_gc_writebarrier_unprotect_promoted if USE_RGENGC */ +# define rb_gc_writebarrier_unprotect_promoted rb_gc_writebarrier_unprotect_promoted_stub +# endif + #include #ifdef RUBY19_OR_LATER # include @@ -373,6 +379,10 @@ static VALUE (*dll_rb_require) (const ch static void* (*ruby_process_options)(int, char**); # endif +# if defined(USE_RGENGC) && USE_RGENGC +static void (*dll_rb_gc_writebarrier_unprotect_promoted)(VALUE); +# endif + # if defined(RUBY19_OR_LATER) && !defined(PROTO) SIGNED_VALUE rb_num2long_stub(VALUE x) { @@ -406,6 +416,13 @@ VALUE rb_num2ulong(VALUE x) # endif # endif +# if defined(USE_RGENGC) && USE_RGENGC +void rb_gc_writebarrier_unprotect_promoted_stub(VALUE obj) +{ + return dll_rb_gc_writebarrier_unprotect_promoted(obj); +} +# endif + static HINSTANCE hinstRuby = NULL; /* Instance of ruby.dll */ /* @@ -521,6 +538,9 @@ static struct # endif {"ruby_init_stack", (RUBY_PROC*)&dll_ruby_init_stack}, # endif +# if defined(USE_RGENGC) && USE_RGENGC + {"rb_gc_writebarrier_unprotect_promoted", (RUBY_PROC*)&dll_rb_gc_writebarrier_unprotect_promoted}, +# endif {"", NULL}, }; diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -739,6 +739,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 168, +/**/ 167, /**/ 166,