Граф коммитов

491 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA 9df3f205b1 test-syntax-suggest is not working with mswin environment 2024-05-09 15:22:53 +09:00
yui-knk 899d9f79dd Rename `vast` to `ast_value`
There is an English word "vast".
This commit changes the name to be more clear name to avoid confusion.
2024-05-03 12:40:35 +09:00
HASUMI Hitoshi 2244c58b00 [Universal parser] Decouple IMEMO from rb_ast_t
This patch removes the `VALUE flags` member from the `rb_ast_t` structure making `rb_ast_t` no longer an IMEMO object.

## Background

We are trying to make the Ruby parser generated from parse.y a universal parser that can be used by other implementations such as mruby.
To achieve this, it is necessary to exclude VALUE and IMEMO from parse.y, AST, and NODE.

## Summary (file by file)

- `rubyparser.h`
  - Remove the `VALUE flags` member from `rb_ast_t`
- `ruby_parser.c` and `internal/ruby_parser.h`
  - Use TypedData_Make_Struct VALUE which wraps `rb_ast_t` `in ast_alloc()` so that GC can manage it
    - You can retrieve `rb_ast_t` from the VALUE by `rb_ruby_ast_data_get()`
  - Change the return type of `rb_parser_compile_XXXX()` functions from `rb_ast_t *` to `VALUE`
  - rb_ruby_ast_new() which internally `calls ast_alloc()` is to create VALUE vast outside ruby_parser.c
- `iseq.c` and `vm_core.h`
  - Amend the first parameter of `rb_iseq_new_XXXX()` functions from `rb_ast_body_t *` to `VALUE`
  - This keeps the VALUE of AST on the machine stack to prevent being removed by GC
- `ast.c`
  - Almost all change is replacement `rb_ast_t *ast` with `VALUE vast` (sorry for the big diff)
  - Fix `node_memsize()`
    - Now it includes `rb_ast_local_table_link`, `tokens` and script_lines
- `compile.c`, `load.c`, `node.c`, `parse.y`, `proc.c`, `ruby.c`, `template/prelude.c.tmpl`, `vm.c` and `vm_eval.c`
  - Follow-up due to the above changes
- `imemo.{c|h}`
  - If an object with `imemo_ast` appears, considers it a bug

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2024-04-26 11:21:08 +09:00
HASUMI Hitoshi 9b1e97b211 [Universal parser] DeVALUE of p->debug_lines and ast->body.script_lines
This patch is part of universal parser work.

## Summary
- Decouple VALUE from members below:
  - `(struct parser_params *)->debug_lines`
  - `(rb_ast_t *)->body.script_lines`
- Instead, they are now `rb_parser_ary_t *`
  - They can also be a `(VALUE)FIXNUM` as before to hold line count
- `ISEQ_BODY(iseq)->variable.script_lines` remains VALUE
  - In order to do this,
  - Add `VALUE script_lines` param to `rb_iseq_new_with_opt()`
  - Introduce `rb_parser_build_script_lines_from()` to convert `rb_parser_ary_t *` into `VALUE`

## Other details
- Extend `rb_parser_ary_t *`. It previously could only store `rb_parser_ast_token *`, now can store script_lines, too
- Change tactics of building the top-level `SCRIPT_LINES__` in `yycompile0()`
  - Before: While parsing, each line of the script is added to `SCRIPT_LINES__[path]`
  - After: After `yyparse(p)`, `SCRIPT_LINES__[path]` will be built from `p->debug_lines`
- Remove the second parameter of `rb_parser_set_script_lines()` to make it simple
- Introduce `script_lines_free()` to be called from `rb_ast_free()` because the GC no longer takes care of the script_lines
- Introduce `rb_parser_string_deep_copy()` in parse.y to maintain script_lines when `rb_ruby_parser_free()` called
  - With regard to this, please see *Future tasks* below

## Future tasks
- Decouple IMEMO from `rb_ast_t *`
  - This lifts the five-members-restriction of Ruby object,
  - So we will be able to move the ownership of the `lex.string_buffer` from parser to AST
  - Then we remove `rb_parser_string_deep_copy()` to make the whole thing simple
2024-04-15 20:51:54 +09:00
Nobuyoshi Nakada ca81f5a5de
Realclean extracted bundled gems and lock files 2024-04-11 23:47:32 +09:00
Nobuyoshi Nakada 2df4638538
Cleanings of .bundle do not need cleanings of ext 2024-04-11 23:47:32 +09:00
Nobuyoshi Nakada 7c015c3b30
Remove never used macros related to RJIT [ci skip]
These macros have not been used since the commit "Stop exporting
symbols for MJIT" 233ddfac54, and
renamed as RJIT.
2024-03-24 22:37:20 +09:00
Takashi Kokubun cbcb2d46fc
[DOC] Unify Doxygen formats (#10285) 2024-03-19 10:59:25 -07:00
Nobuyoshi Nakada 5fd6b461c7
Refactor encdb and transdb templates
- Simplify globbed file names.
- Prefer `File.open` over `Kernel#open`.
- Swallow initializer blocks instead of line by line with flip-flop.
- Re-structure converter list.
2024-03-17 19:09:37 +09:00
Nobuyoshi Nakada 9e470ebdcd
Revert "Remove flip-flop usages from build scripts"
This reverts commit 301fa452f7.
2024-03-17 18:28:28 +09:00
Nobuyoshi Nakada 9f60fd9d89
Ignore failures on removing ext sub directories
When multiple libraries exist in a subdirectory under `ext`, `rmdir
-p` may fail, because other directories have not been removed yet or
the parent directory has been removed by other `distclean`.  `rmdir`
in GNU coreutils has `--ignore-fail-on-non-empty` option for the
former case but others may not, and the latter race condition is not
avoidable anyway.
2024-03-11 00:46:15 +09:00
Nobuyoshi Nakada 0fb39ab1b9
Clean intermediate files and debug info for each target
By replacing `ALLOBJS` suffix with intermediate file suffixes instead
of roughly removing by wildcards.  Made `cleanlibs` append `.dSYM`
suffix for each word in `TARGET_SO`, not the end of the entire list.
2024-03-10 22:12:00 +09:00
Nobuyoshi Nakada 69cfcd46c2
Remove duplicate dependency line 2024-03-08 11:58:41 +09:00
Nobuyoshi Nakada 1c083c4db0
Clean up files made by runnable in clean-runnable [ci skip] 2024-03-07 16:40:27 +09:00
Nobuyoshi Nakada d1c66456b8
Ingore errors when removing intermediate files recursively [ci skip] 2024-03-07 16:29:48 +09:00
Yuta Saito fd91354628 [DOC] Comment about logic to care about static/dynamic hetero build
The condition is rarely met in usual cases, so it's worth to note about
the situation and the reason why we care about it.
2024-02-21 19:37:06 +09:00
Nobuyoshi Nakada ae8990aef0
Alias init functions
The extension library has each initialization function named "Init_" +
basename. If multiple extensions have the same base name (such as
cgi/escape and erb/escape), the same function will be registered for
both names.

To fix this conflict, rename the initialization functions under sub
directories using using parent names, when statically linking.
2024-02-04 16:43:09 +09:00
Nobuyoshi Nakada c68ce6f7f5
Skip checking for symbol leaks in libruby.so linking extensions
The libruby.so linking extension libraries contain symbols exported
from extension libraries, and is not subject of test-leaked-globals.
2024-01-17 19:37:56 +09:00
Nobuyoshi Nakada 772413245f
Skip checking for symbol leaks in libruby.a linking extensions
The libruby.a linking extension libraries contain symbols exported
from extension libraries, and is not subject of test-leaked-globals.
2024-01-14 23:38:47 +09:00
Nobuyoshi Nakada 3edb7f1a07
[DOC] Documentize known_errors 2024-01-13 11:08:00 +09:00
Mikhail Doronin ae2c4d0720 Revert "[Bug #19831] Remove duplicate library options"
This reverts commit 5bb9462285.

Fixes https://bugs.ruby-lang.org/issues/20072
2023-12-20 13:46:39 +09:00
Nobuyoshi Nakada 6e8ad7497e
Move `DOT_WAIT` before including Makefile that is using it [ci skip] 2023-12-10 13:55:19 +09:00
Nobuyoshi Nakada 22939382a8 [Bug #18286] Make builtin binary if sharable in universal binaries 2023-11-09 16:01:01 +09:00
Nobuyoshi Nakada 40d40a651e Revert "Disable iseq-dumped builtin module for universal x86_64/arm64 binaries"
This reverts commit 1d5598fe0d.
2023-11-09 16:01:01 +09:00
Ben Hamilton 1d5598fe0d Disable iseq-dumped builtin module for universal x86_64/arm64 binaries
During the build, Ruby has special logic to serialize its own builtin
module to disk using the binary iseq format during the build (I assume
for speed so it doesn't have to parse builtin every time it starts
up).

However, since iseq format is architecture-specific, when building on
x86_64 for universal x86_64 + arm64, the serialized builtin module is
written with the x86_64 architecture of the build machine, which fails
this check whenever ruby imports the builtin module on arm64:

1fdaa06660/compile.c (L13243)

Thankfully, there's logic to disable this feature for cross-compiled builds:

1fdaa06660/builtin.c (L6)

This disables the iseq logic for universal builds as well.

Fixes [Bug #18286]
2023-11-09 12:24:01 +09:00
Nobuyoshi Nakada 665b4c5b2a
[Bug #19967] Reset `LIBPATHENV` env after started
Not to affect other tools invoked as child processes.
2023-10-21 14:05:20 +09:00
Nobuyoshi Nakada 96cd73d78f
Ignore symbols even in empty shared library
On some platforms, such as FreeBSD and Oracle Linux, symbols defined
in the crt0 setup routine are exported from shared libraries.  So
ignore the symbols that would be exported even in an empty shared
library.
2023-10-14 18:38:24 +09:00
Nobuyoshi Nakada 20bd19a9ad
Move YARP_BUILD_DIR to common.mk
It does not need to be an absolute path.
2023-09-21 18:18:27 +09:00
Nobuyoshi Nakada bcb3247072
[Bug #19778] Pass additional include options to INCFLAGS in common.mk 2023-09-17 19:18:23 +09:00
Nobuyoshi Nakada 5ec1fc52c1
Escape non-ascii characters in prelude C comments
Non-ASCII code are often warned by localized compilers.
2023-08-24 21:12:51 +09:00
Nobuyoshi Nakada 5bb9462285 [Bug #19831] Remove duplicate library options
`$(MAINLIBS)` should be included in `$(LIBRUBYARG)` in cases it is
needed.
2023-08-17 10:57:09 +09:00
Nobuyoshi Nakada f339937abb RJIT: Remove macros inherited from MJIT but no longer used 2023-08-17 08:33:52 +09:00
Nobuyoshi Nakada 2a3acbc420
Fix test and precheck order for old GNU Make 2023-08-14 11:30:05 +09:00
Nobuyoshi Nakada 475241ee91
Group test-syntax-suggest and leaked-globals [ci skip] 2023-08-11 16:22:18 +09:00
Nobuyoshi Nakada b7453b91dc
[Bug #19831] Remove duplicate library options
`$(MAINLIBS)` should include `$(LIBS)` already.
2023-08-11 09:46:46 +09:00
Takashi Kokubun 38be9a9b72
Clean up OPT_STACK_CACHING (#8132) 2023-07-27 17:27:05 -07:00
Nobuyoshi Nakada 99162dee7a [Bug #19751] Remove linemarkers in middle 2023-07-25 19:30:15 +09:00
Nobuyoshi Nakada 47c7c188e0
Add comments to id.h and undef finished macros 2023-07-21 14:52:43 +09:00
Nobuyoshi Nakada cceb410087 leaked-globals: check leaked symbols in libruby.so if enable-shared 2023-07-08 11:31:17 +09:00
Janosch Müller 08b3fb1152
[Bug #19728] Auto-generate unicode property docs
https://bugs.ruby-lang.org/issues/19728
2023-07-01 23:22:17 +09:00
卜部昌平 d4b662d6f8 template/Doxyfile.tmpl: modernise
applied doxygen -g for Doxygen 1.9.7.
2023-06-29 09:27:12 +09:00
Jemma Issroff d53e1f42ff [Feature #19741] Add yarp to builds
Add yarp to common.mk and windows builds to enable us to run yarp
correctly with CI.
2023-06-21 11:25:39 -07:00
Nobuyoshi Nakada 2a80bac9f0
Remove `--jobserver-auth` option which varies for each run 2023-06-19 18:28:10 +09:00
yui-knk 1740482d06 Fix rb_compile_option_t comments [ci skip] 2023-06-18 14:39:15 +09:00
yui-knk b481b673d7 [Feature #19719] Universal Parser
Introduce Universal Parser mode for the parser.
This commit includes these changes:

* Introduce `UNIVERSAL_PARSER` macro. All of CRuby related functions
  are passed via `struct rb_parser_config_struct` when this macro is enabled.
* Add CI task with 'cppflags=-DUNIVERSAL_PARSER' for ubuntu.
2023-06-12 18:23:48 +09:00
Yuichiro Kaneko a1b01e7701
Use Lrama LALR parser generator instead of Bison
https://bugs.ruby-lang.org/issues/19637

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2023-05-12 18:25:10 +09:00
Nobuyoshi Nakada 3785049c9f
Use RUBY_PROGRAM_VERSION as version in pkg-config file [ci skip]
So that ABI version is not included in it even on the develepment
branch.
2023-04-13 11:31:34 +09:00
Nobuyoshi Nakada 2f1586f6f2 Check leaked global symbols by default 2023-04-03 10:07:22 +09:00
Nobuyoshi Nakada 677c3228d0 Check loading built-in binaries 2023-03-08 13:59:21 +09:00
Takashi Kokubun 23ec248e48 s/mjit/rjit/ 2023-03-06 23:44:01 -08:00