Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pcre2: Update to upstream version 10.42 (reverted) #70447

Merged
merged 1 commit into from
Dec 23, 2022

Conversation

akien-mga
Copy link
Member

Changelog: https://github.com/PCRE2Project/pcre2/blob/pcre2-10.42/ChangeLog

This should also fix support for RISC-V architectures, at least in the sljit library.
@aaronfranke Could you test and confirm?

I see that upstream sljit is fairly active still improving riscv support (https://github.com/zherczeg/sljit/commits/master), so it might be that the current snapshot as of pcre2 10.42 doesn't work fully yet. If so we can postpone enabling the lib on RISC-V to a future release (or maybe keep building the regex module, but just disable JIT with env["builtin_pcre2_with_jit"], as we already do for Web).

Changelog: https://github.com/PCRE2Project/pcre2/blob/pcre2-10.42/ChangeLog

This should also fix support for RISC-V architectures, at least in the sljit
library.
@akien-mga akien-mga added this to the 4.0 milestone Dec 22, 2022
@akien-mga akien-mga requested review from a team as code owners December 22, 2022 15:36
@akien-mga akien-mga added cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release labels Dec 22, 2022
Copy link
Member

@aaronfranke aaronfranke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This compiles on RISC-V (scons use_llvm=yes on a rv64gc virtual machine / emulator).

@akien-mga akien-mga merged commit 4bf6992 into godotengine:master Dec 23, 2022
@akien-mga akien-mga deleted the pcre2-10.42 branch December 23, 2022 08:13
@vonagam
Copy link
Contributor

vonagam commented Dec 23, 2022

This PR caused those lines to appear (repeated multiple times) in unit tests logs at the start.

ERROR: Condition "p_ptr == nullptr" is true.
   at: free_static (core/os/memory.cpp:148)

While tests do not fail because of that, this does not seem right...
Or is it unavoidable known issue?

@akien-mga
Copy link
Member Author

akien-mga commented Dec 23, 2022

Backtrace:

(gdb) bt
#0  Memory::free_static (p_ptr=0x0, p_pad_align=false) at core/os/memory.cpp:149
#1  0x0000000006c247fb in _regex_free (ptr=0x0, user=0x0) at modules/regex/regex.cpp:43
#2  0x0000000006c1cb84 in pcre2_match_32 (code=0xc9019b0, subject=0xc8a74c0, length=9, start_offset=0, options=0, match_data=0xc830060, mcontext=0xc9863b0) at thirdparty/pcre2/src/pcre2_match.c:6846
#3  0x0000000006c25c85 in RegEx::search (this=0x7fffffffc300, p_subject=..., p_offset=0, p_end=-1) at modules/regex/regex.cpp:219
#4  0x00000000057cfee7 in TestRegEx::DOCTEST_ANON_FUNC_6556 () at ./modules/regex/tests/test_regex.h:81
#5  0x00000000053d282d in doctest::Context::run (this=0x7fffffffd0e0) at ./thirdparty/doctest/doctest.h:6930
#6  0x00000000057d5540 in test_main (argc=2, argv=0x7fffffffd728) at tests/test_main.cpp:174
#7  0x0000000005393ec2 in Main::test_entrypoint (argc=2, argv=0x7fffffffd728, tests_need_run=@0x7fffffffd1bf: true) at main/main.cpp:608
#8  0x0000000005333cc2 in main (argc=2, argv=0x7fffffffd728) at platform/linuxbsd/godot_linuxbsd.cpp:55

It probably comes from this change:

9. Removed the use of an initial backtracking frames vector on the system stack
in pcre2_match() so that it now always uses the heap. (In a multi-thread
environment with very small stacks there had been an issue.) This also is
tidier for JIT matching, which didn't need that vector. The heap vector is now
remembered in the match data block and re-used if that block itself is re-used.
It is freed with the match data block.

We likely need to change our _regex_free (and maybe _regex_malloc) to take this new heap vector into account somehow.

akien-mga added a commit that referenced this pull request Dec 23, 2022
This reverts commit 62c3e4a.

Needs more work, see comments about `_regex_free` errors in #70447.
@akien-mga
Copy link
Member Author

I reverted the change for now with d0398f6. I'll reopen the PR as a draft until we find how to change modules/regex/regex.cpp to take the internal memory change into account.

@akien-mga akien-mga removed cherrypick:3.x Considered for cherry-picking into a future 3.x release cherrypick:3.5 Considered for cherry-picking into a future 3.5.x release labels Dec 23, 2022
@akien-mga akien-mga changed the title pcre2: Update to upstream version 10.42 pcre2: Update to upstream version 10.42 (reverted) Dec 23, 2022
DissonantVoid pushed a commit to DissonantVoid/godot that referenced this pull request Dec 26, 2022
This reverts commit 62c3e4a.

Needs more work, see comments about `_regex_free` errors in godotengine#70447.
rohanrhu pushed a commit to rohanrhu/godot that referenced this pull request Dec 28, 2022
This reverts commit 62c3e4a.

Needs more work, see comments about `_regex_free` errors in godotengine#70447.
rohanrhu pushed a commit to rohanrhu/godot that referenced this pull request Dec 28, 2022
This reverts commit 62c3e4a.

Needs more work, see comments about `_regex_free` errors in godotengine#70447.
Streq pushed a commit to Streq/godot that referenced this pull request Feb 9, 2023
This reverts commit 62c3e4a.

Needs more work, see comments about `_regex_free` errors in godotengine#70447.
@lmurray lmurray mentioned this pull request Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants