Commit Graph

378 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto b5e2d208b9 Merge pull request #4636 from davidsiaw/doxygen
Generate doxygen docs for mruby
2019-08-19 07:29:46 +09:00
David Siaw b5299b1c58 fix up documentation for values 2019-08-18 20:12:44 +09:00
dearblue 279c21b816 Prohibit changes to iseq in principle 2019-08-18 15:00:32 +09:00
Yukihiro "Matz" Matsumoto b377b7d580 Update mrb_to_str and related functions.
Contrary to the name, `mrb_to_str` just checks type, no conversion.
2019-08-07 16:20:40 +09:00
KOBAYASHI Shuji d915261590 Refine document to mrb_get_args()` [ci skip] 2019-07-03 20:41:30 +09:00
Yukihiro "Matz" Matsumoto 2b81ea7ec1 Add mrb_alloca again; ref #4470
This time, the allocated memory comes from the string object, which is
referenced from GC arena. The memory region will be reclaimed when the C
function called from VM is terminated, or the GC arena is restored.
2019-05-29 11:47:12 +09:00
dearblue d1e1bb0d5b Remove mrb_alloca() function
When I found this function, I expected it to behave the same as the
`alloca(3)` function, but it is accually the `mrb_alloca()` function
does not free the heap until the `mrb_close()` function is called.

Also, even if it is deleted, it can be replaced with the combination
of the `MRB_TT_DATA` object and the `mrb_gv_set()` function if it is
sure necessary.
2019-05-25 23:59:43 +09:00
Yukihiro "Matz" Matsumoto f83112cea2 Fixed include specifier format for mruby/common.h. 2019-05-02 22:55:19 +09:00
Yukihiro "Matz" Matsumoto 0c5f26e0ff Remove unnecessary mrb_regexp_check() and related functions. 2019-04-24 11:43:05 +09:00
dearblue 6907e97fa1 Change modifier to MRB_INLINE from static inline 2019-04-19 22:24:22 +09:00
Yukihiro "Matz" Matsumoto 88ac7549c0 Remove MRB_API from mrb_instance_new. 2019-04-10 19:11:35 +09:00
Yukihiro "Matz" Matsumoto d0b30f4ce2 Merge pull request #4367 from shuujii/extract-frozen-checking-to-function
Extract frozen checking to function
2019-04-10 06:03:32 +09:00
KOBAYASHI Shuji e3beef065c Extract frozen checking to function 2019-04-09 18:23:11 +09:00
KOBAYASHI Shuji f89fe04d54 Remove unneeded function prototypes 2019-04-08 22:34:49 +09:00
Hiroshi Mimaki 7c91efc1ff Update version and release date.
`mruby 2.0.1 (2019-4-4)`
2019-04-04 09:26:40 +09:00
Tomoyuki Sahara d8d59f70c1 va_list is defined in stdarg.h.
fixes build on OpenBSD.
2019-03-29 11:55:04 +09:00
Yukihiro "Matz" Matsumoto c2660b8111 Fix missing MRB_API prefix for functions below; clse #4267
Functions to add prototypes to headers:
* mrb_ary_splice()
* mrb_notimplement()
* mrb_vformat()
* mrb_cstr_to_dbl()
* mrb_cstr_to_inum()

Functions to be made `static` (`MRB_API` was not needed):
* mrb_mod_module_function()
* mrb_obj_hash()
* mrb_str_len_to_inum()

Functions to remove `MRB_API` from definitions (referenced from within `libmruby`):
* mrb_mod_cv_defined()
* mrb_mod_cv_get()
* mrb_f_send()
2019-03-26 10:23:52 +09:00
yui-knk f614eed13a Fix typos 2019-02-17 21:34:33 +09:00
Yukihiro "Matz" Matsumoto 06ba5905f0 Implement inline packed symbols.
Small symbols with all alphanumeric characters (<5) are packed in 32bit
symbol integer a la base64. This means those small symbols are not
listed in `Symbol.all_symbols`.
2019-02-12 17:30:34 +09:00
Yukihiro "Matz" Matsumoto d52f46da45 Implement symbol hash table to boost find_symbol.
In 4174e02, we removed the symbol hash table from `mrb_state` but
`find_symbol` was too slow with linear search. My performance estimation
was wrong. So we implemented a new compact hash table for symbols.
2019-02-06 22:07:11 +09:00
Yukihiro "Matz" Matsumoto 02fbb2c211 Remove symbol hash table from mrb_state structure.
Use linear search instead. Number of symbols is usually small (<1K), so
we don't need performance boost from hash tables. In our benchmark
measurement, hash tables consumes 790KB for `build/full-debug/mrbtest`.
2019-02-06 22:07:11 +09:00
dearblue 49cce74c1a Suppress __STDC_VERSION__ warns for C++ 2018-12-23 17:22:59 +09:00
dearblue 14133f4057 Fix macro arguments with paren 2018-12-18 23:05:36 +09:00
Yukihiro "Matz" Matsumoto 86d102350b Restrict total recursion number of ecall(); fix #3789 2018-11-20 09:14:34 +09:00
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