Skip to content

Commit

Permalink
Merge pull request #333 from jdmpapin/mn-finalize
Browse files Browse the repository at this point in the history
Add MemberName finalizer to mark clazz for MemberName list pruning
  • Loading branch information
keithc-ca authored Mar 25, 2024
2 parents ea48af2 + 1619e47 commit 42b3c9d
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/java.base/share/classes/java/lang/invoke/MemberName.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2024, 2024 All Rights Reserved
* ===========================================================================
*/

package java.lang.invoke;

import sun.invoke.util.BytecodeDescriptor;
Expand Down Expand Up @@ -1196,4 +1202,11 @@ private static MemberName[] newMemberBuffer(int length) {
return buf;
}
}

@Override
protected void finalize() {
if (null != clazz) {
MethodHandleNatives.markClassForMemberNamePruning(clazz);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
* questions.
*/

/*
* ===========================================================================
* (c) Copyright IBM Corp. 2024, 2024 All Rights Reserved
* ===========================================================================
*/

package java.lang.invoke;

import jdk.internal.access.JavaLangAccess;
Expand Down Expand Up @@ -690,4 +696,9 @@ static Object classData(Class<?> c) {
UNSAFE.ensureClassInitialized(c);
return JLA.classData(c);
}

/**
* Inform the VM that a MemberName belonging to class c has been collected.
*/
static native void markClassForMemberNamePruning(Class<?> c);
}

0 comments on commit 42b3c9d

Please sign in to comment.