Yukihiro "Matz" Matsumoto
0542d6bad4
debug.c (mrb_packed_int_encode): remove end argument
...
The function requires the buffer bigger than `mrb_packed_int_len()`
anyway, so we don't need boundary checks for each iteration. Should
makes the function a little bit faster.
2023-07-28 17:05:38 +09:00
Yukihiro "Matz" Matsumoto
aa5ffb686f
mruby-os-memsize: more precise memory size for method tables
2023-07-06 16:12:51 +09:00
Yukihiro "Matz" Matsumoto
e2bbf75d58
kernel.c: prepare for new recursive inspect check
...
Like previous recursive `<=>` check, scan call stack to detect recursive
`inspect` calls. We no longer need incomplete `_inspect` hack to pass
around a hash table to record objects currently inspecting.
2023-06-20 07:04:28 +09:00
Yukihiro "Matz" Matsumoto
5e4cecf766
internal.h: add mrb_obj_equal_m to internal.h
2023-06-15 23:36:27 +09:00
Yukihiro "Matz" Matsumoto
17720c9b7b
variable.c (const_get): avoid mrb_funcall if possible
...
Directly call mrb_const_missing() if const_missing is not overridden.
2023-06-12 23:47:35 +09:00
Yukihiro "Matz" Matsumoto
795044f82c
internal.h: add mrb_check_num_exact prototype to the header
2023-05-30 08:54:05 +09:00
Yukihiro "Matz" Matsumoto
d482eabfa2
mruby-bigint/bigint.c: int.pow(n,m) to take bigint as exponential
2023-03-31 08:26:47 +09:00
Yukihiro "Matz" Matsumoto
fbb3a2426f
proc.c (mrb_proc_eql): define == and eql? for Proc class
2023-03-27 19:14:21 +09:00
dearblue
2675477f07
Safely retrieve self from proc in mrb_yield()
...
Passing a proc generated by the following method to `mrb_yield()` or `mrb_yield_argv()` no longer causes `SIGSEGV`:
- C functions made into proc objects with `mrb_proc_new_cfunc()`.
- A proc object which is the top level of a program generated by `mrb_load_string_cxt()` etc. with `mrbc_context::no_exec` enabled.
See also: #5932
2023-03-17 21:20:48 +09:00
Yukihiro "Matz" Matsumoto
0d07af104b
internal.h: move function prototypes to <mruby/internal.h>
2023-03-14 11:06:44 +09:00
Yukihiro "Matz" Matsumoto
9a1e6760a8
mruby-bigint: add new functions mrb_bint_add_d, mrb_bint_sub_d
...
Those functions do not normalize the return value to avoid repeated
conversions between Bigints and (small) Integers.
2023-03-13 16:07:17 +09:00
Yukihiro "Matz" Matsumoto
f7cbb319cb
mruby-bigint: remove unused mrb_bint_div_ii() function
2023-03-13 08:10:41 +09:00
Yukihiro "Matz" Matsumoto
01233f70bd
mruby-bigint/bigint.c: add two new functions to convert to 64bit int
...
- mrb_bint_as_int64()
- mrb_bint_as_uint64()
2023-03-10 08:52:05 +09:00
Yukihiro "Matz" Matsumoto
a3b84fbb08
mruby-bigint/bigint.c: add 2 new functions for 64 bit integer
...
- mrb_bint_new_int64()
- mrb_bint_new_uint64()
2023-03-10 08:52:05 +09:00
Yukihiro "Matz" Matsumoto
78137f31c8
error.c (mrb_make_exception): reinvent exception creation
...
The arguments of mrb_make_exception() has changed. I believe no one is
using the function, but beware.
2023-02-18 11:51:33 +09:00
Yukihiro "Matz" Matsumoto
431f83eb8c
error.c (mrb_make_exception): make the function internal
2023-02-17 17:04:09 +09:00
dearblue
0898ce982e
Demotion mrb_f_raise() from MRB_API
...
This function is the entity of the `Kernel.#raise` or `Kernel#fail` method.
I don't think users can use it whenever they want, and I don't think there is any need to expose it as an entity of a user-defined method.
2023-02-07 22:37:58 +09:00
Yukihiro "Matz" Matsumoto
079244c36a
src/class.c: add new function mrb_vm_find_method
...
The function skips `cp` dereference, and improve performance of method
calls slightly.
2023-01-23 00:17:32 +09:00
Yukihiro "Matz" Matsumoto
3a7e138c05
mruby/internal.h: add mrb_env_new to the internal function header
2023-01-18 10:37:48 +09:00
Yukihiro "Matz" Matsumoto
55eea005c8
mruby/internal.h: add codedump functions to the internal function header
...
ref #5906
2023-01-18 10:37:48 +09:00
Yukihiro "Matz" Matsumoto
bf642becc2
internal.h: aggregate prototypes to internal.h.
...
- mrb_f_send()
- mrb_ci_nregs()
2022-11-02 14:24:42 +09:00
Yukihiro "Matz" Matsumoto
4107cc95a2
internal.c: move some functions to <mruby/internal.h>.
...
Ref #5776
2022-08-15 18:13:59 +09:00
Yukihiro "Matz" Matsumoto
37dc1be74b
internal.c: move mrb_method_missing prototype to <mruby/internal.h>.
...
Ref #5776
2022-08-15 17:25:08 +09:00
Yukihiro "Matz" Matsumoto
a7c3d59971
kernel.c (mrb_obj_hash): generate hash value for big-integers.
2022-08-06 06:43:41 +09:00
Yukihiro "Matz" Matsumoto
6d683785f9
etc.c: use mrb_byte_hash instead of simple hash function.
2022-08-06 06:43:41 +09:00
Yukihiro "Matz" Matsumoto
c0a636c007
mruby-os-memsize/memsize.c: add up digit spaces for big-integers.
2022-07-21 20:56:32 +09:00
Yukihiro "Matz" Matsumoto
bae11ef689
complex.c (mrb_complex_copy): allow copying of complex numbers.
2022-07-11 11:25:31 +09:00
Yukihiro "Matz" Matsumoto
67f47c9b42
rational.c (mrb_rational_copy): allow copying of rational numbers.
2022-07-11 11:19:22 +09:00
Yukihiro "Matz" Matsumoto
3ebb55b75f
bigint.c (mrb_bint_copy): allow dup operation for bigints.
2022-07-11 11:02:27 +09:00
Yukihiro "Matz" Matsumoto
7de03cbb68
numeric.c: add mrb_noreturn qualifier to error functions.
...
- mrb_int_zerodiv()
- mrb_int_overflow()
2022-07-09 15:12:37 +09:00
Yukihiro "Matz" Matsumoto
e1980d7596
numeric.c (mrb_div_int): separate the function in two.
...
- mrb_div_int() does integer division in Ruby way (mdiv)
returns mrb_int
- mrb_div_int_value() division with zero div and overflow checks.
returns mrb_value
2022-07-09 14:38:18 +09:00
Yukihiro "Matz" Matsumoto
cd6e94c09f
mruby/internal.h: move functions from internal.h; #5725
...
To compile `iij/mruby-require` gem.
2022-06-23 07:53:29 +09:00
Yukihiro "Matz" Matsumoto
b38a766427
numeric.c (flo_to_i): use bigint if the value is bigger than mrb_int.
2022-04-18 12:31:15 +09:00
Yukihiro "Matz" Matsumoto
dcaf4083d5
src/bigint.c: implement multi-precision integer.
...
To enable multi-precision integer support, you need to link
`mruby-bigint` mrbgem. The gem itself is empty but it turns on
the "bigint" support.
2022-04-09 17:16:10 +09:00
Yukihiro "Matz" Matsumoto
b99c389ec3
internal.h: aggregate internal functions.
...
Internal functions can only be called from within the library.
Functions listed in `mruby/internal.h` can be called from:
* core (src/*.c)
* gems (mrbgems/**/*.c)
But not from the application linked with `libmruby`.
2022-04-02 18:25:13 +09:00