Commit Graph

46 Commits

Author SHA1 Message Date
bamchoh 940133b627 Revise MRB_METHOD_PROC macro's argument
I revised MRB_METHOD_PROC macro's argument fn to m.
2017-12-05 01:22:43 +09:00
Yukihiro "Matz" Matsumoto 8f2c62407c Add MRB_METHOD_TABLE_INLINE option.
Now the method tables (in classes/modules and caches) keeps C function
pointers without wrapping in `struct RProc` objects. For the sake of
portability, `mrb_method_t` is represented by the struct and union, but
if the most significant bit of the pointer is not used by the platform,
`mrb_method_t` should be packed in `uintptr_t` to reduce memory usage.

`MRB_METHOD_TABLE_INLINE` is turned on by default for linux.
2017-11-20 18:33:41 +09:00
Yukihiro "Matz" Matsumoto b6598e052f Need to mark fibers referenced from env; fix #3837
The issue #3837 is a regression of #3819. I was mistakenly removed
a important code to mark fibers from `env`.
2017-10-31 09:10:08 +09:00
Yukihiro "Matz" Matsumoto 23d18bbd62 Add parentheses to pacify a warning. 2017-10-28 01:32:25 +09:00
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
Yukihiro "Matz" Matsumoto 14877469d1 Remove MRB_API from mrb_env_unshare() 2017-10-28 00:29:30 +09:00
Yukihiro "Matz" Matsumoto 3acaa44a70 Restructure irep->outer chain; fix #3804
Instead of `irep -> proc` chain, we use `irep -> irep` chain to
avoid GC bugs like #3804. We added `target_class` reference to
`mrb_irep` struct. That means one more word consumption per `irep`.
2017-09-04 06:51:31 +09:00
Yukihiro "Matz" Matsumoto 9e10afe1d0 Implements `Module::nesting' (15.2.2.3.2); ref #600, #3200 2017-08-01 15:37:21 +09:00
Yukihiro "Matz" Matsumoto c041206ad1 Add checks for break from proc-closure; fix #3640 2017-06-03 12:44:29 +09:00
Yukihiro "Matz" Matsumoto 5513fcee22 Keep reference to mrb_context from env; fix #3619 2017-04-22 14:35:36 +09:00
Yukihiro "Matz" Matsumoto 3531fe179c GC must scan env from fibers even when it's not yet copied to heap; fix #3063 2015-12-31 00:11:37 +09:00
Yukihiro "Matz" Matsumoto 065966dae4 common.h are supposed to be included from other header, so call it with quotes; ref #3032 2015-11-28 00:10:38 +09:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Seba Gamboa a0fe0c40b1 Remove old doxygen tags 2015-10-08 12:29:10 -03:00
Seba Gamboa 40bf7bde78 Sorting documentation grouping 2015-09-21 01:48:42 -03:00
Seba Gamboa c127614638 Setting up doxygen groups 2015-09-20 21:14:07 -03:00
Yukihiro "Matz" Matsumoto 83992ee163 cast MRB_ENV_STACK_LEN to (mrb_int); ref #2600 2014-10-02 17:59:01 +09:00
Yukihiro "Matz" Matsumoto 471c43ff96 move mrb_proc_new_cfunc_with_env() to the core 2014-09-02 13:03:32 +09:00
Tatsuhiko Kubo 5fa30aeaea Fix mismatches for MRB_API declarations. 2014-08-29 01:06:22 +09:00
Yukihiro "Matz" Matsumoto 206f89e209 add MRB_API modifiers to mruby API functions 2014-08-04 00:47:08 +09:00
ksss b0edba434c proc.h: MRB_ASPEC_REST() macro return 1 or 0
MRB_ASPEC_REST() is macro just only checks whether truthy or falsy.
And truthy means exist 1 rest argument in current proc.
2014-06-25 13:54:11 +09:00
Yukihiro "Matz" Matsumoto 2ca5bed901 make cioff in struct REnv from int to ptrdiff_t; close #2149 2014-04-29 12:25:15 +09:00
ksss 8d15ef2e89 Use bool macro KHASH_DEFINE and KHASH_DECLARE 2014-04-02 13:38:43 +00:00
take_cheeze 755ded2ef0 Use MRB_ENV_STACK_SHARED_P to check cioff field of REnv. 2014-04-01 01:53:28 +09:00
take_cheeze b38eb72d82 Add macro MRB_ENV_UNSHARE_STACK instead of assigning -1 directly. 2014-04-01 01:35:40 +09:00
take_cheeze 80534b6d14 Use MRB_ENV_STACK_LEN instead of accessing flags directly to get REnv's stack length. 2014-04-01 01:13:39 +09:00
take_cheeze bf6b1dfe21 Add API to define cfunc Proc with userdata.
The APIs are defined in mruby-proc-ext so include it before using this API.
See mruby-proc-ext's test code for usage.
This should resolve #1794.
2014-03-31 10:01:17 +09:00
Yukihiro "Matz" Matsumoto 675fd3dc80 allow send method not to call mrb_funcall if calling method is implemented in Ruby; fix #1680 ref #1765 2014-03-01 18:13:10 +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 ee14d37da4 use uint8_t for mrb_bool instead of unsigned int; close #1222 2013-04-29 11:46:16 +09:00
Yukihiro "Matz" Matsumoto 62ca4c1738 aspec bits should be packed in Ax; ref #1209 2013-04-25 12:04:29 +09:00
Yukihiro "Matz" Matsumoto ec8fad0fed remove too many paren; ref #1209 2013-04-25 11:57:51 +09:00
Yukihiro "Matz" Matsumoto 953eec60db rename MRB_ARGS_XXX to MRB_ASPEC_XXX; ref #1206 2013-04-25 08:00:48 +09:00
Yukihiro "Matz" Matsumoto 4faaef437d rename ARGS_GETXXX macros to avoid potential name conflict; close #1206 2013-04-25 07:50:01 +09:00
Jan Berdajs ab80843880 add mrb_closure_new_cfunc to header 2012-12-14 16:00:22 +01:00
Ryunosuke SATO ee0563823d Stop warning: extra ';' outside of a function 2012-11-30 22:43:53 +09:00
Kouki Ooyatsu b3a7699c2b Fix include path in proc.h. 2012-09-12 14:35:38 +09:00
Yukihiro Matsumoto 97b7eb6096 rename MRUBY_OBJECT_HEADER to MRB_OBJECT_HEADER 2012-08-18 19:05:18 +09:00
Yukihiro Matsumoto 7d02df3016 NaN boxing 2012-08-14 13:16:34 +09:00
Yukihiro Matsumoto 730f53045e define_method to copy block body 2012-08-03 20:17:04 +09:00
Yukihiro Matsumoto 396397bce1 move KHASH_DECLARE to header files 2012-06-21 11:04:36 +09:00
Yukihiro Matsumoto a4d3579e31 add extern "C" guards; close #126 2012-05-18 02:02:49 +09:00
roco 4ec6d41f16 rm whitespace 2012-04-30 14:29:19 -07:00
mimaki 835443614d add file header 2012-04-23 11:46:16 +09:00
mimaki e0d6430f63 add mruby sources 2012-04-20 09:39:03 +09:00