Skip to content

Commit

Permalink
svm: reset ThreadGroup.weaks on JDK 19
Browse files Browse the repository at this point in the history
All ThreadGroups are recomputed and stored in the strong
ThreadGroup.groups field.
  • Loading branch information
zapster committed Jul 19, 2022
1 parent 928547d commit 04760c4
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/
package com.oracle.svm.core.thread;

import java.lang.ref.WeakReference;
import java.util.Arrays;

import org.graalvm.compiler.serviceprovider.JavaVersionUtil;
Expand All @@ -41,6 +42,7 @@
import com.oracle.svm.core.annotate.Uninterruptible;
import com.oracle.svm.core.heap.Heap;
import com.oracle.svm.core.jdk.JDK17OrEarlier;
import com.oracle.svm.core.jdk.JDK19OrLater;
import com.oracle.svm.core.jdk.UninterruptibleUtils;
import com.oracle.svm.util.ReflectionUtil;

Expand Down Expand Up @@ -77,6 +79,16 @@ final class Target_java_lang_ThreadGroup {
@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Custom, declClass = ThreadGroupGroupsRecomputation.class, disableCaching = true)//
private ThreadGroup[] groups;

/*
* All ThreadGroups in the image heap are strong and will be stored in ThreadGroup.groups.
*/
@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset)//
@TargetElement(onlyWith = JDK19OrLater.class)//
private int nweaks;
@Alias @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.Reset)//
@TargetElement(onlyWith = JDK19OrLater.class)//
private WeakReference<ThreadGroup>[] weaks;

@Inject @InjectAccessors(ThreadGroupIdAccessor.class) //
public long id;

Expand Down

0 comments on commit 04760c4

Please sign in to comment.