John Bampton
f13a4bfe65
gha: add Ubuntu 24.04 to the build
...
Remove Ubuntu 20.04
2024-10-08 16:23:49 +10:00
Yukihiro "Matz" Matsumoto
7e6f8685a3
Merge pull request #6373 from vickash/milkvduo
2024-10-06 20:30:10 -04:00
Yukihiro "Matz" Matsumoto
77fb1b1b65
mruby-bigint (mul_karatsuba): use byte-wise addition to combine
2024-10-07 07:28:24 +09:00
vickash
e99f605458
milkv config: Add directive for board variant, and optional wiringX mrbgem
2024-10-06 12:27:12 -04:00
vickash
115a739059
milkv config: forgot to remove "-L" in linker paths taken from official Makefile
2024-10-06 09:54:41 -04:00
vickash
d2878ef47f
Comment out test-inline-struct in milv_duo config
2024-10-06 08:33:21 -04:00
vickash
491b7685db
Add build config for Milk-V Duo (RISC-V Linux) board
2024-10-06 00:26:07 -04:00
Yukihiro "Matz" Matsumoto
40c7febca8
mruby-bigint (uadd): remove redundant trim()
2024-10-05 15:08:16 +09:00
Yukihiro "Matz" Matsumoto
be9da7199b
mruby-bigint (mul_karatsuba) improve performance
...
Unnecessary mpz_t u0u1 and v0v1 are removed.
2024-10-05 10:57:42 +09:00
Yukihiro "Matz" Matsumoto
8faf78f1b8
mruby-method: singleton_method() should search in superclasses
...
[ruby-bugs:20620](https://bugs.ruby-lang.org/issues/20620 )
2024-10-04 21:37:49 +09:00
Yukihiro "Matz" Matsumoto
32aed6ad8c
mruby-bigint: increase KARATSUBA_THREASHOLD to 512
...
Since Karatsuba algorithm is far heavier than the basic multiplication,
we have increased KARATSUBA_THREASHOLD and decreased MAX_RECURSION_DEPTH.
2024-10-04 18:10:14 +09:00
Yukihiro "Matz" Matsumoto
6820da1526
mruby-bigint (mpz_abs): use zero_p()
2024-10-04 18:10:14 +09:00
Yukihiro "Matz" Matsumoto
fd8d3a8d70
mruby-bigint: use zero() to make mpz_t zero.
2024-10-04 18:10:14 +09:00
Yukihiro "Matz" Matsumoto
6274f8de43
mruby-bigint (mpz_sub): avoid data copy
...
Since mpz_sub() calls mpz_add() with opposite sign, refer same data from
the original, instead of copying whole data.
2024-10-04 18:10:14 +09:00
Yukihiro "Matz" Matsumoto
363754b5d1
mruby-bigint (uzero_p): check from the top, not bottom
...
For most of the case, the first non-zero value would be found earlier
when search starts from the top.
2024-10-04 18:10:14 +09:00
Yukihiro "Matz" Matsumoto
fcc1832efc
mruby-bigint (mul_karatsuba): avoid copying operand u and v
2024-09-30 18:32:26 +09:00
Yukihiro "Matz" Matsumoto
0023cbdb3d
mruby-bigint (mpz_mul): use Karatsuba algorithm to improve performance
2024-09-28 05:26:40 +09:00
Yukihiro "Matz" Matsumoto
1348daa683
vm.c: save offset in a local variable in OP_BLKPUSH
2024-09-27 16:31:13 +09:00
Yukihiro "Matz" Matsumoto
b94be7de5a
gc.c (mark_context): no need to mark ci->blk; ref #5791
...
Since the passed block is referenced from the stack after the last
commit.
2024-09-26 02:57:57 +09:00
Yukihiro "Matz" Matsumoto
9c5812a463
mruby-compier: keep stack reference to passed block after modifying &b
...
To mark `MRB_PROC_ORPHAN` we need to keep track of passed block, even
after the assignment to the block argument. And `yield` should use the
original block; #5786 , #5791 , #6369
2024-09-26 02:48:16 +09:00
Yukihiro "Matz" Matsumoto
d6fa7772a0
mruby.h (mrb_method_t): avoid unnamed union
...
It caused errors in the pedantic-mode of GCC.
2024-09-26 00:07:03 +09:00
Yukihiro "Matz" Matsumoto
204928120b
vm.c (cipop): fix improper code to check if env is reclaimed; fix #6369
...
The callinfo refers blk since #5786 but not marked at the time. Later we
added reclamation check by #5791 but its repeated heap scans decrease
the performance drastically in some cases. So the original @dearblue's
solution should be taken
Probably we need to always keep the original block at the bottom of
arguments. And the explicit block argument should be a normal local
variable. We will investigate it later.
2024-09-25 14:12:50 +09:00
Yukihiro "Matz" Matsumoto
12264e33e5
Merge pull request #6361 from jbampton/add-pre-commit-hook-shellcheck
2024-09-24 09:44:25 +09:00
Yukihiro "Matz" Matsumoto
abc4ccf763
Merge pull request #6368 from jbampton/add-pre-commit-hook-check-json
2024-09-24 09:40:39 +09:00
Yukihiro "Matz" Matsumoto
05e3c5831d
Merge pull request #6367 from jbampton/fix-spelling
2024-09-24 07:16:55 +09:00
John Bampton
2adf60320d
Add pre-commit hook check-json
...
https://github.com/pre-commit/pre-commit-hooks?tab=readme-ov-file#check-json
Adds another check/test to our pre-commit framework for checking JSON files
We have one JSON file at `.github/linters/mlc_config.json`
2024-09-24 00:47:27 +10:00
John Bampton
e12da35645
Fix spelling
2024-09-24 00:14:24 +10:00
Yukihiro "Matz" Matsumoto
919a689517
Merge pull request #6363 from dearblue/mrb_type
2024-09-23 14:49:55 +09:00
Yukihiro "Matz" Matsumoto
17acf23914
readfloat.c: we don't need long double for mruby; fix #6365
...
`mrb_read_float()` function does not raise ERANGE (unlike `strtod()`)
so we don't need high precision double for calculation.
2024-09-23 08:11:23 +09:00
Yukihiro "Matz" Matsumoto
ecd42ab3e9
Merge pull request #6360 from jbampton/add-actionslint-to-pre-commit
2024-09-22 20:21:44 +09:00
Yukihiro "Matz" Matsumoto
1b875a925c
Merge pull request #6364 from jbampton/fix-spelling
2024-09-22 20:19:06 +09:00
John Bampton
b974b944af
docs: fix spelling
2024-09-22 12:16:23 +10:00
dearblue
1f933c21e3
Revert "Perform pseudo binary search with mrb_type()"
...
This reverts commit e76bebe836 (#6309 ).
Because it crashes limited to gcc13 -O3.
ref. #6358 .
Also, benchmark tests have shown that revert tends to be preferable in this time.
2024-09-22 10:51:12 +09:00
John Bampton
6fe57ae44e
Add pre-commit hook shellcheck-py to check syntax of shell scripts
...
https://github.com/shellcheck-py/shellcheck-py
https://www.shellcheck.net/
https://github.com/koalaman/shellcheck
Remove bash/shell checking from the Super-Linter
2024-09-22 10:18:21 +10:00
John Bampton
6d749e92ed
Add pre-commit hook actionlint
...
Validate GitHub Actions with pre-commit.
Remove the Super-Linter GitHub Actions check.
It is more useful to run "actionlint" with pre-commit
since the hooks run on our local machines on git commit.
We also run pre-commit on GitHub.
Whereas the Super-Linter tests only run on GitHub.
https://github.com/rhysd/actionlint/blob/main/docs/usage.md#pre-commit
2024-09-22 08:51:42 +10:00
Yukihiro "Matz" Matsumoto
bd668e4c9d
readfloat.c: new implementation of mrb_read_float(); ref #6187
...
The new version gives more accurate values for decimal number
representation that are not divisible in binary representations, for
example `0.3`.
The function uses `long double` for precision. Please report if `long
double` causes problems on any platform (especially microcontrollers).
Ref #6182
2024-09-21 02:47:42 +09:00
Yukihiro "Matz" Matsumoto
c162f8f709
Merge pull request #6356 from dearblue/get-args-splat
2024-09-21 00:03:38 +09:00
dearblue
cf23861166
Making splat argument objects invisible from Ruby side
...
The `mrb_get_argv()` function and the `*` specifier of `mrb_get_args()` get the address of the argument.
At this time, if it is passed in the form of a splat argument, it will be an address to an element of an array object.
After getting the pointer to the array object, the caller may call `mrb_vm_exec()` directly or indirectly.
At this time, a splat argument with the class set can be retrieved as an array object by searching with `ObjectSpace.each_object`.
If changes are made as array objects, addresses on the heap as arrays may become invalid, or objects in the array may be recycled by the GC.
When the caller references the changed address in a subsequent operation, use-after-free is established.
This patch assigns `NULL` as the class of the array object so that it cannot be detected by `ObjectSpace.each_object` from the Ruby side.
2024-09-19 23:13:18 +09:00
Yukihiro "Matz" Matsumoto
f6caf0d788
mruby-bigint (mrb_init_set_str): reduce mpz_t allocations
2024-09-19 20:52:11 +09:00
Yukihiro "Matz" Matsumoto
e3ff54fda3
vm.c (mrb_vm_exec): unify declaration and initialization of variables
2024-09-18 22:32:35 +09:00
Yukihiro "Matz" Matsumoto
d1d010a03a
array.c (mrb_ary_delete): array index should be mrb_int
2024-09-17 12:07:39 +09:00
Yukihiro "Matz" Matsumoto
ba8ee7b895
mruby-socket (inet_pton): need to initialize loop variable
2024-09-17 12:05:46 +09:00
Yukihiro "Matz" Matsumoto
4b500eb971
Merge pull request #6340 from dearblue/array-cmp
2024-09-17 11:29:41 +09:00
Yukihiro "Matz" Matsumoto
b8a6752570
Merge pull request #6354 from dabroz/dabroz-patch-1
2024-09-17 11:00:49 +09:00
Tomasz Pędraszewski
78ee1529d6
Update AUTHORS
2024-09-17 00:01:02 +02:00
Yukihiro "Matz" Matsumoto
de6955b1b0
vm.c (mrb_vm_run): merge declaration and initialization
2024-09-16 17:50:13 +09:00
Yukihiro "Matz" Matsumoto
fddc7650ca
numeric.c (int_ceil): should rename mrb_bint_add_d to mrb_bint_add_n
2024-09-15 04:00:52 +09:00
Yukihiro "Matz" Matsumoto
afefb5261b
mruby-rational (rat_sub_b): avoid normalization of big integers
2024-09-15 03:04:32 +09:00
Yukihiro "Matz" Matsumoto
bdbf8536a7
mruby-bigint: rename add_d and sub_d to add_n and sub_n respectively
...
`_n` suffix represents `no_normalize`.
2024-09-15 03:02:41 +09:00
Yukihiro "Matz" Matsumoto
50225acec4
mruby-rational (rat_mul_b): should not normalize multiplication results
2024-09-15 02:50:57 +09:00