Skip to content

8383262: Implement optimized aarch64_get_thread_helper() for Windows/AArch64#605

Closed
raneashay wants to merge 1 commit into
openjdk:masterfrom
openjdk-bots:backport-raneashay-54146ada-master
Closed

8383262: Implement optimized aarch64_get_thread_helper() for Windows/AArch64#605
raneashay wants to merge 1 commit into
openjdk:masterfrom
openjdk-bots:backport-raneashay-54146ada-master

Conversation

@raneashay

@raneashay raneashay commented Jun 11, 2026

Copy link
Copy Markdown

Required not just for the performance optimization from the patch but also because without this patch, several AOT tests fail:

  • runtime/cds/MetaspaceAllocGaps
  • runtime/cds/appcds/aotCache/HelloAOTCache
  • runtime/cds/appcds/aotCode/AOTCodeCompressedOopsTest
  • runtime/cds/appcds/aotCode/AOTCodeFlags#Z
  • runtime/cds/appcds/aotCode/AOTCodeFlags#default_gc
  • runtime/cds/appcds/aotCode/AOTCodeFlags#parallel
  • runtime/cds/appcds/aotCode/AOTCodeFlags#shenandoah

The reason for the AOT tests failing without this patch is that without this patch, the MSVC compiler applies an optimization called Identical COMDAT Folding (ICF) that results in both Thread::current() and aarch64_get_thread_helper() being mapped to the same address (since before this patch, aarch64_get_thread_helper() simply called Thread::current()). In FastDebug builds, this results in the assertion failure _hash_table->get(addr) == nullptr. In Release builds, since assertions are dropped, the duplicate insert silently overwrites the table entry, so Release builds don't see the test failure. Slow debug builds also don't see test failures because in slo debug builds, MSVC does not apply ICF.

Patch applies cleanly from JDK tip.



Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • JDK-8383262 needs maintainer approval

Issue

  • JDK-8383262: Implement optimized aarch64_get_thread_helper() for Windows/AArch64 (Enhancement - P4 - Requested)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk25u-dev.git pull/605/head:pull/605
$ git checkout pull/605

Update a local copy of the PR:
$ git checkout pull/605
$ git pull https://git.openjdk.org/jdk25u-dev.git pull/605/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 605

View PR using the GUI difftool:
$ git pr show -t 605

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk25u-dev/pull/605.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper

bridgekeeper Bot commented Jun 11, 2026

Copy link
Copy Markdown

👋 Welcome back arane! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk

openjdk Bot commented Jun 11, 2026

Copy link
Copy Markdown

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk Bot changed the title Backport 54146adae04f4d62124b328ba6ab02115334a8f2 8383262: Implement optimized aarch64_get_thread_helper() for Windows/AArch64 Jun 11, 2026
@openjdk

openjdk Bot commented Jun 11, 2026

Copy link
Copy Markdown

This backport pull request has now been updated with issue from the original commit.

@openjdk openjdk Bot added backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required labels Jun 11, 2026
@openjdk

openjdk Bot commented Jun 11, 2026

Copy link
Copy Markdown

⚠️ @raneashay This change is now ready for you to apply for maintainer approval. This can be done directly in each associated issue or by using the /approval command.

@openjdk openjdk Bot added the rfr Pull request is ready for review label Jun 11, 2026
@mlbridge

mlbridge Bot commented Jun 11, 2026

Copy link
Copy Markdown

Webrevs

@raneashay

Copy link
Copy Markdown
Author

/approval request Several AOT tests fail without this patch because the MSVC compiler applies an optimization called Identical COMDAT Folding (ICF) that results in both Thread::current() and aarch64_get_thread_helper() being mapped to the same address (since before this patch, aarch64_get_thread_helper() simply called Thread::current()). In FastDebug builds, this results in the assertion failure _hash_table->get(addr) == nullptr. In Release builds, since assertions are dropped, the duplicate insert silently overwrites the table entry, so Release builds don't see the test failure. Slow debug builds also don't see test failures because in slo debug builds, MSVC does not apply ICF.

@openjdk

openjdk Bot commented Jun 11, 2026

Copy link
Copy Markdown

@raneashay
8383262: The approval request has been created successfully.

@openjdk openjdk Bot added the approval Requires approval; will be removed when approval is received label Jun 11, 2026
@GoeLin

GoeLin commented Jun 15, 2026

Copy link
Copy Markdown
Member

Hi @raneashay
Please check the failed tests. Next time, please do this before asking for approval.

When was this bug introduced? Is it caused by a new compiler that implements the optimization you mention?

How did you test?

@theRealAph

Copy link
Copy Markdown

In FastDebug builds, this results in the assertion failure _hash_table->get(addr) == nullptr

Where is this assertion?

char* tls_block = (char*)tls_array[_tls_index];

// Compute the offset of Thread::_thr_current within this module's TLS
// block. Unlike ELF, which provides `tlsdesc` relocations that lets

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
// block. Unlike ELF, which provides `tlsdesc` relocations that lets
// block. Unlike ELF, which provides `tlsdesc` relocations that let

@raneashay raneashay closed this Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approval Requires approval; will be removed when approval is received backport Port of a pull request already in a different code base clean Identical backport; no merge resolution required rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

3 participants