package com.oracle.svm.core;
import org.graalvm.collections.EconomicMap;
import org.graalvm.compiler.options.Option;
import org.graalvm.compiler.options.OptionKey;
import org.graalvm.compiler.options.OptionType;
import com.oracle.svm.core.option.HostedOptionKey;
import com.oracle.svm.core.option.RuntimeOptionKey;
import com.oracle.svm.core.option.XOptions;
public class SubstrateGCOptions {
@Option(help = "Print summary GC information after each collection", type = OptionType.Expert)
public static final RuntimeOptionKey<Boolean> PrintGC = new RuntimeOptionKey<>(false);
@Option(help = "Print more information about the heap before and after each collection", type = OptionType.Expert)
public static final RuntimeOptionKey<Boolean> VerboseGC = new RuntimeOptionKey<>(false);
@Option(help = "Determines if references from runtime-compiled code to Java heap objects should be treated as strong or weak.", type = OptionType.Debug)
public static final HostedOptionKey<Boolean> TreatRuntimeCodeInfoReferencesAsWeak = new HostedOptionKey<>(true);
@Option(help = "Verify the heap before and after each collection.")
public static final HostedOptionKey<Boolean> VerifyHeap = new HostedOptionKey<>(false);
@Option(help = "Ignore calls to System.gc()", type = OptionType.Expert)
public static final RuntimeOptionKey<Boolean> DisableExplicitGC = new RuntimeOptionKey<>(false);
@Option(help = "The minimum heap size at run-time, in bytes.", type = OptionType.User)
public static final RuntimeOptionKey<Long> MinHeapSize = new RuntimeOptionKey<Long>(0L) {
@Override
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Long oldValue, Long newValue) {
if (!SubstrateUtil.HOSTED) {
XOptions.getXms().setValue(newValue);
}
}
};
@Option(help = "The maximum heap size at run-time, in bytes.", type = OptionType.User)
public static final RuntimeOptionKey<Long> MaxHeapSize = new RuntimeOptionKey<Long>(0L) {
@Override
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Long oldValue, Long newValue) {
if (!SubstrateUtil.HOSTED) {
XOptions.getXmx().setValue(newValue);
}
}
};
@Option(help = "The maximum size of the young generation at run-time, in bytes", type = OptionType.User)
public static final RuntimeOptionKey<Long> MaxNewSize = new RuntimeOptionKey<Long>(0L) {
@Override
protected void onValueUpdate(EconomicMap<OptionKey<?>, Object> values, Long oldValue, Long newValue) {
if (!SubstrateUtil.HOSTED) {
XOptions.getXmn().setValue(newValue);
}
}
};
}