-
Notifications
You must be signed in to change notification settings - Fork 137
playing about with simpler buffer copying #1841
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
base: lworld
Are you sure you want to change the base?
Conversation
|
👋 Welcome back david-beaumont! A progress list of the required criteria for merging this PR into |
|
❗ This change is not yet ready to be integrated. |
| } | ||
| assert(cfs != nullptr, "must be able to read the classfile data of shared classes for built-in loaders."); | ||
| log_debug(aot, jvmti)("classfile data for %s [%d: %s] = %d bytes", class_name, path_index, | ||
| log_debug(aot, jvmti)("classfile data for %s [%d: %s] = %d bytes", file_name, path_index, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming (hoping) that the exact format of this log is not expected to be important to anyone.
| // Include terminating nul. | ||
| int name_len = symbol->utf8_length() + 1; | ||
| char* const buffer = NEW_RESOURCE_ARRAY(char, name_len + padding_len); | ||
| symbol->as_C_string(buffer, name_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoids intermediate copy as happened in previous code.
| } | ||
|
|
||
| // caller needs ResourceMark | ||
| const char* ClassLoader::file_name_for_class_name(const Symbol* class_name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While it's undocumented in the code, I'm assuming that the symbol name is <module>/path/to/ClassName (e.g. "java.base/java/lang/Integer").
This is because all the existing code does is append ".class" to the end.
| const char* const file_name = file_name_for_class_name(name); | ||
| assert(file_name != nullptr, "invariant"); | ||
|
|
||
| EventMarkClassLoading m("Loading class %s", file_name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure what's going on here, so someone needs to check that this looks sane.
| static const char* file_name_for_class_name(const char* class_name, | ||
| int class_name_len); | ||
|
|
||
| static char* symbol_name_to_padded_buffer(const Symbol* symbol, int padding_len); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I should probably declare this private ...
Not a real pull request yet, just experimenting with simplifying buffer copying.
Progress
Reviewing
Using
gitCheckout this PR locally:
$ git fetch https://git.openjdk.org/valhalla.git pull/1841/head:pull/1841$ git checkout pull/1841Update a local copy of the PR:
$ git checkout pull/1841$ git pull https://git.openjdk.org/valhalla.git pull/1841/headUsing Skara CLI tools
Checkout this PR locally:
$ git pr checkout 1841View PR using the GUI difftool:
$ git pr show -t 1841Using diff file
Download this PR as a diff file:
https://git.openjdk.org/valhalla/pull/1841.diff