| Age | Commit message (Collapse) | Author |
|
|
|
It used to be compiled to the static string in the compiler. But the
encoding status actually depends on the runtime configuration. A new
method `Kernel#__ENCODING__` is introduced to implement the feature.
|
|
Rename `MRB_WORDBOX_USE_HEAP_FLOAT` to `MRB_WORDBOX_NO_FLOAT_TRUNCATE'.
|
|
This reverts commit 913a0a5a036664ab0d12a1af40b652412301c89f.
In some cases, `OP_HASHADD` operand may not be `Hash`. We should check
explicitly in those cases.
|
|
The invocation of `initialize` hook can cause infinite recursion too
easily. We stop invoking the method for safety, at the cost of less
flexibility.
The `initialize` methods (e.g. ones defined in `mrblib/10error.rb`) are
called only from `NoMethodError.new(args..)` forms.
|
|
|
|
|
|
|
|
|
|
- `OP_ARYPUSH` now takes operand for the number of pushing elements
- the code generator consume the stack no more than `64` for `mruby/c`
|
|
Add n elements at once. Reduces instructions for huge array
initialization. In addition, `gen_value` function in `codegen.c` was
refactored and clarified.
|
|
|
|
|
|
|
|
`acc` was used as an index of the receiver (if positive), or a flag for
methods implemented in C. We replace `regs[ci->acc]` by `ci[1].stack[0]`.
And renamed `acc` (originally meant accumulator position) to `cci`
(means callinfo for C implemented method).
|
|
The pool specified by `OP_STRING` (and `OP_SYMBOL`) should represent a
string, so that `IREP_TT_NFLAG` should be zero.
|
|
It generates a symbol by interning from the pool string.
|
|
|
|
|
|
|
|
`mrb_ro_data_p()` is available anyway.
|
|
|
|
Consistent naming: `integer` to represent integer packed in `mrb_value`
instead of `int`.
|
|
Consistent naming: `integer` to represent integer packed in `mrb_value`
instead of `inum`.
|
|
|
|
|
|
Otherwise `target_class` can be lost when it differs from `proc`'s
`target_class`, e.g. when called from `instance_eval`.
Also we should not pass `target_class` to `MRB_OBJ_ALLOC` since it
checks instance type from the class, and `target_class` may not have
proper information. ref #5272
|
|
|
|
|
|
|
|
|
|
To reduce number of string allocation.
|
|
Replace them by `mrb_ensure_string_type()`.
|
|
And merged to `mrb_f_integer()` which is only usage of the function.
|
|
They return the checking argument without modification, so the values
are already there. Maybe we should change the return type to `void` but
keep them unchanged for compatibility.
|
|
|
|
Allow `nil` for `c!` and `I!` specifiers of `mrb_get_args()`
|
|
|
|
It is `o`, `C`, `S`, `A` and `H` specifiers that are integrated.
As a side effect, the `C!` Specifier can now be used.
|
|
- Removed the `ARGV` macro.
The current path doesn't go into the mruby VM and there's also no need to separate variables.
- Use common functions to check object types.
- Use `mrb_ensure_string_type()` to check the string instead of `mrb_to_str()`.
This is for consistency with array and hash.
- Use `mrb_ensure_array_type()` to check the array instead of `to_ary()`.
- Use `mrb_ensure_hash_type()` to check the hash instead of `to_hash()`.
- Add and use `ensure_class_type()` to check class and module.
- Changed the argument index type from `mrb_int` to `int`.
Even if it is `int16_t`, it is enough.
`mrb_int` is overkill, especially if `MRB_32BIT` and `MRB_INT64` are defined.
|
|
|
|
`MRB_WORDBOX_USE_HEAP_FLOAT` instead of `MRB_USE_FLOAT_FULL_PRECISION`.
|
|
* use predefined `mrb_ro_data_p()` for user-mode Linux and macOS
* define `MRB_LINK_TIME_RO_DATA_P` if predefined one is used
* configure macro `MRB_USE_LINK_TIME_RO_DATA_P` is no longer used
* contributions for new platforms are welcome
|
|
Checks the frozen object with `mrb_get_args()`
|
|
This now works with the `+` modifier that can be added after each specifier.
- `nil` is bypassed.
- The `s` and `z` specifiers are received in C as a `const char *`, so adding a `+` modifier will raise an exception.
- The `a` specifier is received in C as `const mrb_value *`, so adding a `+` modifier will raise an exception.
- The `|`, `*`, `&`, `?` and `:` specifiers with `+` modifier raises an exception.
If `!`/`+` exceeds one for each specifier, an exception will occur in the subsequent processing.
This is the same behavior as before.
|
|
The previously used `given` variable will be merged into the `pickarg` pointer variable, which points to the argument currently being processed for each loop.
|
|
|
|
- `#include <math.h>` is done in `mruby.h`.
Eliminate the need to worry about the `MRB_NO_FLOAT` macro.
- Include mruby header files before standard header files.
If the standard header file is already placed before `mruby.h`, the standard header file added in the future tends to be placed before `mruby.h`.
This change should some reduce the chances of macros that must be defined becoming undefined in C++ or including problematic header files in a particular mruby build configuration.
|
|
|
|
Embedding reduce memory consumption, sacrificing precision. It clips least
significant 2 bits from `mrb_float`, so if you need to keep float precision,
define `MRB_USE_FLOAT_FULL_PRECISION`.
`MRB_WORD_BOXING` and `MRB_INT64`:
`mrb_float` (`double`) is embedded in `mrb_value` clipped last 2 bits.
`MRB_WORD_BOXING` and `MRB_INT64` and `MRB_USE_FLOAT_FULL_PRECISION`:
`mrb_float` is allocated in the heaps wrapped by `struct RFloat`.
`MRB_WORD_BOXING` and `MRB_INT32` and `MRB_USE_FLOAT32`:
`mrb_float` (`float`) is embedded in `mrb_value` clipped last 2 bits.
In addition, to reserve bit space in the `mrb_value`, maximum inline
symbol length become 4 (instead of 5) in the configuration.
`MRB_WORD_BOXING` and `MRB_INT32`:
Assume `MRB_USE_FLOAT_FULL_PRECISION` and allocate Float values in heap.
|