| Age | Commit message (Collapse) | Author |
|
|
|
For efficiency with `MRB_WORD_BOXING` (implement type predicate macros for
all `enum mrb_vtype`).
|
|
* mrb_sym2name -> mrb_sym_name
* mrb_sym2name_len -> mrb_sym_name_len
* mrb_sym2str -> mrb_sym_str
|
|
|
|
linked programs
In lld linked programs, .rodata comes before .text, thus mrb_ro_data_p
will return false for strings in .rodata. Change the lower bound from
_etext to __ehdr_start to catch these cases. This works for ld.bfd, gold
and lld, and it does not have false positives even if .init_array does
not exist.
Remove the branch that uses _edata: strings in .data can be modified so
this is semantically incorrect. Delete the __APPLE__ branch (its
manpages say get_etext() and get_edata() are strongly discouraged).
.init_array has been adopted by most ELF platforms to supersede .ctors.
Neither _etext nor _edata is used, so rename MRB_USE_ETEXT_EDATA to
MRB_USE_EHDR_START.
|
|
Singleton class definition do not introduce its own class variable scope
in CRuby/JRuby. So should mruby.
```
module Mod1
class << Object.new
C = 1
@@cv = 1
p Module.nesting, # => [#<Class:#<Object:0x55cb16e60a50>>, Mod1]
constants, # => [:C]
class_variables, # => []
Mod1.class_variables # => [:@@cv]
end
end
```
|
|
|
|
Also fix document about type of the first argument.
|
|
|
|
We needed to preserve the original method name somewhere. We kept it in
the `env` structure pointed from aliased methods. #1457 and #1531 tried
to address this issue. But this patch is more memory efficient.
Limitation: this fix does not support `super` from methods defined by
`define_method`. This limitation may be addressed in the future, but
it's low priority.
|
|
Fix `Fixnum#(to_s|inspect)` argument specs
|
|
Before this patch:
$ bin/mruby -e 'p 3.to_s(2)'
trace (most recent call last):
[0] -e:1
-e:1: 'to_s': wrong number of arguments (1 for 0) (ArgumentError)
After this patch:
$ bin/mruby -e 'p 3.to_s(2)'
"11"
|
|
Shrink `mrb_get_args()`
|
|
Entrust "no block given" error to `mrb_get_args()`
|
|
Fix argument specs to `Enumerable`
|
|
Some error messages will be changed.
|
|
As a side effect, all specifiers now accept the `!` modifier.
|
|
In terms of specifiers, argv is never referenced after a method call as
shown in #3090.
Reduction of object code can be expected.
If you need to refer to argv after a method call in the same loop,
update argv after the method call.
|
|
|
|
This is partial `aspec` check that only checks `MRB_ARGS_NONE()`.
|
|
|
|
|
|
|
|
|
|
In the typical case, `mrb_funcall` invocation would be skipped.
|
|
|
|
1. `$/` and other Perl-ish global variables are not defined in ISO.
2. The current Ruby policy do not encourage those variables.
3. Those variables has global effect and can cause troubles.
|
|
|
|
Unlike CRuby, there's no way to process strings byte-wise by core
methods because there's no per string encoding in mruby, so that
we moved 3 byte-wise operation methods from `mruby-string-ext` gem.
|
|
The fix was based on PR from @dearblue
|
|
|
|
|
|
Fix `mrb_vformat()` crashes with `MRB_INT16`
|
|
If `MRB_INT16` is specified, the variable length argument `mrb_int` is
converted to `int`.
|
|
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
|
|
|
|
|
|
|
|
ref: https://github.com/mruby/mruby/pull/4483#issuecomment-498001736
In this configuration, `tt` of `RBreak::val` is set into `RBreak::flags`.
|
|
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.
|
|
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.
|
|
|
|
Simplify get arguments
|
|
shuujii/rename-mrb_shared_string-len-to-mrb_shared_string-capa
Rename `mrb_shared_string::len` to `mrb_shared_string::capa`
|
|
shuujii/also-use-str_init_shared-for-orig-in-str_make_shared
Also use `str_init_shared` for `orig` in `str_make_shared()`
|
|
Because this field is used as capacity of string buffer.
|
|
|
|
- `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`.
|
|
|
|
Refactor set/unset string type flags
|