Yukihiro "Matz" Matsumoto
93f5f22577
Heavily refactored how lexical scope links are implemented; fix #3821
...
Instead of `irep` links, we added a `upper` link to `struct RProc`.
To make a space for the `upper` link, we moved `target_class` reference.
If a `Proc` does not have `env`, `target_class` is saved in an `union`
shared with `env` (if a `Proc` has env, you can tell it by `MRB_PROC_ENV_P()).
Otherwise `target_class` is referenced from `env->c`. We removed links
in `env` as well.
This change removes 2 members from `mrb_irep` struct, thus saving 2
words per method/proc/block. This also fixes potential memory leaks
due to the circular references caused by a link from `mrb_irep`.
2017-10-28 00:29:30 +09:00
Tomasz Dąbrowski
9d89f8c00b
fix: mrbgems\mruby-fiber\src\fiber.c(215): warning C4244: '=': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:04 +02:00
Yukihiro "Matz" Matsumoto
a18904a4c2
Use "$!" specifier of mrb_get_args.
2017-07-12 14:49:55 +09:00
Yukihiro "Matz" Matsumoto
e8a4e4262a
Add write barrier to protect proc reference from fiber; fix #3719
2017-06-21 17:59:14 +09:00
Yukihiro "Matz" Matsumoto
ebd6636a1e
Call write barriers for stack-modified fibers; fix #3699
2017-06-15 23:20:36 +09:00
Yukihiro "Matz" Matsumoto
47bd44fce1
Prevent Fiber#initialize to be called twice; fix #3705
2017-06-15 15:16:56 +09:00
Yukihiro "Matz" Matsumoto
7e4731655f
Fixed off-by-one error in fiber_switch(); ref #3641
2017-05-26 01:24:28 +09:00
Yukihiro "Matz" Matsumoto
ac442bc1df
Raise an exception when transfer arguments are too many; fix #3641
...
The fix was proposed by @block8437. Thank you.
2017-05-25 21:39:13 +09:00
Yukihiro "Matz" Matsumoto
95229ee164
Assign to local variable first; cosmetic change.
2017-04-21 22:29:28 +09:00
Yukihiro "Matz" Matsumoto
03c849338f
Fiber#yield should check C function boundary; fix #3582
2017-04-11 01:51:25 +09:00
Yukihiro "Matz" Matsumoto
bd462c5edc
mruby-fiber: fiber_switch() to use nesting VM when it's called from C API or mrb_funcall(); close #3056
2016-01-02 13:48:45 +09:00
Yukihiro "Matz" Matsumoto
38b9c2d308
mruby-fiber: add Fiber.yield description; close #3066
...
Fiber.yield cannot be called from #initialize which is called by
mrb_funcall(). It is mruby limitation.
2015-12-31 21:25:53 +09:00
Yukihiro "Matz" Matsumoto
5c405dea3d
include changed from by quotes ("") to by brackets (<>); close #3032
2015-11-27 17:48:23 +09:00
Anton Davydov
dcc316d3b8
Fix typos in documentation and error messages [skip ci]
2015-06-19 15:52:23 +03:00
Yukihiro "Matz" Matsumoto
0609abb3f7
new API function mrb_fiber_resume(); ref #1269
2015-02-19 10:02:43 +09:00
Yukihiro "Matz" Matsumoto
80c343aec9
add description comment to mrb_fiber_yield()
2015-02-19 10:02:02 +09:00
Tatsuhiko Kubo
5fa30aeaea
Fix mismatches for MRB_API declarations.
2014-08-29 01:06:22 +09:00
Tatsuhiko Kubo
6961317fb3
Remove spaces in end-of-line.
2014-08-25 16:49:15 +09:00
Yukihiro "Matz" Matsumoto
2dcc2444fa
need to call write_barrier on every fiber context switch
2014-07-16 12:58:37 +09:00
Yukihiro "Matz" Matsumoto
d5dd3e9472
fiber stack allocation size should be bigger than irep->nregs
2014-07-15 17:17:58 +09:00
David Turnbull
249f05e7d7
Clean up value.h and mrb_value boxing
2014-07-09 06:32:11 +09:00
Yukihiro "Matz" Matsumoto
f452abd138
fiber stack should not be cleared by zero when MRB_NAN_BOXING is set; close #2439
2014-07-03 08:11:52 +09:00
Nobuyoshi Nakada
ab67c57f65
remove trailing spaces
2014-04-30 09:50:14 +09:00
Yukihiro "Matz" Matsumoto
83c1399af0
eliminate plain int except for a few cases like arena_index
2014-04-25 04:01:57 +09:00
take_cheeze
a457fef213
Remove unnecessary require 'fiber' note in Fiber.current document.
2014-04-21 22:14:23 +09:00
take_cheeze
1d6b8ba524
Add document to Fiber#transfer .
2014-04-21 22:13:39 +09:00
Takeshi Watanabe
824d3450c5
Qualify argv argument of API const.
2014-04-11 20:38:23 +09:00
take_cheeze
cad9648bde
remove unnecessary mrb_get_args in fiber_switch
2014-03-22 17:51:43 +09:00
Yukihiro "Matz" Matsumoto
da34749db0
add const qualifier to pacify warning; ref #1900
2014-03-21 23:19:07 +09:00
take_cheeze
e854a0e850
make Fiber#transfer compatible with CRuby
2014-03-21 22:10:47 +09:00
take_cheeze
d4d4f1b0d5
implement Fiber#transfer
2014-03-21 22:10:47 +09:00
take_cheeze
de65d4e2a7
make behavior of Fiber without block compatible with CRuby
2014-03-20 04:49:14 +09:00
take_cheeze
272fe3d864
use FiberError in fiber exception raise
2014-03-20 04:38:34 +09:00
take_cheeze
19c4bf6fcb
revert MRB_FIBER_RESUMED as MRB_FIBER_RESUMING to fix recurive resume
2014-03-19 01:05:21 +09:00
Yukihiro "Matz" Matsumoto
3e24e06b29
add a space after C reserved words
2014-03-18 23:57:29 +09:00
Yukihiro "Matz" Matsumoto
53a282ac0e
stricter check for double resume; close #1885
2014-03-18 23:47:01 +09:00
Yukihiro "Matz" Matsumoto
b844b96858
add Fiber#== from #1865 patch
2014-03-18 12:42:35 +09:00
Yukihiro "Matz" Matsumoto
4c690b23a6
add fiber assertion from #1865 patch
2014-03-18 12:41:51 +09:00
take_cheeze
62f05614ee
Add Fiber's double resume test and fix it.
2014-03-15 15:18:06 +09:00
Yukihiro "Matz" Matsumoto
865b850b76
should check crossing C boudary from resume
2014-03-05 15:38:13 +09:00
Yukihiro "Matz" Matsumoto
2c7204fc93
mrb_fiber_yield() is available now; you have to link mruby-fiber mrbgem to use the function; there's no function available to create new fiber from C (countapart of Lua's lua_newthread), but that's because you cannot create a new fiber from C due to mruby C API design limitation. define your method to create fibers in Ruby; close #1269
2014-03-01 00:48:08 +09:00
Yukihiro "Matz" Matsumoto
00bdaec766
initialize ci->stackent at the top; #1691
2014-02-09 19:20:16 +09:00
mattn
c850372029
Remove warning
2014-02-04 18:12:35 +09:00
Yukihiro "Matz" Matsumoto
857e384187
fibers cannot cross C function boundary; close #1680
2014-02-04 14:01:22 +09:00
Yukihiro "Matz" Matsumoto
e386760cc7
add Fiber.current
2013-11-04 23:58:32 +09:00
Yukihiro "Matz" Matsumoto
40e6cdcb5c
rename mrb_value_p() to mrb_ptr() since _p means predicate in mruby source
2013-08-07 17:39:28 +09:00
Yuichi Nishiwaki
8dc2fa3bc8
add read barrier to value.p
...
API changes:
- value.p must be accessed via mrb_value_p macro
- value.p must be mutated via MRB_SET_VALUE_P macro
2013-08-03 14:03:44 -07:00
Yukihiro "Matz" Matsumoto
6dc8c2948b
should protect resume fiber by write barrier; close #1434
2013-08-04 22:53:17 +09:00
skandhas
345ba02e4d
add Fiber#alive?
2013-05-27 15:21:56 +08:00
Yukihiro "Matz" Matsumoto
d78f23d28b
fix fiber GC problem
2013-05-26 00:37:44 +09:00