summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
AgeCommit message (Collapse)Author
2021-09-12parse.y: fix `nint` (int to node) and `intn` (node to int).Yukihiro "Matz" Matsumoto
2021-09-12parse.y: avoid adding zero length strings.Yukihiro "Matz" Matsumoto
2021-09-10codegen.c: fixed `gen_setxv` bug with taking assignment value; fix #5550Yukihiro "Matz" Matsumoto
2021-09-10codegen.c: `gen_move` refactoring.Yukihiro "Matz" Matsumoto
2021-09-10mruby.h: remove `acc` from `callinfo`; add `cci` instead.Yukihiro "Matz" Matsumoto
`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).
2021-09-10ops.h: add `OP_SYMBOL` instruction.Yukihiro "Matz" Matsumoto
It generates a symbol by interning from the pool string.
2021-09-10fixup! codegen.c: resurrect `s->lastpc` to reduce `iseq` scans.Yukihiro "Matz" Matsumoto
2021-09-10codegen.c: resurrect `s->lastpc` to reduce `iseq` scans.Yukihiro "Matz" Matsumoto
When parsing scripts frequent scans could cost too much.
2021-09-07object.c: rename `mrb_to_int` to `mrb_to_integer`.Yukihiro "Matz" Matsumoto
Consistent naming: `integer` to represent integer packed in `mrb_value` instead of `int`.
2021-09-07string.h: rename `mrb_str_to_inum` to `mrb_str_to_integer`.Yukihiro "Matz" Matsumoto
Consistent naming: `integer` to represent integer packed in `mrb_value` instead of `inum`.
2021-09-07eval.c: if the parser raises an exception without an error messageYukihiro "Matz" Matsumoto
`eval` would have crashed in formatting.
2021-09-07eval.c: check length of the file name.Yukihiro "Matz" Matsumoto
It should be lexx than `UINT16_MAX`. If you don't check here, the parser would raise an exception.
2021-09-07codegen.c: improve exception handling in `generate_code`.Yukihiro "Matz" Matsumoto
- remove `mrb_jmpbuf` from `codegen_scope` - unify exception handling of `mrb_state` and `codegen_scope`
2021-09-07parse.y: refactor `mrb_parser_parse()`.Yukihiro "Matz" Matsumoto
- remove `mrb_jmpbuf` from `truct mrb_parser_state` - unify exception handling of `mrb_state` and `mrb_parser_state`.
2021-09-06parse.y: refactoring `mrb_parser_parser()`.Yukihiro "Matz" Matsumoto
2021-09-05codegen.c: avoid integer overflow.Yukihiro "Matz" Matsumoto
2021-09-04kernel.c: add `__method__`; ref #4468Yukihiro "Matz" Matsumoto
2021-09-04Rename `Kernel#__method__` to `Kernel#__callee__`KOBAYASHI Shuji
Because the current behavior of `__method__` is equivalent to `__callee__`. Example: # example.rb def src __send__(ARGV[0]) end alias dst src %w[src dst].each {|n| puts "call #{n} => #{__send__(n).inspect}"} Ruby: $ ruby example.rb __method__ call src => :src call dst => :src $ ruby example.rb __callee__ call src => :src call dst => :dst mruby: $ mruby example.rb __method__ call src => :src call dst => :dst
2021-08-31use gender-neutral pronounsStuart Hinson
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-01string-ext/string.c: implement `casecmp` in C.Yukihiro "Matz" Matsumoto
* should not raise error for non-string arguments * avoid allocating case converted string internally
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-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-23Merge pull request #5537 from dearblue/header-filesYukihiro "Matz" Matsumoto
Organize the include of header files
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-21Stirs internal state when `seed` is set in `Random`dearblue
This is to avoid the approximation of `Random#rand` when `seed`s are close together. For example, the first `#rand` values after doing `Random#srand(0)` and `Random#srand(1)` are very similar. Below is the sequence of mruby before this patch was given a `seed` of `0...20`: ```console % bin/mruby -e 'r = Random.new; 20.times { |i| r.srand(i); puts "seed=%2d %s" % [i, 10.times.map { "%0.3f" % r.rand }.join(" ")] }' seed= 0 0.643 0.585 0.198 0.732 0.087 0.605 0.548 0.468 0.573 0.966 seed= 1 0.643 0.585 0.198 0.607 0.370 0.605 0.633 0.593 0.395 0.439 seed= 2 0.643 0.585 0.197 0.981 0.652 0.730 0.875 0.713 0.529 0.269 seed= 3 0.643 0.585 0.198 0.857 0.934 0.730 0.960 0.216 0.286 0.523 seed= 4 0.643 0.585 0.197 0.231 0.217 0.605 0.959 0.958 0.478 0.482 seed= 5 0.643 0.585 0.197 0.106 0.249 0.605 0.044 0.330 0.925 0.047 seed= 6 0.643 0.585 0.197 0.481 0.781 0.731 0.285 0.960 0.804 0.725 seed= 7 0.643 0.585 0.197 0.356 0.813 0.731 0.370 0.711 0.937 0.448 seed= 8 0.643 0.585 0.198 0.732 0.329 0.108 0.243 0.974 0.766 0.936 seed= 9 0.643 0.585 0.198 0.607 0.611 0.108 0.827 0.102 0.962 0.597 seed=10 0.643 0.585 0.198 0.981 0.393 0.233 0.569 0.723 0.472 0.805 seed=11 0.643 0.585 0.198 0.857 0.676 0.233 0.154 0.222 0.603 0.371 seed=12 0.643 0.585 0.198 0.231 0.458 0.108 0.654 0.979 0.928 0.577 seed=13 0.643 0.585 0.198 0.106 0.490 0.108 0.239 0.355 0.749 0.831 seed=14 0.643 0.585 0.198 0.481 0.523 0.233 0.981 0.486 0.505 0.131 seed=15 0.643 0.585 0.198 0.356 0.555 0.234 0.565 0.233 0.011 0.666 seed=16 0.643 0.585 0.197 0.730 0.573 0.611 0.904 0.512 0.971 0.153 seed=17 0.643 0.585 0.197 0.605 0.855 0.611 0.240 0.636 0.041 0.509 seed=18 0.643 0.585 0.196 0.979 0.137 0.736 0.229 0.765 0.674 0.832 seed=19 0.643 0.585 0.197 0.855 0.420 0.736 0.566 0.268 0.183 0.219 ```
2021-08-21mruby-test/driver.c: change `FLOAT_TOLERANCE` bigger for inline floats.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-17pack.c: rename pack/unpack functions for readability.Yukihiro "Matz" Matsumoto
2021-08-17fixup! pack.c: reduce dispatch in `pack_unpack()`.Yukihiro "Matz" Matsumoto
2021-08-17pack.c: reduce dispatch in `pack_unpack()`.Yukihiro "Matz" Matsumoto
2021-08-16pack.c: fix `M` packing bug.Yukihiro "Matz" Matsumoto
2021-08-14random.c: use `I` specifier for `mrb_get_args()`; ref #5530Yukihiro "Matz" Matsumoto
2021-08-14pack.c: fixed a overwriting bug in `pack_w` and `pack_M`.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-13codegen.c: fixed a bug in `mrb_decode_insn()`.Yukihiro "Matz" Matsumoto
2021-08-13codegen.c: add a comment that notice `rewind_pc` calling convention.Yukihiro "Matz" Matsumoto
`rewind_pc` should not be called when `s->pc` is `0` (top).
2021-08-13codegen.c: refactor `mrb_last_insn()`.Yukihiro "Matz" Matsumoto
Last commit made `mrb_decode_insn()` to take `NULL` as `pc`.
2021-08-13codegen.c: `mrb_prev_pc` can return `NULL` at the top of `iseq`.Yukihiro "Matz" Matsumoto
2021-08-12test/eval.c: add test for #5528Yukihiro "Matz" Matsumoto
2021-08-11codegen.c: avoid signedness warning of int comparison.Yukihiro "Matz" Matsumoto
2021-08-11codegen.c: avoid cross initialization of `mrb_insn_data`.Yukihiro "Matz" Matsumoto
2021-08-11codegen.c: more peephole optimization.Yukihiro "Matz" Matsumoto
`a=10; a+=1` to generate: ``` 1 000 OP_LOADI R1 11 ; R1:a ``` instead of: ``` 1 000 OP_LOADI R1 10 ; R1:a 1 003 OP_MOVE R2 R1 ; R1:a 1 006 OP_ADDI R2 1 1 009 OP_MOVE R1 R2 ; R1:a ```
2021-08-07Fixed compilation error of "mruby-pack" with `MRB_NO_STDIO`dearblue
2021-08-07codegen.c: need to push the value when the loop was eliminated.Yukihiro "Matz" Matsumoto
2021-08-06numeric_ext.c: fix a bug regarding `MRB_INT_MIN`.Yukihiro "Matz" Matsumoto
2021-08-06codegen.c: `-9223372036854775808 % -1` overflows 64 bit integer.Yukihiro "Matz" Matsumoto
2021-08-05codegen.c: remove code duplication from `NODE_ARRAY`.Yukihiro "Matz" Matsumoto
2021-08-04codegen.c: detect integer overflow in division.Yukihiro "Matz" Matsumoto
`MRB_INT_MIN / -1` overflows.