Commit Graph

14460 Commits

Author SHA1 Message Date
Yukihiro "Matz" Matsumoto 260c2b60df Merge pull request #5859 from dearblue/rake/opcode.md
Add task `rake doc:update-opcode.md`
2022-11-23 18:00:52 +09:00
Yukihiro "Matz" Matsumoto ffb6b2243b Merge pull request #5858 from dearblue/mrb_print_backtrace
Print errors by calling `mrb_print_backtrace()` without backtrace
2022-11-21 08:37:01 +09:00
dearblue 5e62990748 Add task rake doc:update-opcode.md
Allow to update `doc/internal/opcode.md` file mechanically from `include/mruby/ops.h` file.

At the same time, the `doc/internal/opcode.md` file has been updated.
Consecutive hyphens at the end of the table were removed as they would have created noise as markdown flavours.
2022-11-20 21:58:13 +09:00
dearblue 61b60273ea Print errors by calling mrb_print_backtrace() without backtrace
- In case of `NoMemoryError` exceptions, the error message is now printed directly.
- Replaced `mrb_p()` used by #4250 with `mrb_print_error()`.

  ref. squashed commit f1523d2404
  ref. subcommit da7d7f881b
  ref. subcommit d9c7b6be6e
2022-11-20 20:58:03 +09:00
Yukihiro "Matz" Matsumoto 3a0e2255bd Merge pull request #5857 from dearblue/avoid-abort-resume
Avoid `abort()` when exception occurs in `mrb_fiber_resume()`
2022-11-20 20:37:44 +09:00
dearblue f0a65ec3c2 Avoid abort() when FiberError occurs in mrb_fiber_resume()
However, this may not be the case depending on where the `FiberError` raises.
2022-11-20 20:32:44 +09:00
Yukihiro "Matz" Matsumoto 9c5dc42e59 small cosmetic changes.
I prefer `i++` style unless absolutely necessary.
This commit is an addition to 41e4148.
2022-11-19 17:11:56 +09:00
Yukihiro "Matz" Matsumoto 7ab7608094 small cosmetic changes.
I prefer `i++` style unless absolutely necessary.
2022-11-19 17:11:56 +09:00
Yukihiro "Matz" Matsumoto 89a34e1b7e Revert "error.c (mrb_sys_fail): errno argument removed from _sys_fail."
Intermediate function calls may update `errno`.
This reverts commit a099ca44f4.
2022-11-19 17:11:56 +09:00
Yukihiro "Matz" Matsumoto 80986804cc Merge pull request #5856 from dearblue/doc/fiber-funcs
Updates documentation for `mrb_fiber_resume()` and `mrb_fiber_yield()`
2022-11-19 17:11:48 +09:00
dearblue 6fed73445e Updates documentation for mrb_fiber_resume() and mrb_fiber_yield()
- Added note on `mrb_fiber_resume()` and `mrb_fiber_yield()`.
  Removed comments from C files that were not documented by yard and doxygen instead.
- Leads to use of `mrb_fiber_resume()` instead of `Fiber#resume` in C.
- Leads to use of `mrb_fiber_yield()` instead of `Fiber.yield` in C.
2022-11-19 16:59:28 +09:00
Yukihiro "Matz" Matsumoto a099ca44f4 error.c (mrb_sys_fail): errno argument removed from _sys_fail.
As a side effect, `errno.h` dependency removed from `error.c`.
2022-11-15 13:27:32 +09:00
Yukihiro "Matz" Matsumoto 71a1d0ad26 mruby-sprintf: fix a debug error message (remove additional "1"). 2022-11-15 13:27:31 +09:00
Yukihiro "Matz" Matsumoto 0ad29fda67 Merge pull request #5854 from jbampton/add-ubuntu-2204-to-build
gha: replace `Ubuntu 18.04` with `Ubuntu 22.04` in `build` workflow
2022-11-15 13:27:18 +09:00
John Bampton 512486d067 gha: replace Ubuntu 18.04 with Ubuntu 22.04 in build workflow
https://github.blog/changelog/2022-08-09-github-actions-ubuntu-22-04-is-now-generally-available-on-github-hosted-runners/
2022-11-15 09:27:52 +10:00
Yukihiro "Matz" Matsumoto c9f67d376f Merge pull request #5853 from jbampton/standardize-markdown-headings
docs: standardize Markdown headings
2022-11-13 17:21:59 +09:00
John Bampton 4903aa2be9 docs: standardize Markdown headings 2022-11-13 16:32:38 +10:00
Yukihiro "Matz" Matsumoto 5412f525fa Merge pull request #5851 from dearblue/prepare_missing
Changed `prepare_missing()` parameters
2022-11-13 09:14:12 +09:00
dearblue f9b13d27b5 Changed prepare_missing() parameters
- Now that it is called after `cipush()`, pass in a new ci pointer.
- Removed the parameters `clsp`, `a`, and `c`, which are no longer needed since they now operate directly on `ci`.
- Change the parameter `super`, which is treated as a boolean, to `mrb_bool`.
- Leave the parameter `mid`.
  Because if `prepare_missing()` raises the exception `NoMethodError`, `ci->mid` must not be set when suppressing extra information on the stack trace.
  However, set `ci->mid` here, since the preparation is completed at the end of the function.
2022-11-12 20:56:46 +09:00
Yukihiro "Matz" Matsumoto 6bcbfed8bb mruby-sprintf/sprintf.c: check integer overflow before casting. 2022-11-11 08:08:07 +09:00
Yukihiro "Matz" Matsumoto 9fcfd01f20 mruby-pack/pack.c (read_tmpl): check integer overflow before casting. 2022-11-10 22:21:12 +09:00
Yukihiro "Matz" Matsumoto 3b56332952 doc/mruby3.2.md: update [ci skip] 2022-11-09 23:37:02 +09:00
Yukihiro "Matz" Matsumoto c759ee5f77 AUTHORS: update entries [ci skip] 2022-11-08 16:28:09 +09:00
Yukihiro "Matz" Matsumoto 98cc66070b readnum.c: provide obsolete functions.
- mrb_int_read()
- mrb_float_read()

Both functions should not be use and this file should not be linked.
This is just for compatibility.
2022-11-07 16:09:31 +09:00
Yukihiro "Matz" Matsumoto 4a888a34bb readfloat.c (mrb_read_float): a new function.
We no longer use `mrb_float_read()` that depends on `errno`.
2022-11-07 16:09:31 +09:00
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