< prev index next >
src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java
Print this page
rev 16767 : 8175561: Memory churn in jimage code affects startup after resource encapsulation changes
Reviewed-by: jlaskey
rev 16768 : imported patch imgstr_oneup
*** 247,261 ****
public ImageStringsReader getStrings() {
return stringsReader;
}
! public ImageLocation findLocation(String mn, String rn) {
! Objects.requireNonNull(mn);
! Objects.requireNonNull(rn);
! return findLocation("/" + mn + "/" + rn);
}
public synchronized ImageLocation findLocation(String name) {
Objects.requireNonNull(name);
// Details of the algorithm used here can be found in
--- 247,281 ----
public ImageStringsReader getStrings() {
return stringsReader;
}
! public synchronized ImageLocation findLocation(String module, String name) {
! Objects.requireNonNull(module);
! Objects.requireNonNull(name);
! // Details of the algorithm used here can be found in
! // jdk.tools.jlink.internal.PerfectHashBuilder.
! int count = header.getTableLength();
! int index = redirect.get(ImageStringsReader.hashCode(module, name) % count);
!
! if (index < 0) {
! // index is twos complement of location attributes index.
! index = -index - 1;
! } else if (index > 0) {
! // index is hash seed needed to compute location attributes index.
! index = ImageStringsReader.hashCode(module, name, index) % count;
! } else {
! // No entry.
! return null;
! }
!
! long[] attributes = getAttributes(offsets.get(index));
! if (!ImageLocation.verify(module, name, attributes, stringsReader)) {
! return null;
! }
! return new ImageLocation(attributes, stringsReader);
}
public synchronized ImageLocation findLocation(String name) {
Objects.requireNonNull(name);
// Details of the algorithm used here can be found in
< prev index next >