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
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
Yukihiro "Matz" Matsumoto
67e2dddb82
Remove mrb_ary_len function. Use RARRAY_LEN instead.
2017-08-11 12:52:36 +09:00
Yukihiro "Matz" Matsumoto
8f6b2121d9
Update document comment of array C API functions.
2017-08-11 12:51:45 +09:00
Yukihiro "Matz" Matsumoto
ae04005092
The type of ARY_EMBED_LEN should be mrb_int.
2017-08-11 12:09:37 +09:00
Christopher Aue
2fadddcd20
Replaced tabs with spaces
2017-08-09 21:56:27 +02:00
Yukihiro "Matz" Matsumoto
da24af34b9
Better class name management.
...
The change removes several internal instance variables used by
class name management. The variables `__classid__` and `__classpath__`
are no longer available. `__outer__` is used only for unnamed outer
classes/modules (and will be removed after they are named).
[Important note]
Along with this change we removed several public functions.
- mrb_class_outer_module()
- mrb_class_sym()
We believe no one have used those functions, but if you do, please
ask us for the workaround.
2017-08-01 22:25:49 +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
Christopher Aue
f937af5745
Extended Module#const_get to support class paths
2017-07-28 23:19:49 +02:00
Christopher Aue
c7018ea962
Added mrb_str_index to the mrb API
2017-07-28 21:07:20 +02:00
Yukihiro "Matz" Matsumoto
1e41026b28
Always use MRB_USE_IV_SEGLIST.
2017-07-27 16:14:03 +09:00
Yukihiro "Matz" Matsumoto
f26d00d9e8
Embed small size array elements in the heap.
...
It reduces the memory consumption and sometimes improve the
performance as well. For example, the consumed memory size
of `bench/bm_ao_render.rb` is reduced from 1.2GB to 1GB, and
its total execution time become 18.795 sec from 22.229 sec.
2017-07-27 16:13:06 +09:00
Yukihiro "Matz" Matsumoto
329938ef15
Simplify mrb_gc_arena_restore() to reduce overhead.
...
It will no longer shrink arena region. Instead `vm.c` uses
a static function `mrb_gc_arena_shrink()` to shrink.
2017-07-18 23:26:36 +09:00
Yukihiro "Matz" Matsumoto
fc666bfe20
POSFIXABLE and NEGFIXABLE should take one argument.
2017-07-11 09:02:24 +09:00
Yukihiro "Matz" Matsumoto
46dee5716f
Resurrect POSFIXABLE and NEGFIXABLE; ref 9186828
2017-07-10 09:42:48 +09:00
Yukihiro "Matz" Matsumoto
ce6c05600a
Add fallback definitions of DBL_EPSILPN and LDBL_EPSILON; fix #3733
...
This is a workaround for mingw-w64 (5.3.1) bug.
2017-07-07 22:47:49 +09:00
Yukihiro "Matz" Matsumoto
91868286be
FIXABLE_FLOAT() fails sometimes in MRB_INT64 environment.
2017-07-06 09:05:46 +09:00
Yukihiro "Matz" Matsumoto
c6bd8ceab7
Merge pull request #3726 from mruby/stable
...
mruby-1.3.0
2017-07-04 15:46:38 +09:00
Hiroshi Mimaki
277391e1b2
Set the mruby-1.3.0 release date to 2017-7-4.
2017-07-04 09:15:16 +09:00
Yukihiro "Matz" Matsumoto
aee1476ebd
Provide better way to check compile errors.
...
Now you can just call `mrb_load_*` functions then check
`context->parser_nerr > 0` if the return value is `undef`,
instead of calling `mrb_parse_*` functions independently.
ref #3248 #3331
2017-06-28 16:04:40 +09:00
Yukihiro "Matz" Matsumoto
15945e14b9
Revert "Make mrb_load_exec a static function."
...
This reverts commit 7944d9a6d4 .
Because it voids #3248 and #3331 . But we should add better way
to check whether compile errors occur without duplicated callings.
2017-06-28 16:00:59 +09:00
Yukihiro "Matz" Matsumoto
7944d9a6d4
Make mrb_load_exec a static function.
2017-06-23 17:56:12 +09:00
Yukihiro "Matz" Matsumoto
9a59cd7af8
Silence mrbmemcpy and mrbmemset warnings.
2017-06-23 17:54:02 +09:00
Yukihiro "Matz" Matsumoto
4d3027b08e
Increment the version number to 1.3.0.
2017-06-19 16:47:25 +09:00