Yukihiro "Matz" Matsumoto
4e9773ae3d
readint.c (mrb_int_read): new function.
...
We no longer use `mrb_read_int` which is kinda compatible with `strtol`.
2022-11-07 16:09:31 +09:00
Yukihiro "Matz" Matsumoto
440adc447b
Merge pull request #5849 from dearblue/re-stackerr
2022-11-06 19:46:21 +09:00
dearblue
5db5b27aa0
Using mrb_realloc() with stack_extend_alloc()
...
Raising a `SystemStackError` exception in an out-of-memory situation will generate backtrace information.
This can eventually lead to a `NoMemoryError` exception, and this process flow is completely undesirable.
In effect, this change means that it will include a revert of commit 0dbb9e6e41 .
2022-11-05 20:34:49 +09:00
Yukihiro "Matz" Matsumoto
47575ed72a
Merge pull request #5848 from dearblue/mrb_str_inspect-utf-8
...
Reduce memory copy in `mrb_str_inspect()` with UTF-8
2022-11-04 23:27:05 +09:00
dearblue
97c075ad68
Reduce memory copy in mrb_str_inspect() with UTF-8
2022-11-04 22:13:07 +09:00
Yukihiro "Matz" Matsumoto
4f385f119c
parse.y (call_with_block): a->cdr may be NULL.
2022-11-04 14:05:52 +09:00
Yukihiro "Matz" Matsumoto
c6b7029cdc
mruby-sprintf: fix int and mrb_int mixtures.
2022-11-04 13:11:36 +09:00
Yukihiro "Matz" Matsumoto
7e7cc425d4
bingint.c: add cast to silence some warnings (on VC).
2022-11-04 13:10:51 +09:00
Yukihiro "Matz" Matsumoto
b7240056f8
vm.c (funcall_args_capture): fix integer size mixture.
2022-11-04 12:07:00 +09:00
Yukihiro "Matz" Matsumoto
5617de0071
mruby-method/method.c (method_eql): do not check _klass for equality.
2022-11-03 23:38:27 +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
e3dd65f761
throw.h: simplified a compilation conditional.
2022-11-02 14:22:04 +09:00
Yukihiro "Matz" Matsumoto
c68d3dcbac
vm.c: stop wrapping implementation by extern "C".
2022-11-02 14:22:04 +09:00
Yukihiro "Matz" Matsumoto
37fac6c089
throw.h: avoid using static member in C++ struct; fix #5846
...
The initialization causes linkage error with gcc (not clang), caused by
the following gcc bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86254
2022-11-02 14:22:03 +09:00
Yukihiro "Matz" Matsumoto
ab0a7f0583
Merge pull request #5839 from jbampton/script-must-not-have-extension
...
pre-commit(shell): add hook `script-must-not-have-extension`
2022-11-01 23:16:04 +09:00
Yukihiro "Matz" Matsumoto
a4b41fe53c
Merge pull request #5843 from dearblue/simple-raise
...
Simplify the `L_RAISE` block
2022-11-01 00:06:06 +09:00
Yukihiro "Matz" Matsumoto
ce535b872f
Merge pull request #5844 from jbampton/ruby-remove-parenthesis
...
ruby: remove unneeded parenthesis from methods
2022-11-01 00:05:38 +09:00
John Bampton
2438195289
ruby: remove unneeded parenthesis from methods
...
commit eeb33da43035b5400f8d1830ea52a68691b3a678
Author: John Bampton <jbampton@gmail.com >
Date: Mon Oct 31 23:53:43 2022 +1000
Fix up
commit 80923c8f92a58b2f33a36d6403de7f6341973110
Merge: bc89500f6 416f012f6
Author: John Bampton <jbampton@users.noreply.github.com >
Date: Mon Oct 31 20:12:59 2022 +1000
Merge branch 'master' into ruby-remove-parenthesis
commit bc89500f6357c453b457516452ffcc7fd03fee88
Author: John Bampton <jbampton@gmail.com >
Date: Mon Oct 31 14:39:20 2022 +1000
ruby: remove unneeded parenthesis from methods
2022-11-01 00:25:09 +10:00
Yukihiro "Matz" Matsumoto
416f012f68
Merge pull request #5845 from jbampton/ruby-fix-whitespace
...
ruby: standardize whitespace
2022-10-31 18:43:08 +09:00
John Bampton
ea8964ef35
ruby: standardize whitespace
2022-10-31 16:25:56 +10:00
Yukihiro "Matz" Matsumoto
734fe47de4
Merge pull request #5841 from dearblue/raise-in-vm
...
Use macro in `mrb_vm_exec()` exception raising
2022-10-31 13:04:23 +09:00
Yukihiro "Matz" Matsumoto
e4d6ea3382
Merge pull request #5838 from jbampton/editorconfig-batch-charset-encoding
...
Remove `charset = latin1` from `.editorconfig` for batch files
2022-10-31 12:56:42 +09:00
Yukihiro "Matz" Matsumoto
9832e7db5b
Merge pull request #5837 from jbampton/pre-commit-tabs-exclude
...
pre-commit(tabs): use blacklist to exclude files
2022-10-31 07:30:52 +09:00
Yukihiro "Matz" Matsumoto
21436e2350
Merge pull request #5842 from mattn/fix-use-after-free
...
fix use after free
2022-10-31 07:28:24 +09:00
dearblue
8a62bf25c8
Simplify the L_RAISE block
...
The current flow of the `L_RAISE` block is as follows:
```mermaid
flowchart LR
raise((raise))
raise --> citop{"top of call info?"}
citop -- YES --> chftop{"no catch handler?"}
citop -- NO --> chf{"no catch handler?"}
chftop -- YES --> fiber{"root of fiber?"}
chftop -- NO --> vmexec((vmexec))
fiber -- YES --> vmstop((vmstop))
fiber -- NO --> fswitch["switch fiber"]
fswitch --> citop
chf -- YES --> cipop["cipop"]
chf -- NO --> vmexec((vmexec))
cipop --> citop
```
This patch makes the catch handler search first:
```mermaid
flowchart LR
raise((raise))
raise --> chf{"no catch handler?"}
chf -- NO --> vmexec((vmexec))
chf -- YES --> citop{"top of call info?"}
citop -- YES --> fiber{"root of fiber?"}
citop -- NO --> cipop["cipop"]
cipop --> chf
fiber -- YES --> vmstop((vmstop))
fiber -- NO --> fswitch["switch fiber"]
fswitch --> chf
```
2022-10-30 23:05:29 +09:00
Yasuhiro Matsumoto
6697a6a067
fix use after free
2022-10-30 20:51:33 +09:00
Yukihiro "Matz" Matsumoto
4371b736b7
Merge pull request #5811 from FnControlRuby/splat
...
ops.h: update `OP_ARYDUP` instruction and rename to `OP_ARYSPLAT`
2022-10-30 16:50:58 +09:00
fn ⌃ ⌥
273fcbc347
ops.h: update OP_ARYDUP instruction and rename to OP_ARYSPLAT.
...
Transforms the value of a splat inside a return statement (similar
to an array). For example, `return *nil` should return `nil.to_a`,
while `return *1` should return `[1]`
2022-10-29 19:54:34 -07:00
dearblue
1de8fda2ec
Use macro in mrb_vm_exec() exception raising
...
Introduce the macro functions `RAISE_EXC()`, `RAISE_FORMAT()` and `RAISE_LIT()`.
2022-10-30 11:04:38 +09:00
Yukihiro "Matz" Matsumoto
6ee4f845c6
Merge pull request #5840 from mattn/errno-windows
...
errno must be set before mrb_sys_fail
2022-10-30 07:56:59 +09:00
Yasuhiro Matsumoto
4612c8b2d6
errno must be set before mrb_sys_fail
2022-10-30 01:00:27 +09:00
John Bampton
bd51915679
Remove charset = latin1 from .editorconfig for batch files
...
The top `.editorconfig` rule `charset = utf-8` now applies to batch files
```
mruby % file -I mrbgems/mruby-bin-config/mruby-config.bat
mrbgems/mruby-bin-config/mruby-config.bat: text/x-msdos-batch; charset=us-ascii
```
US-ASCII (basic English) is a 7-bit, 128 characters code page, originally designed for telegraphy.
UTF-8 encoding uses the same encoding as 7-bit ASCII for its first 128 characters. So a text file that only contains characters from that range of the first 128 characters will be identical at a byte level whether encoded with UTF-8 or 7-bit ASCII.
https://stackoverflow.com/questions/11303405/force-encode-from-us-ascii-to-utf-8-iconv
2022-10-29 23:45:39 +10:00
John Bampton
af0b3e3388
pre-commit(shell): add hook script-must-not-have-extension
...
```
mruby % file -I mrbgems/mruby-bin-config/mruby-config
mrbgems/mruby-bin-config/mruby-config: text/x-shellscript; charset=us-ascii
```
The Google shell style guide states:
Executables should have no extension (strongly preferred)
This hook checks for conformance.
https://github.com/jumanjihouse/pre-commit-hooks#script-must-not-have-extension
We are already using hooks from "jumanjihouse" in the `mgem-list` repo.
https://github.com/mruby/mgem-list/blob/f5904922d5fbc87f45c582b8ef759e2ebf16df79/.pre-commit-config.yaml#L39
2022-10-29 23:08:48 +10:00
John Bampton
e7507778a4
pre-commit(tabs): use blacklist to exclude files
...
Add `indent_style = space` to the `.editorconfig` file for batch files.
2022-10-29 20:26:00 +10:00
Yukihiro "Matz" Matsumoto
15eb62479b
Merge pull request #5836 from jbampton/fix-whitespace-in-md-files
...
docs: standardize whitespace in Markdown files
2022-10-29 18:56:45 +09:00
John Bampton
f631460dfb
docs: standardize whitespace in Markdown files
...
Most of the Markdown has a single space between sentences.
This pr changes `2 spaces` to `1 space`.
2022-10-29 18:49:31 +10:00
Yukihiro "Matz" Matsumoto
ce86585281
Merge pull request #5812 from FnControlRuby/block
...
parse.y: fix return/break/next with method call with args and block
2022-10-29 16:29:41 +09:00
Yukihiro "Matz" Matsumoto
9edf311fd3
Merge pull request #5834 from FnControlRuby/<=>
...
kernel.c (mrb_cmp_m): use mrb_equal instead of mrb_obj_equal.
2022-10-29 16:29:26 +09:00
fn ⌃ ⌥
55c423fc55
kernel.c (mrb_cmp_m): use mrb_equal instead of mrb_obj_equal.
...
`Kernel#<=>` should also call `#==` to check if the objects are equal.
2022-10-28 06:19:37 -07:00
Yukihiro "Matz" Matsumoto
63c0abeabd
Merge pull request #5835 from mattn/windows-errno
...
use WSAGetLastError() for errno on Windows
2022-10-28 18:13:39 +09:00
Yasuhiro Matsumoto
fd5e3654c4
use WSAGetLastError() for errno on Windows
2022-10-28 17:17:09 +09:00
Yukihiro "Matz" Matsumoto
5ccca7e45b
mruby-bigint/bigint.c (udiv): skip loop if xd<yd.
2022-10-28 17:01:46 +09:00
Yukihiro "Matz" Matsumoto
02f44d76fc
codegen.c: stop peephole optimization for headless case statement.
...
This fixes #5815
2022-10-28 15:57:35 +09:00
Yukihiro "Matz" Matsumoto
9ff247c5c2
Revert "codegen.c: exit headless case early if a condition is always true"
...
This reverts commit e5b32e559860073632fc7b69cb98b90f2c069e81; ref #5815
2022-10-28 15:54:40 +09:00
Yukihiro "Matz" Matsumoto
604d7e9c86
mruby-bigint/bigint.c (mpz_mul_2exp): move mpz_clear() call.
...
No need to call mpz_clear() after mpz_move().
2022-10-28 15:36:34 +09:00
Yukihiro "Matz" Matsumoto
5f5109b72b
Merge pull request #5815 from FnControlRuby/case
...
codegen.c: exit headless `case` early if a condition is always true
2022-10-28 15:36:22 +09:00
Yukihiro "Matz" Matsumoto
4f8ab59e79
Merge pull request #5819 from FnControlRuby/allocate
...
class.c (mrb_instance_alloc): raise error if NilClass/FalseClass
2022-10-28 15:19:24 +09:00
Yukihiro "Matz" Matsumoto
bb67008663
Merge pull request #5832 from FnControlRuby/comparable
...
Fix `Comparable#clamp` with range
2022-10-27 18:13:40 +09:00
Yukihiro "Matz" Matsumoto
5ee42ff1dd
Merge pull request #5833 from jbampton/remove-coding-utf-8-ruby
...
Remove `# coding: utf-8` from Ruby files
2022-10-27 18:11:54 +09:00
Yukihiro "Matz" Matsumoto
8a67a26104
mruby-pack/pack.c (unpack): check if the given length is positive.
...
To avoid out-of-bound array access.
2022-10-27 16:32:05 +09:00