Skip to content

Commit a7b6b61

Browse files
committed
Remove stackWalks for LUDCL outside of resolveClass
There exist different points where LUDCL is refreshed by a stackWalk where it's not needed, this commit removes these cases and stackWalking only when it needs to. Signed-off-by: Abdulrahman Alattas <[email protected]>
1 parent c497cf3 commit a7b6b61

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/java.base/share/classes/java/io/ObjectInputStream.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,18 +568,18 @@ private final Object readObject(Class<?> type, Class<?> caller)
568568

569569
if (((null == curContext) || refreshLudcl) && isClassCachingEnabled) {
570570
oldCachedLudcl = cachedLudcl;
571+
setCached = true;
571572

572573
// If caller is not provided, follow the standard path to get the cachedLudcl.
573574
// Otherwise use the class loader provided by JIT as the cachedLudcl.
574575

575576
if (caller == null) {
576-
cachedLudcl = latestUserDefinedLoader();
577+
refreshLudcl = true;
577578
} else {
578579
cachedLudcl = caller.getClassLoader();
580+
refreshLudcl = false;
579581
}
580582

581-
setCached = true;
582-
refreshLudcl = false;
583583
if (null == startingLudclObject) {
584584
startingLudclObject = this;
585585
}
@@ -694,9 +694,8 @@ public Object readUnshared() throws IOException, ClassNotFoundException {
694694

695695
if (((null == curContext) || refreshLudcl) && isClassCachingEnabled) {
696696
oldCachedLudcl = cachedLudcl;
697-
cachedLudcl = latestUserDefinedLoader();
698697
setCached = true;
699-
refreshLudcl = false;
698+
refreshLudcl = true;
700699
if (null == startingLudclObject) {
701700
startingLudclObject = this;
702701
}

0 commit comments

Comments
 (0)