Yukihiro "Matz" Matsumoto
ff08856fe3
Remove implicit conversion using to_str method; fix #3854
...
We have added internal convenience method `__to_str` which
does string type check.
The issue #3854 was fixed but fundamental flaw of lack of stack
depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA`
for workaround.
2018-11-19 12:05:46 +09:00
Yukihiro "Matz" Matsumoto
afca99a40b
Remove implicit conversion using to_int method.
...
The ISO standard does not include implicit type conversion using
`to_int`. This implicit conversion often causes vulnerability.
There will be no more attacks like #4120 .
In addition, we have added internal convenience method `__to_int` which
does type check and conversion (from floats).
2018-11-19 11:28:51 +09:00
Daniel Varga
4d5e3e1e63
Fix minor typos ( #4126 )
2018-09-25 09:14:01 +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
Kazuhiro Sera
2b2ff844a1
Fix misspelling words in comments
2018-08-25 09:19:17 +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
891839b976
New bytecode implementation of mruby VM.
2018-07-30 22:57:54 +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
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
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
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
YAMAMOTO Masaya
625f9f6fa3
Merge branch 'master' of github.com:mruby/mruby
2017-11-04 01:23:12 +09:00
Yukihiro "Matz" Matsumoto
4614b9d632
remove inline from replacement memcpy&memset
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
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
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
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
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
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
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
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
9a59cd7af8
Silence mrbmemcpy and mrbmemset warnings.
2017-06-23 17:54:02 +09:00
Yukihiro "Matz" Matsumoto
bb1bfaa2fb
Add helper functions to use gdb reverse-next.
...
On my machine, gdb reverse-next does not work with memcpy and memset.
Add naive implementation of those functions to override.
2017-06-15 13:32:15 +09:00
Yukihiro "Matz" Matsumoto
788cea2b43
Revert "Simplify rescue stack management; ref #3683 "
...
This reverts commit eb5a606fe2 and
079f310fbc .
The rescue stack works differently from ensure stack, so the change
caused #3686 and #3688 . It might take long to solve the problems,
so that I would revert the changes for now. Fix #3688
2017-06-03 23:32:15 +09:00
Yukihiro "Matz" Matsumoto
eb5a606fe2
Simplify rescue stack management; ref #3683
2017-06-01 19:18:24 +09:00
Yukihiro "Matz" Matsumoto
7ff90b52d8
Simplify ensure stack management; fix #3683
2017-06-01 19:17:48 +09:00
Yukihiro "Matz" Matsumoto
9644ad51b4
Simplify backtrace mechanism; fix #3633 #3634 #3644
...
Instead of preserving a backtrace in `mrb_state`, `mrb_exc_set`
keeps packed backtrace in an exception object. `#backtrace` unpacks
it to an array of strings.
2017-05-23 23:50:42 +09:00
Yukihiro "Matz" Matsumoto
d2458e66c2
Remove class info from backtrace lines.
2017-05-23 23:50:42 +09:00
Yukihiro "Matz" Matsumoto
6a0b68f8b8
Use trampoline technique for instance_exec; ref #3359
...
A new function `mrb_yield_cont()` is provided. You have to call it
at the end of a C defined method, e.g. `return mrb_yield_cont()`.
2017-04-19 19:54:55 +09:00
Yukihiro "Matz" Matsumoto
8efa7b00df
Preallocate SystemStackError; ref #3421
2017-02-15 11:59:47 +09:00
Yukihiro "Matz" Matsumoto
30aa521854
Do not use mrb_funcall() if Hash#default is not overridden; ref #3421
...
This change reduces the recursion level, but does not solve the stack
overflow issue entirely.
2017-02-14 00:22:12 +09:00
Yukihiro "Matz" Matsumoto
44edc51612
Raises Exception if raising exception class is redefined
...
close #3384
This issue was reported by https://hackerone.com/brakhane
2017-01-11 10:29:55 +09:00
Daniel Bovensiepen
2c77dfab04
Update Copyright to 2017
...
Signed-off-by: Daniel Bovensiepen <daniel@bovensiepen.net >
2017-01-06 14:27:57 +08:00
Yukihiro "Matz" Matsumoto
9fc62d28d0
pre-allocate arena overflow error
2016-11-28 09:52:57 +09:00
Yukihiro "Matz" Matsumoto
f9f19f34dd
replace _cstr by _lit for litral C strings; ref #3300
2016-11-27 20:53:25 +09:00
Tomasz Dąbrowski
72ed7eebc3
Fixed Range.size to use proper floating point tolerance
2016-11-24 12:50:49 +01:00