summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2021-09-04proc.c: need to preserve `target_class` in `callinfo`.Yukihiro "Matz" Matsumoto
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
2021-09-04vm.c: remove duplicated calls of `mrb_vm_ci_target_class()`.Yukihiro "Matz" Matsumoto
2021-09-03range.c: `len = b - a` may overflow.Yukihiro "Matz" Matsumoto
2021-09-03range.c: hide internal `__num_to_a' method from backtrace.Yukihiro "Matz" Matsumoto
2021-09-01string.c: need to adjust index for UTF-8.Yukihiro "Matz" Matsumoto
2021-09-01string.c: implement `__sub_replace()` in C.Yukihiro "Matz" Matsumoto
To reduce number of string allocation.
2021-09-01mruby.h: obsolete `mrb_to_str()`.Yukihiro "Matz" Matsumoto
Replace them by `mrb_ensure_string_type()`.
2021-09-01object.c: remove `mrb_convert_to_integer()' function.Yukihiro "Matz" Matsumoto
And merged to `mrb_f_integer()` which is only usage of the function.
2021-09-01Do no use return values from `mrb_ensure_` functions.Yukihiro "Matz" Matsumoto
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.
2021-09-01mruby.h: reorganize `mrb_ensure/check` functions in headers.Yukihiro "Matz" Matsumoto
2021-08-30Merge pull request #5542 from dearblue/mrb_get_args-cIYukihiro "Matz" Matsumoto
Allow `nil` for `c!` and `I!` specifiers of `mrb_get_args()`
2021-08-28Allow `nil` for `c!` and `I!` specifiers of `mrb_get_args()`dearblue
2021-08-28Integrate the processing of similar specifiers of `mrb_get_args()`dearblue
It is `o`, `C`, `S`, `A` and `H` specifiers that are integrated. As a side effect, the `C!` Specifier can now be used.
2021-08-27Refactor the `mrb_get_args()` functiondearblue
- 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.
2021-08-26etc.c: keep full `float32` with `MRB_64BIT` and `MRB_USE_FLOAT32`.Yukihiro "Matz" Matsumoto
2021-08-26boxing_word.h: rename configuration macro name.Yukihiro "Matz" Matsumoto
`MRB_WORDBOX_USE_HEAP_FLOAT` instead of `MRB_USE_FLOAT_FULL_PRECISION`.
2021-08-26value.h: reconstruct `mrb_ro_data_p()`.Yukihiro "Matz" Matsumoto
* 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
2021-08-24Merge pull request #5535 from dearblue/get-args-frozenYukihiro "Matz" Matsumoto
Checks the frozen object with `mrb_get_args()`
2021-08-23Checks the frozen object with `mrb_get_args()`dearblue
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.
2021-08-23Integrate each element expansion process of the argumentdearblue
The previously used `given` variable will be merged into the `pickarg` pointer variable, which points to the argument currently being processed for each loop.
2021-08-23numeric.c: fix: `-0.0.abs` returned `-0.0`.Yukihiro "Matz" Matsumoto
2021-08-21Organize the include of header filesdearblue
- `#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.
2021-08-21etc.c: clear `mrb_value` if `sizeof(void*)` is bigger than `sizeof(mrb_float)`.Yukihiro "Matz" Matsumoto
2021-08-21boxing_word.h: embed `mrb_float` in `mrb_value` if possible.Yukihiro "Matz" Matsumoto
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.
2021-08-19symbol.c: reduce memory by avoiding alignment gaps.Yukihiro "Matz" Matsumoto
In additions: * use bitmap for flags * BER integer compression for length
2021-08-19gc.c: remove unused `struct`s from `RVALUE`.Yukihiro "Matz" Matsumoto
2021-08-18string.c: `mrb_str_to_cstr()` should always return a mutable string.Yukihiro "Matz" Matsumoto
2021-08-18debug.c: export integer compressing functions.Yukihiro "Matz" Matsumoto
- mrb_packed_int_len() - mrb_packed_int_encode() - mrb_packed_int_decode()
2021-08-14error.c: the error message may contain `NUL` character.Yukihiro "Matz" Matsumoto
2021-08-13Check the class with `I` specifier of `mrb_get_args()`dearblue
Previously, the `I` specifier only checked if the object was `MRB_TT_ISTRUCT`. So it was at risk of getting pointers to different C structs if multiple classes were to use the `MRB_TT_ISTRUCT` instance. Change this behavior and change the C argument corresponding to the `I` specifier to `(void *, struct RClass)`. This change is not compatible with the previous mruby. Please note that if the user uses the previous specifications, `SIGSEGV` may occur or the machine stack may be destroyed. resolve #5527
2021-08-12Revert "Drop unnecessary upper procs linked from class/module/def syntax"Yukihiro "Matz" Matsumoto
Fix #5528 This reverts commit 59201b59046b9e73c309508350cd3c0fafd20e4d; #5497
2021-08-12class.c: `const_missing` do not have to be in the backtrace; ref #5528Yukihiro "Matz" Matsumoto
2021-08-11codedump.c: print local variable name for `ADDI/SUBI/ instructions.Yukihiro "Matz" Matsumoto
Recent peephole optimization made `ADDI/SUBI` destinations possibly local variables.
2021-08-07codedump.c: print two operands `R(x)` and `R(x+1)` for clarity.Yukihiro "Matz" Matsumoto
2021-08-06numeric.c: fix a bug regarding `MRB_INT_MIN`.Yukihiro "Matz" Matsumoto
2021-08-04numeric.c: fix a bug in left shift of negative integer.Yukihiro "Matz" Matsumoto
`-1 * (1<<63)` causes overflow, but `-1<<63` is a valid value.
2021-08-03numeric.c: check zero division before modulo.Yukihiro "Matz" Matsumoto
2021-08-03Revert "numeric.c: simplifies `int_mod` definition."Yukihiro "Matz" Matsumoto
This reverts commit 3738d62a86a54524d5d7738ddbafe4700ca6a889. The change changed the behavior with floating point numbers.
2021-08-03numeric.c: simplifies `int_mod` definition.Yukihiro "Matz" Matsumoto
2021-08-03Replace `mrb_fixnum_value()` with `mrb_int_value()`.Yukihiro "Matz" Matsumoto
Use `mrb_fixnum_value()` only when you are absolutely sure that the value is within `Fixnum` range, i.e. 31 bits signed integer at least.
2021-08-03Replace `fixnum` references with `int`.Yukihiro "Matz" Matsumoto
The `Fixnum` class is no longer provided by `mruby`.
2021-08-03numeric.c: rename `fixdivmod` to `intdivmod`.Yukihiro "Matz" Matsumoto
2021-08-02numeric.c: simpler integer modulo calculation.Yukihiro "Matz" Matsumoto
2021-08-02numeric.c: use C's modulo operator if both operands are positive.Yukihiro "Matz" Matsumoto
2021-08-02numeric.c: refactor integer bit shift operations.Yukihiro "Matz" Matsumoto
2021-07-30codedump.c: instruction length should be `ilen`, not `iseq`.Yukihiro "Matz" Matsumoto
2021-07-28debug.c: uses most space efficient packed map for line information.Yukihiro "Matz" Matsumoto
2021-07-26debug.c: small refactoring.Yukihiro "Matz" Matsumoto
2021-07-26debug.c: remove type cast warnings.Yukihiro "Matz" Matsumoto
2021-07-26fmt_fp.c: add implicit cast from `mrb_float` to `int8_t`.Yukihiro "Matz" Matsumoto