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
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
4614b9d632
remove inline from replacement memcpy&memset
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
b890528a18
Remove mrb_vm_get_argc; ref #3826
2017-10-17 15:22:45 +09:00
YAMAMOTO Masaya
81ea81e05c
Fix typo
2017-10-11 19:52:21 +09:00
YAMAMOTO Masaya
acdc2d1f24
Add MRB_WITHOUT_FLOAT
2017-10-11 17:58:11 +09:00
Tomasz Dąbrowski
be86d8b45f
correctly handle *splat arguments in mrb_get_argc, also add mrb_vm_get_argc and mrb_get_argv
...
Fixes #3825
2017-10-10 18:40:38 +02:00
Yukihiro "Matz" Matsumoto
7edbe428ca
Add new type of shared string: RSTR_FSHARED.
...
`RSTR_FSHARED` use frozen strings as shared body instead of
`struct mrb_shared_string`. This reduces allocation from
literal strings.
2017-10-01 16:24:43 +09:00
Yukihiro "Matz" Matsumoto
473b7d0efd
Cut links from irep in heaps finalization.
2017-09-29 00:18:55 +09:00
Tomasz Dąbrowski
5ede90cdf4
fix: src\vm.c(438): warning C4244: '=': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:05 +02:00
Tomasz Dąbrowski
f0c1074b07
fix: src\numeric.c(1215): warning C4244: 'function': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:05 +02:00
Tomasz Dąbrowski
971a4f9122
fix: src\kernel.c(874): warning C4244: 'function': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:05 +02:00
Tomasz Dąbrowski
3e1d60ae0b
fix: src\hash.c(27): warning C4244: '=': conversion from 'mrb_int' to 'khint_t', possible loss of data
2017-09-27 22:22:05 +02:00
Tomasz Dąbrowski
7507d46992
fix: src\array.c(86): warning C4244: '=': conversion from 'mrb_int' to 'uint32_t', possible loss of data
2017-09-27 22:22:04 +02:00
Tomasz Dąbrowski
536b95eb48
fix: mrbgems\mruby-kernel-ext\src\kernel.c(114): warning C4244: 'function': conversion from 'mrb_int' to 'int', possible loss of data
2017-09-27 22:22:04 +02:00
Tomasz Dąbrowski
f1a02dff58
fix: include\mruby/gc.h(43): warning C4200: nonstandard extension used: zero-sized array in struct/union
2017-09-27 14:42:27 +02: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
f0f4a1088a
Make the default integer size to be MRB_INT64 on 64bit systems; close #3800
...
Unless `MRB_NAN_BOXING` is specified.
2017-09-01 06:51:59 +09:00
Yukihiro "Matz" Matsumoto
f1fa5bf1c6
Remove integer type mismatch warnings from parse.y.
2017-08-28 22:31:02 +09:00
Tomasz Dąbrowski
01b9b71902
fix mrbgems/mruby-range-ext/src/range.c:142:71: error: use of undeclared identifier 'FLT_EPSILON'
2017-08-26 12:11:57 +02:00
Yukihiro "Matz" Matsumoto
43ec918be1
Remove unused mrb_obj_iv_ifnone() from API.
2017-08-26 02:01:50 +09:00
Yukihiro "Matz" Matsumoto
0c52112dd4
Keep Range class in mrb_state structure for performance.
2017-08-26 02:01:50 +09:00
Yukihiro "Matz" Matsumoto
4c9a604877
Added method cache.
...
To enable method cache, define `MRB_METHOD_CACHE` or
`MRB_METHOD_CACHE_SIZE`. The cache size must be power of 2.
The default cache size is 128.
The measurement:
I measured simple benchmarks found in benchmark/ directory. With
method cache enabled, we gained 6-8% performance improvement, with
97-99% cache hit rate.
2017-08-22 22:17:01 +09:00
Yukihiro "Matz" Matsumoto
3f90af6b42
(Try to) fix mixture of int and size_t in UTF-8 conversion.
...
This only effects VC.
2017-08-22 07:35:51 +09:00
Yukihiro "Matz" Matsumoto
8fbc4bef55
Reduce signed/unsigned comparison warnings; ref #3785
2017-08-18 22:54:59 +09:00
Yukihiro "Matz" Matsumoto
f1767fd079
Separate mrb_str_buf_new and mrb_str_new_capa.
...
`mrb_str_buf_new` is an old function that ensures capacity size of
`MRB_STR_BUF_MIN_SIZE` minimum. Usually one need to use
`mrb_str_new_capa` instead.
2017-08-18 22:17:48 +09:00
Miura Hideki
75ec86ed00
Improve Array structure
2017-08-18 20:12:00 +09:00
Yukihiro "Matz" Matsumoto
8bf492f127
Reduce integer type mismatch warnings in VC.
2017-08-12 09:35:35 +09:00
Yukihiro "Matz" Matsumoto
ef0b239704
Remove unnecessary inline function ary_elt.
...
And the function does not conform the naming convention anyway.
2017-08-11 12:57:37 +09:00