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

8247678: StdLibTest fails to create an empty VaList on Windows #208

Closed
wants to merge 4 commits into from

Conversation

@JornVernee
Copy link
Member

JornVernee commented Jun 16, 2020

Hi,

This patch addresses a test failure in StdLibTest, caused by trying to allocate an empty VaList in the Windows implementation.

(After some discussion with Maurizio) this is fixed by special casing empty va lists in the implementation. VaList.Builder.build() now returns a special empty va list constant when the VaList is empty. There's also an added VaList.empty() method, to directly create an empty VaList.

To implement this I removed the getSegment methods in the VaList implementation classes, and instead rely on VaList::address for unboxing a VaList. This works better with the spacial case empty VaList. Along with that I moved some of the shared code for handling VaList in the linkers to SharedUtils.

I added tests for the empty() API to verify that the returned VaList is non-closeable, and also updated StdLibTest to close the VaLists it creates (it wasn't doing this yet).

Thanks,
Jorn


Progress

  • Change must not contain extraneous whitespace
  • Change must be properly reviewed

Issue

  • JDK-8247678: StdLibTest fails to create an empty VaList on Windows

Reviewers

Download

$ git fetch https://git.openjdk.java.net/panama-foreign pull/208/head:pull/208
$ git checkout pull/208

JornVernee added 2 commits Jun 16, 2020
…ist, by allocating a 1 byte dummy segment in that case.
- Make empty VaList.Builder return the same as VaList.empty
- Add VaList cleanup to StdLibTest
- Add tests for empty va lists
@bridgekeeper
Copy link

bridgekeeper bot commented Jun 16, 2020

👋 Welcome back jvernee! A progress list of the required criteria for merging this PR into foreign-jextract will be added to the body of your pull request.

@openjdk openjdk bot added the rfr label Jun 16, 2020
@mlbridge
Copy link

mlbridge bot commented Jun 16, 2020

Webrevs

Copy link
Collaborator

mcimadamore left a comment

Looks good - only a minor issue with confinement which needs to be worked around with a restricted segment, I believe.

@@ -121,6 +127,23 @@
slices.add(regSaveArea);
}

private static MemoryAddress emptyListAddress() {
MemorySegment ms = MemorySegment.allocateNative(LAYOUT);
cleaner.register(SysVVaList.class, ms::close);

This comment has been minimized.

@mcimadamore

mcimadamore Jun 16, 2020 Collaborator

This will fail because of confinement

This comment has been minimized.

@JornVernee

JornVernee Jun 16, 2020 Author Member

Thanks, I fixed it by switching to Unsafe for the allocation, so that we can free from any thread.

- Update VaList benchmark to use the new 'make' factory
@JornVernee JornVernee changed the base branch from foreign-jextract to foreign-abi Jun 16, 2020
Copy link
Collaborator

mcimadamore left a comment

Looks good - thanks for fixing the benchmark.

@openjdk
Copy link

openjdk bot commented Jun 16, 2020

@JornVernee This change now passes all automated pre-integration checks, type /integrate in a new comment to proceed. After integration, the commit message will be:

8247678: StdLibTest fails to create an empty VaList on Windows

Reviewed-by: mcimadamore
  • If you would like to add a summary, use the /summary command.
  • To credit additional contributors, use the /contributor command.
  • To add additional solved issues, use the /issue command.

Since the source branch of this PR was last updated there have been 2 commits pushed to the foreign-abi branch:

  • 2ed13bf: 8247678: StdLibTest fails to create an empty VaList on Windows
  • 5c7c216: 8247488: Add support for string helpers in CSupport (decoding support)

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid automatic rebasing, please merge foreign-abi into your branch, and then specify the current head hash when integrating, like this: /integrate 2ed13bf9313018510b444b8a92545822871a61fe.

➡️ To integrate this PR with the above commit message to the foreign-abi branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready label Jun 16, 2020
@JornVernee
Copy link
Member Author

JornVernee commented Jun 16, 2020

/integrate

@openjdk openjdk bot closed this Jun 16, 2020
@openjdk openjdk bot added integrated and removed ready labels Jun 16, 2020
@openjdk
Copy link

openjdk bot commented Jun 16, 2020

@JornVernee The following commits have been pushed to foreign-abi since your change was applied:

  • 5c7c216: 8247488: Add support for string helpers in CSupport (decoding support)

Your commit was automatically rebased without conflicts.

Pushed as commit 2ed13bf.

@openjdk openjdk bot removed the rfr label Jun 16, 2020
@JornVernee JornVernee deleted the JornVernee:Empty_VaList branch Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.