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

Remove vmSnapshotFilePath from J9SpecialArguments #20532

Merged
merged 1 commit into from
Nov 7, 2024

Conversation

ThanHenderson
Copy link
Contributor

@ThanHenderson ThanHenderson commented Nov 7, 2024

Signed-off-by: Nathan Henderson [email protected]

Copy link
Contributor

@babsingh babsingh left a comment

Choose a reason for hiding this comment

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

While this approach does save on an intermediary pointer, it requires an additional iteration through the args list. In the worst case, depending on the location of the -Xsnapshot= option and the size of the list, it may result in a full traversal of a potentially large args list, which could negatively impact startup performance. Although this incurs additional memory usage, the impact on startup time outweighs the benefit of reduced memory usage. @tajila Thoughts?

runtime/j9vm/jvm.c Outdated Show resolved Hide resolved
@ThanHenderson
Copy link
Contributor Author

ThanHenderson commented Nov 7, 2024

Removing the additional memory that a pointer takes up wasn't the main thrust behind this; it is more so a code cleanliness patch.

I understand that ideally we would not traverse the args list again in its entirety, but VMOPT_XSNAPSHOT has little overlap with other options, so the strncmp would be short circuited relatively quickly (at most 4 bytes are being compared per non-matching arg that is specified after VMOPT_XSNAPSHOT i.e. with VMOPT_XSNW).

To get around this, we could also pass createParams into initialArgumentScan. I had avoided this approach because the parameter would be unused within the function when J9VM_OPT_SNAPSHOTS code isn't defined. I guess I could just guard the function parameter too though. I've pushed a second commit that implements this version.

@ThanHenderson
Copy link
Contributor Author

Actually, we could just change the initialArgumentScan signature to:
initialArgumentScan(JavaVMInitArgs *args, J9SpecialArguments *specialArgs, J9CreateJavaVMParams *createParams)
regardless of whether J9VM_OPT_SNAPSHOT code is generated, and just set the localVerboseLevel in that function rather than outside of it like it is done now:

openj9/runtime/j9vm/jvm.c

Lines 2246 to 2250 in dc42c9a

localVerboseLevel = specialArgs.localVerboseLevel;
if (VERBOSE_INIT == localVerboseLevel) {
createParams.flags |= J9_CREATEJAVAVM_VERBOSE_INIT;
}

runtime/j9vm/jvm.c Outdated Show resolved Hide resolved
@babsingh
Copy link
Contributor

babsingh commented Nov 7, 2024

jenkins test sanity.functional amac jdk21

@babsingh
Copy link
Contributor

babsingh commented Nov 7, 2024

The PR builds will test the changes in the disabled state. @ThanHenderson Did you test these changes in the enabled state; do they look good?

@ThanHenderson
Copy link
Contributor Author

ThanHenderson commented Nov 7, 2024

Yes, I have tested it. All good.

@babsingh babsingh merged commit 26133ff into eclipse-openj9:master Nov 7, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants