summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2019-09-09Fix `mod.constants` not to have duplicate constant names; #4698Yukihiro "Matz" Matsumoto
The fix was based on PR from @dearblue
2019-09-09Remove duplication of `BasicObject` constant; fix #4698Yukihiro "Matz" Matsumoto
2019-09-09Fix `Class.new` argument specsKOBAYASHI Shuji
2019-09-08Merge pull request #4695 from dearblue/promote-to-intYukihiro "Matz" Matsumoto
Fix `mrb_vformat()` crashes with `MRB_INT16`
2019-09-08Fix `mrb_vformat()` crashes with `MRB_INT16`dearblue
If `MRB_INT16` is specified, the variable length argument `mrb_int` is converted to `int`.
2019-09-07Revert part of #4225Yukihiro "Matz" Matsumoto
Since in mruby, Integer and Float interchange frequently (mostly on overflow), so adding explicit `.0` can cause problems sometimes. For example: https://github.com/mattn/mruby-json/pull/40 https://github.com/pepabo/mruby-msd/pull/13 https://github.com/mattn/mruby-json/pull/42
2019-09-04Fix argument specs to `BasicObject`KOBAYASHI Shuji
2019-08-26fix lots of warnings and make logo not so bigDavid Siaw
2019-08-24Suppress warning by gcc with `-Wmaybe-uninitialized`dearblue
2019-08-23Fix `RBreak` exceeding 6 words on 32-bit mode w/o boxing and `MRB_USE_FLOAT`KOBAYASHI Shuji
ref: https://github.com/mruby/mruby/pull/4483#issuecomment-498001736 In this configuration, `tt` of `RBreak::val` is set into `RBreak::flags`.
2019-08-21Prioritize embedded string over nofree (or normal) stringKOBAYASHI Shuji
Prioritize embedded string in the following functions: - `str_new_static` - `str_new` - `mrb_str_new_capa` - `mrb_str_pool` The reasons are as follows: - Consistency with `mrb_str_byte_subseq` and `str_replace`. - Memory locality increases and may be slightly faster. - No conversion cost to embedded string when modifying the string.
2019-08-20Use `RBasic` padding for embedded string on 64-bit CPUKOBAYASHI Shuji
On 64-bit CPU, there is padding in `RBasic`, so reorder the fields and use it as buffer of embedded string. This change allows 4 more bytes to be embedded on 64-bit CPU. However, an incompatibility will occur if `RString::as::ary` is accessed directly because `RString` structure has changed.
2019-08-19Move `mrb_str_pool` to `src/string.c` to use `str_init` familyKOBAYASHI Shuji
2019-08-19Merge pull request #4638 from dearblue/simplify-get-argsYukihiro "Matz" Matsumoto
Simplify get arguments
2019-08-19Merge pull request #4641 from ↵Yukihiro "Matz" Matsumoto
shuujii/rename-mrb_shared_string-len-to-mrb_shared_string-capa Rename `mrb_shared_string::len` to `mrb_shared_string::capa`
2019-08-19Merge pull request #4640 from ↵Yukihiro "Matz" Matsumoto
shuujii/also-use-str_init_shared-for-orig-in-str_make_shared Also use `str_init_shared` for `orig` in `str_make_shared()`
2019-08-18Rename `mrb_shared_string::len` to `mrb_shared_string::capa`KOBAYASHI Shuji
Because this field is used as capacity of string buffer.
2019-08-18Also use `str_init_shared` for `orig` in `str_make_shared()`KOBAYASHI Shuji
2019-08-18Simplify get argumentsdearblue
- `mrb_str_index_m()` and `mrb_str_rindex()` Make `mrb_get_args()` called only once from called twice. - `mrb_str_byteslice()` Replace `goto` with `if ~ else`.
2019-08-18Prohibit changes to iseq in principledearblue
2019-08-17Merge pull request #4634 from shuujii/refactor-set-unset-string-type-flagsYukihiro "Matz" Matsumoto
Refactor set/unset string type flags
2019-08-17Refactor set/unset string type flagsKOBAYASHI Shuji
Introduce `RSTR_SET_TYPE_FLAG` macro to set the specified string type flag and clear the others.
2019-08-17Merge pull request #4625 from dearblue/rindex-broken-utf8Yukihiro "Matz" Matsumoto
Fix `String#rindex` with invalid UTF-8 string
2019-08-17Implement `Array#each` using inline mruby bytecode.Yukihiro "Matz" Matsumoto
2019-08-17Fix `String#rindex` with invalid UTF-8 stringdearblue
Previously `String#rindex` returned the wrong index when given an invalid UTF-8 string. ```terminal % ruby26 -e 'str = "\xf0☀\xf1☁\xf2☂\xf3☃\xf0☀\xf1☁\xf2☂\xf3☃"; p str.rindex("☁")' 11 % ./mruby-head -e 'str = "\xf0☀\xf1☁\xf2☂\xf3☃\xf0☀\xf1☁\xf2☂\xf3☃"; p str.rindex("☁")' nil % ./mruby-patched -e 'str = "\xf0☀\xf1☁\xf2☂\xf3☃\xf0☀\xf1☁\xf2☂\xf3☃"; p str.rindex("☁")' 11 ```
2019-08-17Stop using `mrb_to_str` as a converter (it is not).Yukihiro "Matz" Matsumoto
2019-08-17Avoid `mrb_funcall` from `Class#new` when no overloading.Yukihiro "Matz" Matsumoto
2019-08-16Merge pull request #4633 from ↵Yukihiro "Matz" Matsumoto
shuujii/shared-fshared-string-is-not-required-when-sharing-nofree-string SHARED/FSHARED string is not required when sharing NOFREE string
2019-08-16Optimize bytecode for `Class#new`.Yukihiro "Matz" Matsumoto
2019-08-16Implement `Class#new` using inline mruby bytecode.Yukihiro "Matz" Matsumoto
2019-08-16SHARED/FSHARED string is not required when sharing NOFREE stringKOBAYASHI Shuji
I think the string buffer of NOFREE string always exists and does not need to be released, so it can be shared as another NOFREE string. Also changed the `mrb_shared_string` field order so that eliminate padding if `int` and `mrb_int` sizes are less than pointer size.
2019-08-16Avoid creating unnecessary empty arrays on splat.Yukihiro "Matz" Matsumoto
But this changes requires `OP_ARYCAT` and `OP_ARYPUSH` to accept `nil` as their first operand. Alternative VMs (e.g. `mruby/c`) that understand mruby bytecode need to be updated.
2019-08-16Stop raising exceptions from `undef` C API.Yukihiro "Matz" Matsumoto
Some `undef' functions may be called before initialization, thus causes infinite error recursion.
2019-08-15Remove unneeded `#include` in `src/string.c`KOBAYASHI Shuji
2019-08-14Extract initialization code of shared and fshared string to functionKOBAYASHI Shuji
2019-08-14Avoid array copying in `mrb_instance_new`.Yukihiro "Matz" Matsumoto
2019-08-14Integrate `kazuho/mruby-class-new-fiber-safe` in the master.Yukihiro "Matz" Matsumoto
Avoid calling `initialize` via `mrb_funcall`, which cause `cross C boundary` error from Fibers started in the method.
2019-08-14Small refactoring on #4630Yukihiro "Matz" Matsumoto
2019-08-14Remove `MRB_API` from functions only called from `vm.c`.Yukihiro "Matz" Matsumoto
* `mrb_vm_define_class` * `mrb_vm_define_module` Only functions called from user code requires `MRB_API`.
2019-08-13Extract `struct RString` initialization code to functionKOBAYASHI Shuji
2019-08-12`mrb_str_pool` can embed one more byte; ref #4626KOBAYASHI Shuji
2019-08-12Merge pull request #4626 from ↵Yukihiro "Matz" Matsumoto
shuujii/mrb_str_modify_keep_ascii-can-embed-one-more-byte `mrb_str_modify_keep_ascii` can embed one more byte
2019-08-12Replacing region may overwrap with the target region; fix #4627Yukihiro "Matz" Matsumoto
2019-08-11Revert "Should have cleared `mrb->globals` in `mrb_gc_free_gv`; fix #4618"Yukihiro "Matz" Matsumoto
This reverts commit 3dc8d9d7b3d0be2f91fa050a13e3b422500df628.
2019-08-11Reorder finalization to avoid potential crash; ref #4618Yukihiro "Matz" Matsumoto
`mrb_gc_destroy` may call other mruby API functions from the finalizers. So call that function first.
2019-08-11Add `NUL` always to short strings; ref 98fc887Yukihiro "Matz" Matsumoto
2019-08-11`mrb_str_modify_keep_ascii` can embed one more byteKOBAYASHI Shuji
The condition to make an embedded string was incorrect. Because there were several similar codes, extracted into `RSTR_EMBEDDABLE_P` macro.
2019-08-07Update `mrb_to_str` and related functions.Yukihiro "Matz" Matsumoto
Contrary to the name, `mrb_to_str` just checks type, no conversion.
2019-08-07Reorganize `mrb_string_value_cstr` and related functions.Yukihiro "Matz" Matsumoto
`mrb_string_value_cstr` and `mrb_string_value_len`: obsolete `mrb_string_cstr`: new function to retrieve NULL terminated C string `RSTRING_CSTR`: wrapper macro of `mrb_string_cstr`
2019-08-06Add `mrb_noreturn` to `cmperr()` in `src/numeric.c`KOBAYASHI Shuji