summaryrefslogtreecommitdiff
path: root/src/if_ruby.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2014-02-05 22:41:15 +0100
committerBram Moolenaar <Bram@vim.org>2014-02-05 22:41:15 +0100
commita1a118b159ae9555a7fdce3d707ddc3064717067 (patch)
tree8757f8a4ec1458ef6cc4102f16ea8f106203678c /src/if_ruby.c
parent4f943c09a5f09b330d92177ab50b5dd2a7986836 (diff)
downloadvim-git-a1a118b159ae9555a7fdce3d707ddc3064717067.tar.gz
updated for version 7.4.168v7.4.168
Problem: Can't compile with Ruby 2.1.0. Solution: Add support for new GC. (Kohei Suzuki)
Diffstat (limited to 'src/if_ruby.c')
-rw-r--r--src/if_ruby.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/if_ruby.c b/src/if_ruby.c
index 44fd5ee42..9343ec8b2 100644
--- 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 <ruby.h>
#ifdef RUBY19_OR_LATER
# include <ruby/encoding.h>
@@ -373,6 +379,10 @@ static VALUE (*dll_rb_require) (const char*);
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},
};