Commit Graph

1083 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto e8dcfe1745 Use segmented list to implement Hash [Experimental]
I know it's not hash at all, but reduce memory consumption.
2018-09-26 12:55:22 +09:00
Daniel Varga 4d5e3e1e63 Fix minor typos (#4126) 2018-09-25 09:14:01 +09:00
Yukihiro "Matz" Matsumoto 2661ac7049 Add support for iOS platforms that does not support fork; fix #4113 2018-09-16 00:41:48 +09:00
dearblue 9da9e5eb4e Fix typo for concatenate 2018-09-07 22:32:34 +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 1bc1fed534 Update RITE_BINARY_FORMAT_VER and RITE_VM_VER.
The bytecode format was updated so the header version constants must be
updated as well.
2018-08-30 22:48:05 +09:00
Yukihiro "Matz" Matsumoto f6564dd83e Add new function mrb_ensure_hash_type(); ref #4097
Unlike `mrb_check_hash_type()` that returns `nil` if the argument is
not a `Hash`, `mrb_ensure_hash_type()` raises a `TypeError` exception.
2018-08-30 22:30:36 +09:00
Yukihiro "Matz" Matsumoto 500bd38dfe uint16_t is too small for reference count; fix #4093
Use `uint32_t` instead. Theoretically `uint32_t` can overflow as well,
but I think it is sufficient size for embeddable Ruby VM.
2018-08-30 00:29:35 +09:00
Yukihiro "Matz" Matsumoto 2a88a546b2 Fix type of eidx and ridx from uint8_t to uint16_t; fix #4088
A byte was too small to hold ensure&rescue stacks indexes.
2018-08-29 13:15:24 +09:00
Yukihiro "Matz" Matsumoto 814b7b5ef8 Move back mrb_define_alias to mruby.h to avoid breakage. 2018-08-29 07:00:13 +09:00
Yukihiro "Matz" Matsumoto 471288f37d Reduce integer casting warnings. 2018-08-25 16:58:01 +09:00
Yukihiro "Matz" Matsumoto 49d1b16822 Hash splat ** should not be ignored.
Implemented by adding `OP_HASHCAT` that merges hashes.
2018-08-25 09:41:21 +09:00
Yukihiro "Matz" Matsumoto 3554fc54de Add a new function mrb_hash_merge(). 2018-08-25 09:41:21 +09:00
Kazuhiro Sera 2b2ff844a1 Fix misspelling words in comments 2018-08-25 09:19:17 +09:00
Yukihiro "Matz" Matsumoto 9409a2ff6d Rename ambiguous function names.
`mrb_iv_p` -> `mrb_iv_name_sym_p`
`mrb_iv_check` -> `mrb_iv_name_sym_check`
2018-08-25 09:17:46 +09:00
Yukihiro "Matz" Matsumoto 5e469d2b92 Remove utility functions: mrb_vm_iv_{get,set}. 2018-08-25 09:17:46 +09:00
Yukihiro "Matz" Matsumoto 4c974b9523 Small refactoring.
The macro `RCLASS_SUPER`, `RCLASS_IV_TBL` and `RCLASS_M_TBL` are
removed from `include/mruby/class.h`.
2018-08-25 09:16:01 +09:00
dearblue 322eb2328a Fix mrb_value size with MRB_WORD_BOXING on 32-bit mode 2018-08-25 09:16:01 +09:00
Yukihiro "Matz" Matsumoto 91c08d7631 Remove nregs member from mrb_callinfo.
This means reducing one word per a call frame.
2018-08-25 09:16:01 +09:00
Yukihiro "Matz" Matsumoto fd086833ff Reorganize flags values for classes; fix #3975
Renamed flag macro names as well:
`MRB_FLAG_IS_FROZEN` -> `MRB_FL_OBJ_FROZEN`
`MRB_FLAG_IS_PREPENDED` -> `MRB_FL_CLASS_IS_PREPENDED`
`MRB_FLAG_IS_ORIGIN` -> `MRB_FL_CLASS_IS_ORIGIN`
`MRB_FLAG_IS_INHERITED` -> `MRB_FL_CLASS_IS_INHERITED`
2018-08-25 09:13:09 +09:00
Yukihiro "Matz" Matsumoto beb6e5c299 Bytecode support for mrdb. 2018-07-31 17:28:42 +09:00
Yukihiro "Matz" Matsumoto 43173e1299 Removed unused instruction: OP_KDICT. 2018-07-31 03:20:00 +09:00
Yukihiro "Matz" Matsumoto 8c9e712784 Keyword argument implemented. 2018-07-30 22:58:01 +09:00
Yukihiro "Matz" Matsumoto 891839b976 New bytecode implementation of mruby VM. 2018-07-30 22:57:54 +09:00
yuri a921b936d6 move declaration of mrb_irep_remove_lv from dump.h to irep.h 2018-07-11 14:14:12 +09:00
yuri dabb20ddbb add mrbc option --remove-lv
* refactor: move `irep_remove_lv` from `mruby-bin-strip` gem to src/dump and rename to `mrb_irep_remove_lv`
* add: mrbc option `--remove-lv` to remove LVAR section
2018-07-10 01:42:33 +09:00
Kouhei Sutou e38d1d278b Export mrb_utf8_from_locale() and mrb_locale_from_utf8() 2018-06-20 11:45:15 +09:00
Yukihiro "Matz" Matsumoto ff0a4f7867 Export stack_extend function (renamed mrb_stack_extend); fix #3219
This change is required to support #4038.
2018-06-07 15:55:20 +09:00
Yukihiro "Matz" Matsumoto 59c8fdd651 Update OP_APOST description; ref #4008 2018-04-28 15:36:23 +09:00
Hiroshi Mimaki 023070a639 Set the mruby-1.4.1 release date to 2018-4-27. 2018-04-27 11:30:30 +09:00
Kouhei Sutou 0bc6c17490 Fix build error on Windows with MRB_BUILD_AS_DLL
Error message:

    C:\projects\groonga\vendor\mruby-source\include\mruby.h(1098): error C2375: 'mrb_gc_arena_save' : redefinition; different linkage [C:\projects\groonga\vendor\mruby\mruby.vcxproj]
              C:\projects\groonga\vendor\mruby-source\include\mruby.h(1083) : see declaration of 'mrb_gc_arena_save'
    C:\projects\groonga\vendor\mruby-source\include\mruby.h(1099): error C2375: 'mrb_gc_arena_restore' : redefinition; different linkage [C:\projects\groonga\vendor\mruby\mruby.vcxproj]
              C:\projects\groonga\vendor\mruby-source\include\mruby.h(1084) : see declaration of 'mrb_gc_arena_restore'
2018-04-10 15:24:41 +09:00
Yukihiro "Matz" Matsumoto ec390e8f1b Update mrb_get_args reference comment; ref #3963 2018-03-16 08:18:52 +09:00
dearblue a5ac49de30 fix && to &! in mrb_get_args() 2018-03-04 23:48:45 +09:00
dearblue 2ce6d23db6 add forced block arguments feature to mrb_get_args 2018-03-04 22:23:47 +09:00
Yukihiro "Matz" Matsumoto 10f28fc82d Add mrb_fiber_alive_p to C API. 2018-03-02 10:14:36 +09:00
Yukihiro "Matz" Matsumoto 83f2654bac Do not use MRB_METHOD_TABLE_INLINE by default; fix #3924
It was default on Linux. Abandoned for 2 reasons:

* some cross-platform compiler defines `__linux__` even on bare metal
  environment (RTL8196 (MIPS big endian soc) for example).

* some compilers do not align functions pointers so that we need to
  specify `-falign-functions=n` (where n>1). It's not suitable for
  default configuration.

By our measurement, `mrbtest` consumes 400KB less memory. So if your
target machine is memory tight, add the following command-line options
to `GCC` (unfortunately `clang` does not support `-falign-functions`).

`-falign-functions=2 -DMRB_METHOD_TABLE_INLINE`
2018-01-25 14:22:01 +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
Hiroshi Mimaki 58fb6f421a Set the mruby-1.4.0 release date to 2018-1-16. 2018-01-16 10:15:19 +09:00
Yukihiro "Matz" Matsumoto 346ebfb0ea Merge pull request #3882 from mattn/fix-filename
use filename in locale
2017-12-12 22:27:25 +09:00
Yasuhiro Matsumoto bceb6640fa fix compilation error 2017-12-12 18:52:41 +09:00
Yukihiro "Matz" Matsumoto bbb0882343 Modifying frozen objects will raise FrozenError.
`FrozenError` is a subclass of `RuntimeError` which used to be
raised.  [Ruby2.5]
2017-12-12 18:41:18 +09:00
Yukihiro "Matz" Matsumoto b00d45b095 mrb_method_search_vm() should gives the defined class.
Otherwise `super` may call a wrong method.
2017-12-06 17:28:20 +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 8b7a8978e2 Reduce the size of struct RBreak to reduce memory usage.
The old size of `struct RBreak` was 56 bytes (`MRB_NO_BOXING`)
and it's bigger than other object structures. That increase the
size of `RVALUE` thus increase the total amount of memory consumption.
2017-11-20 18:33:41 +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 6c06e77446 Add MRB_METHOD_CACHE description to include/mrbconf.h 2017-11-20 06:04:27 +09:00
Yukihiro "Matz" Matsumoto 37f6e42293 Removed redundant function prototype. 2017-11-04 17:59:00 +09:00
YAMAMOTO Masaya 625f9f6fa3 Merge branch 'master' of github.com:mruby/mruby 2017-11-04 01:23:12 +09:00
Yukihiro "Matz" Matsumoto e4662d77e7 Should not use FSHARED state for string from irep pools; fix #3829
This strings in `irep` pools may be freed forcefully in `mrb_irep_free`.
This commit probably fixes #3817 as well.
2017-11-03 08:24:47 +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