Commit Graph

69 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto bec4d30dc6 Merge branch 'reorganize-ci' of https://github.com/dearblue/mruby into dearblue-reorganize-ci 2021-01-12 18:38:42 +09:00
Yukihiro "Matz" Matsumoto a8b8d316ab Save NOARG information in struct mt_elem; fix #5257 2021-01-12 14:51:34 +09:00
dearblue ced89c25ff Unified pc and err of mrb_callinfo
This enhances self-containment.

- Changed the `mrb_callinfo::pc` field to point to itself.
  Previously it indicated the return destination of the previous call level.
  `mrb_callinfo::pc` will now hold the address to its own `proc->body.irep->iseq`.
- Removed `mrb_callinfo::err` field.
  This is because `mrb_callinfo::pc - 1` is semantically the same as the previous `err`.
- The `pc0` and `pc_save` variables in `mrb_vm_exec()` are no longer needed and have been deleted.
- It removes the argument because `cipush()` doesn't need to save the previous `pc`.
2021-01-10 13:23:43 +09:00
dearblue 58e9442737 Unified target_class and env of mrb_callinfo
If there is `env`, `env->c` means `target_class`.
2021-01-10 13:23:28 +09:00
Yukihiro "Matz" Matsumoto 12cc959998 Remove khash.h leftovers. 2021-01-09 19:09:56 +09:00
Yukihiro "Matz" Matsumoto 424afa4446 Make Proc#parameters to support keyword arguments; fix #5066
TODO: Unlike CRuby, mruby's `Proc#parameters` does not distinguish
required keyword arguments and optional keyword arguments currently.
2020-10-12 16:21:42 +09:00
Yukihiro "Matz" Matsumoto 72d071540c Rename MRB_METHOD_T_STRUCT to MRB_USE_METHOD_T_STRUCT.
It's the first change of renaming configuration options to `MRB_XXX` to
`MRB_USE_XXX` or `MRB_NO_XXX`.
2020-10-12 16:21:38 +09:00
Yukihiro "Matz" Matsumoto 52507b1083 Generate C struct from irep instead of binary dump. 2020-10-12 16:21:10 +09:00
Yukihiro "Matz" Matsumoto 5a3e014e49 Constify irep members.
- `pool`
- `syms`
- `reps`
2020-10-12 16:21:03 +09:00
dearblue 5dc87f77d4 Fixed shift width for MRB_ENV_SET_BIDX()
ref c07f24cd1 and close #5035
2020-07-16 23:11:30 +09:00
Yukihiro "Matz" Matsumoto c07f24cd18 Change flag names in preparation of REnv refactoring. 2020-06-25 06:57:41 +09:00
Yukihiro "Matz" Matsumoto 2256bb07b0 Remove MRB_METHOD_TABLE_INLINE.
`MRB_METHOD_TABLE_INLINE` was fragile. It requires `-falign-functions=n`.
On platform that uses higher bits of function pointers, you can use new
`MRB_METHOD_T_STRUCT` configuration macro.
2019-09-16 11:14:13 +09:00
Yukihiro "Matz" Matsumoto 30f3787248 Raise ArgumentError by aspec check; ref #4688
This is partial `aspec` check that only checks `MRB_ARGS_NONE()`.
2019-09-16 10:50:31 +09:00
Yukihiro "Matz" Matsumoto 2764fdf9f0 Share common definition of MRB_METHOD_FUNC_FL. 2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto 0eb9355acd Use bit shifting to pack function pointers to mrb_method_t.
So you don't need `-falign-functions=2` anymore. Instead your platform
must not use higher bits of the pointer (true for most platforms).
If not, you have to use `struct mrb_method_t` version.
2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto 743d480fba Refactor mrb_method_t. 2019-09-16 10:10:09 +09:00
Yukihiro "Matz" Matsumoto 28bbd3e7d9 Add argument names to C function prototypes. 2019-09-14 23:21:44 +09:00
David Siaw b5299b1c58 fix up documentation for values 2019-08-18 20:12:44 +09:00
KOBAYASHI Shuji ed41bbb199 Use mrb_proc_arity instead of Proc#arity call in Method#arity 2019-04-04 22:17:26 +09:00
dearblue e19353be25 Fix macro expressions with paren 2018-12-18 23:14:26 +09:00
dearblue 14133f4057 Fix macro arguments with paren 2018-12-18 23:05:36 +09:00
Yukihiro "Matz" Matsumoto 0c6353aa2c Remove MRB_API from mrb_f_send which is not API. 2018-09-01 11:01:50 +09:00
Yukihiro "Matz" Matsumoto ec1a5af719 Use LSB not MSB for MRB_METHOD_TABLE_INLINE; ref #3924 2018-01-25 14:02:38 +09:00
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