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

8295697: Resolve conflicts between serviceability/jvmti and nsk/jvmti shared code #10733

Closed
wants to merge 4 commits into from

Conversation

alexmenkov
Copy link

@alexmenkov alexmenkov commented Oct 17, 2022

The fix resolved conflicts between jvmti test shared code: test/lib/jdk/test/lib/jvmti/jvmti_common.h and test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/* to allot NSK tests to use jvmti_common.h

testing: test native libraries are built before any test execution, so run build job should be enough, but for safety I also run test/hotspot/jtreg/vmTestbase/nsk/jvmti and test/hotspot/jtreg/serviceability/jvmti


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8295697: Resolve conflicts between serviceability/jvmti and nsk/jvmti shared code

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/10733/head:pull/10733
$ git checkout pull/10733

Update a local copy of the PR:
$ git checkout pull/10733
$ git pull https://git.openjdk.org/jdk pull/10733/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 10733

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/10733.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Oct 17, 2022

👋 Welcome back amenkov! 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 added the rfr Pull request is ready for review label Oct 17, 2022
@openjdk
Copy link

openjdk bot commented Oct 17, 2022

@alexmenkov The following label will be automatically applied to this pull request:

  • serviceability

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the serviceability serviceability-dev@openjdk.org label Oct 17, 2022
@mlbridge
Copy link

mlbridge bot commented Oct 17, 2022

Webrevs

Copy link
Member

@lmesnik lmesnik left a comment

Choose a reason for hiding this comment

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

There is a lib ~/ws/jdk/open/test/lib/jdk/test/lib/jvmti/jvmti_common.h which has print_stack_trace. Could it be re-used instead?

jvmti->Deallocate((unsigned char*)methodSig);
}

static void printStackTrace(jvmtiEnv *jvmti, jthread thread) {
Copy link
Contributor

@sspitsyn sspitsyn Oct 18, 2022

Choose a reason for hiding this comment

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

We normally use C naming convention for function names.
The exception is JVMTI event call backs.
For serviceability/jvmti tests we already have this:
test/lib/jdk/test/lib/jvmti/jvmti_common.h
You can check for print_stack_trace() function there.
It depends on a couple of other library functions though.
Unfortunately, we do not have such utility functions for nsk tests.
We may want something similar for nsk/jvmti tests.
If so, then it is better, at least, to keep the same function names and signatures if possible.
It'd make sense to check with Leonid on what approach to take.

Copy link
Contributor

Choose a reason for hiding this comment

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

Most of this code seems to have been copied from Java_nsk_jvmti_GetStackTrace_getstacktr001_check. Maybe some consolidating would be good.

@alexmenkov
Copy link
Author

Thank you for review.
It was supposed to be a small local fix, but I agree with the point about code duplication.
We have 2 places with shared code for JVMTI tests:
test/lib/jdk/test/lib/jvmti/jvmti_common.h
and
test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/

jvmti_common.h contains both declaration and definitions, NSK shared files have separate .h and .cpp files (.cpp files are included in test .cpp files)

This 2 "libraries" have some duplicate functions and cannot be used simultaneously (a number of compiler errors).
I'm trying to resolve this without massive code change.
The plan is to include jvmti_common.h in some nsk shared files and remove duplicated functions from nsk files.
@lmesnik what do you think about the approach?

@lmesnik
Copy link
Member

lmesnik commented Oct 18, 2022

Sounds good to me. We could reuse print_frame after this.

@sspitsyn
Copy link
Contributor

Nice plan, thanks!

@alexmenkov
Copy link
Author

  • resolved serviceability/jvmti and nsk/share/jvmti conflicts
  • removed duplicated functions
  • popframe004 test uses print_stack_trace from jvmti_common.h
  • JVMTITools.h and JVMTITools.cpp are empty now, but the files are included in many nsk tests

@plummercj
Copy link
Contributor

I think the cleanup is disruptive enough that it should be a separate PR. Probably the easiest approach is to file a new CR for the cleanup and repurpose this PR for it, which means also moving the popframe004.cpp changes to a new PR.

*/
char *jlong_to_string(jlong value, char *string);
//char *jlong_to_string(jlong value, char *string);
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems odd to have jlong_to_string and julong_to_string implemented in different places. Maybe more cleanup is needed here.

Copy link
Contributor

@sspitsyn sspitsyn Oct 19, 2022

Choose a reason for hiding this comment

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

I'd suggest to move julong_to_string to the same place where the jlong_to_string is placed and remove all these with the comments from jni_tools.
I agree, we may need to file a separate bug for global cleanup which should get rid of JVMTITools.*.

Copy link
Author

Choose a reason for hiding this comment

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

I moved julong_to_string (and define for julong type) to jvmti_common.h
About JVMTITools.*
JVMTITools.cpp is included in 628 tests, JVMTITools.h is included in 348 files.
I don't think removing this 2 files worth such massive change

@alexmenkov alexmenkov changed the title 8295427: popframe004: report more details on error 8295697: Resolve conflicts between serviceability/jvmti and nsk/jvmti shared code Oct 20, 2022
Copy link
Contributor

@sspitsyn sspitsyn left a comment

Choose a reason for hiding this comment

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

Looks good to me.
Thank you for the update.
Serguei

@openjdk
Copy link

openjdk bot commented Oct 20, 2022

@alexmenkov This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8295697: Resolve conflicts between serviceability/jvmti and nsk/jvmti shared code

Reviewed-by: lmesnik, sspitsyn, cjplummer

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 75 new commits pushed to the master branch:

  • c5e0464: 8291456: com/sun/jdi/ClassUnloadEventTest.java failed with: Wrong number of class unload events: expected 10 got 4
  • 8d4c077: 8295302: Do not use ArrayList when LambdaForm has a single ClassData
  • 017e798: 8293939: Move continuation_enter_setup and friends
  • f872467: 8255746: Make PrintCompilation available on a per method level
  • 388a56e: 8294467: Fix sequence-point warnings in Hotspot
  • ceb5b08: 8294468: Fix char-subscripts warnings in Hotspot
  • 7b1c676: 8295662: jdk/incubator/vector tests fail "assert(VM_Version::supports_avx512vlbw()) failed"
  • 5eaf568: 8295668: validate-source failure after JDK-8290011
  • e238920: 8295372: CompactNumberFormat handling of number one with decimal part
  • a5f6e31: 8295456: (ch) sun.nio.ch.Util::checkBufferPositionAligned gives misleading/incorrect error
  • ... and 65 more: https://git.openjdk.org/jdk/compare/2087424736f15a5a80a0492993a6cd74da87188a...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

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

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Oct 20, 2022
Copy link
Contributor

@plummercj plummercj left a comment

Choose a reason for hiding this comment

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

Looks good!

@alexmenkov
Copy link
Author

/integrate

@openjdk
Copy link

openjdk bot commented Oct 20, 2022

Going to push as commit 6240431.
Since your change was applied there have been 93 commits pushed to the master branch:

  • 1164258: 8295124: Atomic::add to pointer type may return wrong value
  • d3eba85: 8295414: [Aarch64] C2: assert(false) failed: bad AD file
  • 028e8b3: 8137022: Concurrent refinement thread adjustment and (de-)activation suboptimal
  • faa6b66: 8295715: Minimize disabled warnings in serviceability libs
  • de1e0c5: 8295719: Remove unneeded disabled warnings in jdk.sctp
  • 9612cf9: 8295529: Add link to JBS to README.md
  • b37421e: 8295564: Norwegian Nynorsk Locale is missing formatting
  • 6707bfb: 8029633: Raw inner class constructor ref should not perform diamond inference
  • 7bc9692: 8294670: Enhanced switch statements have an implicit default which does not complete normally
  • 95dd376: 8291914: generated constructors are considered compact when they shouldn't
  • ... and 83 more: https://git.openjdk.org/jdk/compare/2087424736f15a5a80a0492993a6cd74da87188a...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Oct 20, 2022
@openjdk openjdk bot closed this Oct 20, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Oct 20, 2022
@openjdk
Copy link

openjdk bot commented Oct 20, 2022

@alexmenkov Pushed as commit 6240431.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@alexmenkov alexmenkov deleted the popframe4 branch October 20, 2022 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated serviceability serviceability-dev@openjdk.org
4 participants