summaryrefslogtreecommitdiffhomepage
path: root/src/proc.c
AgeCommit message (Collapse)Author
2015-06-29Fix a crash bug when GC is ran while creating a proc with envKouhei Sutou
mrb_proc_new_cfunc_with_env() allocates RProc with RProc::env as NULL then allocates REnv and sets it to RProc::env of the allocated RProc. If incremental GC is ran before "allocates REnv and sets it to RProc::env of the allocated RProc", the allocated RProc's GC status is "marked" (Black) and the allocated REnv's GC status is "unmarked" (White). The next incremental GC sweeps the allocated REnv without re-marking the allocated RProc. Because the RProc is Black and the REnv is White. We need to implement write barrier for the case. We can force to cause the above situation by the following patch: diff --git a/src/proc.c b/src/proc.c index f98998f..4f4e25c 100644 --- a/src/proc.c +++ b/src/proc.c @@ -92,6 +92,7 @@ mrb_proc_new_cfunc_with_env(mrb_state *mrb, mrb_func_t func, mrb_int argc, const struct REnv *e; int i; + mrb_incremental_gc(mrb); p->env = e = env_new(mrb, argc); MRB_ENV_UNSHARE_STACK(e); e->stack = (mrb_value*)mrb_malloc(mrb, sizeof(mrb_value) * argc); With this patch, "rake test" causes segmentation fault.
2015-06-23fix Proc#curry test failure; ref #2848Yukihiro "Matz" Matsumoto
2015-06-22fix arity of lambdas with optional argumentscremno
From the CRuby 2.2.2 Proc#arity documentation: If the block has optional arguments, returns -n-1, where n is the number of mandatory arguments, with the exception for blocks that are not lambdas and have only a finite number of optional arguments; in this latter case, returns n.
2015-05-22Verify that proc_lambda is passed a procCarson McDonald
2014-10-02cast MRB_ENV_STACK_LEN to (mrb_int); ref #2600Yukihiro "Matz" Matsumoto
2014-10-02Pacify MSVC warnings for numeric.c, proc.c, and symbol.cHiroshi Mimaki
2014-09-02move mrb_proc_new_cfunc_with_env() to the coreYukihiro "Matz" Matsumoto
2014-08-29Fix mismatches for MRB_API declarations.Tatsuhiko Kubo
2014-08-29revert 6c1dfc9; ref #2525 #2565Yukihiro "Matz" Matsumoto
2014-08-13need to add space for receiver to proc env; fix #2525Yukihiro "Matz" Matsumoto
2014-08-04add MRB_API modifiers to mruby API functionsYukihiro "Matz" Matsumoto
2014-07-13use C style comments instead of C++ style commentsTatsuhiko Kubo
2014-06-25Proc#arity return 0 when opcode was not OP_ENTERksss
2014-06-15arity for cfunc is not implemented yetksss
2014-06-15Proc class define before a first methodksss
mrb_define_method setting mrb->proc_class for method proc
2014-05-17Delete unnecessary semicolonJun Hiroe
2014-05-14mv opcode.h -> include/mruby/opcode.h and remove duplication from mruby-eval gemYukihiro "Matz" Matsumoto
2014-04-30adjust indentNobuyoshi Nakada
2014-04-29make cioff in struct REnv from int to ptrdiff_t; close #2149Yukihiro "Matz" Matsumoto
2014-04-15resolve conflictYukihiro "Matz" Matsumoto
2014-04-01Use MRB_ENV_STACK_LEN instead of accessing `flags` directly to get REnv's ↵take_cheeze
stack length.
2014-03-26Merge pull request #1948 from monaka/pr-remove-unused-null-checkYukihiro "Matz" Matsumoto
Remove redundant NULL checks.
2014-03-26Remove redundant NULL checks.Masaki Muranaka
mrb_malloc causes an exception when memory was empty.
2014-03-25REnv uses obj->c as env link; no superYukihiro "Matz" Matsumoto
2014-01-06adjust proc->target_class according to surrounding proc->target_class; based ↵Yukihiro "Matz" Matsumoto
on a patch from @Fleurer; close #1627
2013-12-01add mrb_intern_lit for creating symbol from string literaltake_cheeze
2013-11-29rename mrb_intern2() to mrb_intern(); huge API incompatibility; close #1513Yukihiro "Matz" Matsumoto
2013-11-08allow irep to be GCedYukihiro "Matz" Matsumoto
2013-11-07call_iseq will never be NULLYukihiro "Matz" Matsumoto
2013-11-07modified to use irep->reps to reference child ireps. preparation forYukihiro "Matz" Matsumoto
removing irep array from mrb_state. note that instructions OP_LAMBDA, OP_EXEC and OP_EPUSH are incompatible, and dumped mrb format has changed.
2013-07-12Replace mrb_intern() func with mrb_intern2() func or mrb_intern_cstr() func.Jun Hiroe
2013-06-15Merge upstreamDaniel Bovensiepen
2013-06-17Add ISO Number to ProcDaniel Bovensiepen
2013-05-20primary mruby fiber implementationYukihiro "Matz" Matsumoto
2013-04-25aspec bits should be packed in Ax; ref #1209Yukihiro "Matz" Matsumoto
2013-04-25rename every ARGS_XXX to MRB_ARGS_XXX; ref #1206Yukihiro "Matz" Matsumoto
2013-04-25rename MRB_ARGS_XXX to MRB_ASPEC_XXX; ref #1206Yukihiro "Matz" Matsumoto
2013-04-25rename ARGS_GETXXX macros to avoid potential name conflict; close #1206Yukihiro "Matz" Matsumoto
2013-04-16Add Proc#arityh2so5
2013-03-29Sort include files. Some redundant includes are removed.Masaki Muranaka
2012-12-10remove return at the bottom of void functionYukihiro Matz Matsumoto
2012-12-10Merge pull request #611 from tricknotes/stop-warning-of-procYukihiro "Matz" Matsumoto
Stop warning in compiling proc.c
2012-12-10add inline declarationYukihiro Matz Matsumoto
2012-12-10Stop warning in compiling proc.cRyunosuke SATO
proc.c:46: warning: ‘return’ with a value, in function returning void introduced in f312af11.
2012-12-10new function mrb_closure_new_cfunc(); close #609Yukihiro Matz Matsumoto
2012-10-25Use substitution instead of memset in structure initialization.Masaki Muranaka
2012-10-17no memory copy for call_iseqYukihiro Matsumoto
2012-09-03remove memleaks using linked allocatorYukihiro Matsumoto
2012-08-29remove flags from irepYukihiro Matsumoto
2012-08-04super look-up scheme fixed; close #415Yukihiro Matsumoto