diff options
| -rw-r--r-- | include/mruby.h | 4 | ||||
| -rw-r--r-- | include/mruby/khash.h | 2 | ||||
| -rw-r--r-- | include/mruby/value.h | 4 | ||||
| -rw-r--r-- | src/class.c | 6 | ||||
| -rw-r--r-- | src/math.c | 2 | ||||
| -rw-r--r-- | tasks/toolchains/vs2012.rake | 2 |
6 files changed, 13 insertions, 7 deletions
diff --git a/include/mruby.h b/include/mruby.h index 432595b4c..fb73b60b9 100644 --- a/include/mruby.h +++ b/include/mruby.h @@ -231,11 +231,11 @@ void mrb_gc_arena_restore(mrb_state*,int); void mrb_gc_mark(mrb_state*,struct RBasic*); #define mrb_gc_mark_value(mrb,val) do {\ if (mrb_type(val) >= MRB_TT_OBJECT) mrb_gc_mark((mrb), mrb_object(val));\ -} while (0); +} while (0) void mrb_field_write_barrier(mrb_state *, struct RBasic*, struct RBasic*); #define mrb_field_write_barrier_value(mrb, obj, val) do{\ if ((val.tt >= MRB_TT_OBJECT)) mrb_field_write_barrier((mrb), (obj), mrb_object(val));\ -} while (0); +} while (0) void mrb_write_barrier(mrb_state *, struct RBasic*); mrb_value mrb_check_convert_type(mrb_state *mrb, mrb_value val, mrb_int type, const char *tname, const char *method); diff --git a/include/mruby/khash.h b/include/mruby/khash.h index dc298baf1..9eddc0bb3 100644 --- a/include/mruby/khash.h +++ b/include/mruby/khash.h @@ -41,7 +41,7 @@ static const uint8_t __m[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80}; v |= v >> 8;\ v |= v >> 16;\ v++;\ -} while (0); +} while (0) /* declare struct kh_xxx and kh_xxx_funcs diff --git a/include/mruby/value.h b/include/mruby/value.h index ab56c9795..4e90aca9c 100644 --- a/include/mruby/value.h +++ b/include/mruby/value.h @@ -55,7 +55,7 @@ typedef struct mrb_value { #define MRB_SET_VALUE(o, ttt, attr, v) do {\ (o).tt = ttt;\ (o).attr = v;\ -} while (0); +} while (0) static inline mrb_value mrb_float_value(mrb_float f) @@ -131,7 +131,7 @@ typedef struct mrb_value { #define MRB_SET_VALUE(o, tt, attr, v) do {\ (o).ttt = mrb_mktt(tt);\ (o).attr = v;\ -} while (0); +} while (0) static inline mrb_value mrb_float_value(mrb_float f) diff --git a/src/class.c b/src/class.c index 530fc5ce4..136a07cb6 100644 --- a/src/class.c +++ b/src/class.c @@ -293,6 +293,9 @@ mrb_define_method_raw(mrb_state *mrb, struct RClass *c, mrb_sym mid, struct RPro if (!h) h = c->mt = kh_init(mt, mrb); k = kh_put(mt, h, mid); kh_value(h, k) = p; + if (p) { + mrb_field_write_barrier(mrb, (struct RBasic *)c, (struct RBasic *)p); + } } void @@ -322,6 +325,9 @@ mrb_define_method_vm(mrb_state *mrb, struct RClass *c, mrb_sym name, mrb_value b k = kh_put(mt, h, name); p = mrb_proc_ptr(body); kh_value(h, k) = p; + if (p) { + mrb_field_write_barrier(mrb, (struct RBasic *)c, (struct RBasic *)p); + } } static mrb_value diff --git a/src/math.c b/src/math.c index 3e4550946..782b75c97 100644 --- a/src/math.c +++ b/src/math.c @@ -11,7 +11,7 @@ #include <math.h> #define domain_error(msg) \ - mrb_raise(mrb, E_RANGE_ERROR, "Numerical argument is out of domain - " #msg); + mrb_raise(mrb, E_RANGE_ERROR, "Numerical argument is out of domain - " #msg) /* math functions not provided under Microsoft Visual C++ */ #ifdef _MSC_VER diff --git a/tasks/toolchains/vs2012.rake b/tasks/toolchains/vs2012.rake index 2852a5f8a..2f1a608b0 100644 --- a/tasks/toolchains/vs2012.rake +++ b/tasks/toolchains/vs2012.rake @@ -1,7 +1,7 @@ MRuby::Toolchain.new(:vs2012) do |conf| [conf.cc, conf.cxx].each do |cc| cc.command = ENV['CC'] || 'cl.exe' - cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DDISABLE_GEMS /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)] + cc.flags = [ENV['CFLAGS'] || %w(/c /nologo /W3 /D_DEBUG /MDd /Zi /Od /RTC1 /DHAVE_STRING_H /DNO_GETTIMEOFDAY /D_CRT_SECURE_NO_WARNINGS)] cc.include_paths = ["#{root}/include"] cc.defines = %w(DISABLE_GEMS) cc.option_include_path = '/I%s' |
