Commit Graph

12315 Commits

Author SHA1 Message Date
dearblue ced89c25ff Unified pc and err of mrb_callinfo
This enhances self-containment.

- Changed the `mrb_callinfo::pc` field to point to itself.
  Previously it indicated the return destination of the previous call level.
  `mrb_callinfo::pc` will now hold the address to its own `proc->body.irep->iseq`.
- Removed `mrb_callinfo::err` field.
  This is because `mrb_callinfo::pc - 1` is semantically the same as the previous `err`.
- The `pc0` and `pc_save` variables in `mrb_vm_exec()` are no longer needed and have been deleted.
- It removes the argument because `cipush()` doesn't need to save the previous `pc`.
2021-01-10 13:23:43 +09:00
dearblue 16baea0677 Changes stackent to stack of mrb_callinfo
This enhances self-containment.

Previously `mrb_context::stack` had the current call level stack, but now it owns it.
The `mrb_context::stack` field, which is no longer needed, will be removed.
2021-01-10 13:23:35 +09:00
dearblue 58e9442737 Unified target_class and env of mrb_callinfo
If there is `env`, `env->c` means `target_class`.
2021-01-10 13:23:28 +09:00
dearblue b210cfa34e Use uint16_t for argc and acc of mrb_callinfo
This is because it is enough to express the range up to (-1..255) or (-3..255).
2021-01-10 13:22:28 +09:00
Yukihiro "Matz" Matsumoto 6f6eabf05a Fix wrong float to rational conversion in 32 bit mode. 2021-01-09 23:39:36 +09:00
Yukihiro "Matz" Matsumoto f81591ceb6 Detect invalid first byte of UTF-8 char; fix #5269
The first byte of UTF-8 character should not be `80..c1`.
2021-01-09 19:09:57 +09:00
Yukihiro "Matz" Matsumoto 62e5247300 Convert float number to rational by decoding mantissa. 2021-01-09 19:09:57 +09:00
Yukihiro "Matz" Matsumoto 92cc6b4996 Introduce mrb_uint which is unsigned integer with size of mrb_int. 2021-01-09 19:09:56 +09:00
Yukihiro "Matz" Matsumoto 12cc959998 Remove khash.h leftovers. 2021-01-09 19:09:56 +09:00
Yukihiro "Matz" Matsumoto fb4767a3b7 Merge pull request #5270 from shuujii/remove-unnecessary--include-in-generated-files
Remove unnecessary `#include` in generated files
2021-01-09 16:34:11 +09:00
KOBAYASHI Shuji 892bf15cd7 Remove unnecessary #include in generated files 2021-01-09 14:50:23 +09:00
Yukihiro "Matz" Matsumoto 69482dbc8e Merge pull request #5265 from shuujii/reapply-116e128b-because-it-is-back-at-456878ba
Reapply 116e128b because it is back at 456878ba
2021-01-08 23:10:49 +09:00
Yukihiro "Matz" Matsumoto 6587269af8 Merge pull request #5267 from shuujii/delay-test-code-build-until-rake-test
Delay test code build until `rake test`
2021-01-08 21:14:19 +09:00
Yukihiro "Matz" Matsumoto a0c1e075e3 Save&restore execution point (pc) in c->cibase->pc; fix #5261
`mrb_fiber_resume()` can be called from C; ref #3056
2021-01-08 21:03:41 +09:00
KOBAYASHI Shuji 3a8d7bdf82 Delay test code build until rake test
With this change, the test code will not be built unless `rake test` is
run, so there will be almost no side effects even if `enable_test` is
always set (but, gems specified by `add_test_dependency` are included
in `libmruby.a`).

Also added are `test: build` task, which only builds the test code
(including the main code), and `test: run` task, which only runs tests
independent of build. Therefore, the idiom for building in parallel and
not running tests in parallel is `rake -m test:build && rake test:run`.
2021-01-08 20:36:54 +09:00
Yukihiro "Matz" Matsumoto 04561cd999 Merge pull request #5266 from shuujii/stop-immediate-flush-to-stdout-stderr-when-running-in-parallel-on-CI
Stop immediate flush to stdout/stderr when running in parallel on CI
2021-01-08 16:37:50 +09:00
KOBAYASHI Shuji dbe387a9d8 Stop immediate flush to stdout/stderr when running in parallel on CI
During parallel execution (build), it is sometimes flushed before line
breaks, and lines are concatenated.
2021-01-08 15:59:08 +09:00
KOBAYASHI Shuji f7ff4810f0 Reapply 116e128b because it is back at 456878ba 2021-01-08 15:23:50 +09:00
Yukihiro "Matz" Matsumoto 1cc1ade610 Merge pull request #5263 from shuujii/use-namespaces-according-to-Rake-conventions
Use namespaces according to Rake conventions
2021-01-07 20:22:35 +09:00
Yukihiro "Matz" Matsumoto 76241a9630 Merge pull request #5264 from shuujii/immediately-flush-output-to-stdout-stderr-so-that-logs-are-not-mixed-on-CI
Immediately flush output to stdout/stderr so that logs are not mixed on CI
2021-01-07 20:21:13 +09:00
KOBAYASHI Shuji 35c85cb21f Immediately flush output to stdout/stderr so that logs are not mixed on CI
Set in build configuration to enable on all CI platforms.
2021-01-07 19:46:03 +09:00
KOBAYASHI Shuji 0dfcaaed63 Use namespaces according to Rake conventions
Change the Rake task to one that uses namespaces as follows (previous task
names can also be used for compatibility).

| Previous Task  |    New Task    |
|----------------|----------------|
| api_doc        | doc:api        |
| capi_doc       | doc:capi       |
| clean_doc      | doc:clean      |
| clean_api_doc  | doc:clean:api  |
| clean_capi_doc | doc:clean:capi |
| view_api       | doc:view:api   |
| view_capi      | doc:view:capi  |
| gitlab_config  | gitlab:config  |
| gitlab_dockers | gitlab:dockers |
2021-01-07 17:31:05 +09:00
Yukihiro "Matz" Matsumoto a435cc94ec Merge pull request #5262 from shuujii/add-scan-target-functions-for-presym
Add scan target functions for presym
2021-01-07 17:12:06 +09:00
KOBAYASHI Shuji d35cd42dc8 Add scan target functions for presym
Add the following functions:

- mrb_intern_cstr
- mrb_define_singleton_method
- mrb_define_class_under
- mrb_define_module_under
2021-01-07 16:38:46 +09:00
Yukihiro "Matz" Matsumoto ec6f46c05d Use nint() for implicit cast; ref #5260 2021-01-07 11:49:50 +09:00
Yukihiro "Matz" Matsumoto 7e116b5e8b Merge pull request #5260 from SeekingMeaning/squiggly-fix-5
Fix line continuations with mixed indentation in squiggly heredocs
2021-01-07 11:45:24 +09:00
Yukihiro "Matz" Matsumoto 5e752caf67 Merge pull request #5259 from shuujii/consider-the-case-a-local-variable-name-does-not-become-a-named-presym
Consider the case a local variable name does not become a named presym
2021-01-07 10:22:10 +09:00
Seeker d52c82d648 Add heredoc_push_indented helper function 2021-01-06 16:46:44 -08:00
Seeker e279528ff3 Fix line continuations with mixed indentation in squiggly heredocs 2021-01-06 16:35:46 -08:00
KOBAYASHI Shuji b8486d73e2 Consider the case a local variable name does not become a named presym
Non-ASCII characters are allowed to local variable names, so they are not
always named presym.
2021-01-06 23:29:45 +09:00
Yukihiro "Matz" Matsumoto 676054c8df Merge pull request #5258 from shuujii/fix-build-with-enable_cxx_exception
Fix build with `enable_cxx_exception`
2021-01-06 19:50:03 +09:00
KOBAYASHI Shuji 90283432a4 Fix build with enable_cxx_exception 2021-01-06 19:03:10 +09:00
Yukihiro "Matz" Matsumoto 01aa2a990f Specify receivers for gembox methods; ref #5241 2021-01-06 18:10:21 +09:00
Yukihiro "Matz" Matsumoto aecb3a33e6 Merge pull request #5241 from dearblue/gembox
Take advantage of gembox
2021-01-06 18:06:18 +09:00
Yukihiro "Matz" Matsumoto 0d76b90758 Use ~0U instead of ~0 to avoid sign comparison warnings. 2021-01-06 17:15:21 +09:00
Yukihiro "Matz" Matsumoto 8e048ae25d Merge branch 'shuujii-improve-source-scanning-for-presym' 2021-01-06 17:14:12 +09:00
Yukihiro "Matz" Matsumoto 74c9502bd4 Merge branch 'improve-source-scanning-for-presym' of https://github.com/shuujii/mruby into shuujii-improve-source-scanning-for-presym 2021-01-06 17:06:07 +09:00
Yukihiro "Matz" Matsumoto 1341e53961 Avoid comparing -1 with size_t (unsigned); Use ~0 instead. 2021-01-06 14:23:12 +09:00
Yukihiro "Matz" Matsumoto ca3a6156bf Allow context switch from C using mrb_fiber_resume().
But you still cannot cross C function boundary.
2021-01-06 14:16:56 +09:00
Yukihiro "Matz" Matsumoto 4585c360e4 Remove duplicated remove_sign_bits() call. 2021-01-05 21:09:46 +09:00
Yukihiro "Matz" Matsumoto bb5c451dd4 Fix mirb not to be terminated by codegen error. 2021-01-04 07:42:21 +09:00
Yukihiro "Matz" Matsumoto 7c9d9b1c89 Merge pull request #5255 from shuujii/avoid-64-bit-operations-in-src-hash.c
Avoid 64-bit operations in `src/hash.c`; close #5201
2021-01-03 20:28:00 +09:00
Yukihiro "Matz" Matsumoto 0d22e11b75 Merge pull request #5254 from SeekingMeaning/squiggly-fix-4
Fix for escaped newlines in squiggly heredocs
2021-01-03 20:25:34 +09:00
Yukihiro "Matz" Matsumoto 5798c03de6 Merge pull request #5256 from katsuyoshi/master
replace ; to : of OPT_SETGV in codedump.c
2021-01-03 20:25:02 +09:00
Katsuyoshi Ito f23918f61a replace ; to : of OPT_SETGV in codedump.c
Maybe it's a typo.
2021-01-03 19:47:30 +09:00
KOBAYASHI Shuji eb9d9e3425 Avoid 64-bit operations in src/hash.c; close #5201
The idea of using `size_t` in `ea_next_capa_for` is by @dearblue.
2021-01-03 18:42:22 +09:00
Seeker 8286e6052a Fix for escaped newlines in squiggly heredocs 2021-01-03 00:48:10 -08:00
Yukihiro "Matz" Matsumoto c52efe7be8 Avoid double inclusion on <mruby.h>. 2021-01-02 23:50:18 +09:00
Yukihiro "Matz" Matsumoto 17cb50f8d0 Avoid int64_t on 32 bit platforms. 2021-01-02 23:49:41 +09:00
Yukihiro "Matz" Matsumoto 757902c497 Check NaN and Infinity before converting Float to Rational. 2021-01-02 23:36:41 +09:00