Skip to content

Commit

Permalink
Fix reset of compilation profile in TruffleFeature.
Browse files Browse the repository at this point in the history
  • Loading branch information
chumer committed Nov 5, 2019
1 parent 3409520 commit ca2533f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,13 @@ public abstract class OptimizedCallTarget implements CompilableTruffleAST, RootC
/**
* The call threshold is counted down for each real call until it reaches zero and triggers a
* {@link #compile(boolean) compilation}. It is decremented for each real call to the call
* target.
* target. Reset by TruffleFeature after boot image generation.
*/
private int callThreshold;
/**
* The call and loop threshold is counted down for each real call and reported loop count until
* it reaches zero and triggers a {@link #compile(boolean) compilation}.
* it reaches zero and triggers a {@link #compile(boolean) compilation}. Reset by TruffleFeature
* after boot image generation.
*/
private int callAndLoopThreshold;

Expand All @@ -117,14 +118,19 @@ public abstract class OptimizedCallTarget implements CompilableTruffleAST, RootC
* installed *after* installing profile information, but the assumption is invalidated *before*
* invalidating profile information. This ensures that the compiler sees an invalidated
* assumption in case a race happens. Note that OptimizedAssumption.invalidate() performs
* synchronization and is therefore a memory barrier.
* synchronization and is therefore a memory barrier. Reset by TruffleFeature after boot image
* generation.
*/
@CompilationFinal(dimensions = 1) private Class<?>[] profiledArgumentTypes;
@CompilationFinal private OptimizedAssumption profiledArgumentTypesAssumption;
@CompilationFinal private Class<?> profiledReturnType;
@CompilationFinal private OptimizedAssumption profiledReturnTypeAssumption;
@CompilationFinal private Class<? extends Throwable> profiledExceptionType;

/**
* Set if compilation failed or was ignored. Reset by TruffleFeature after boot image
* generation.
*/
private volatile boolean compilationFailed;
/**
* Whether the call profile was preinitialized with a fixed set of type classes. In such a case
Expand All @@ -133,6 +139,10 @@ public abstract class OptimizedCallTarget implements CompilableTruffleAST, RootC
*/
@CompilationFinal private boolean callProfiled;

/**
* Timestamp when the call target was initialized e.g. used the first time. Reset by
* TruffleFeature after boot image generation.
*/
private volatile long initializedTimestamp;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import java.util.function.Predicate;
import java.util.stream.Collectors;

import com.oracle.svm.core.annotate.Delete;
import org.graalvm.compiler.api.replacements.SnippetReflectionProvider;
import org.graalvm.compiler.nodes.ConstantNode;
import org.graalvm.compiler.nodes.StructuredGraph;
Expand All @@ -78,12 +77,12 @@
import org.graalvm.compiler.truffle.compiler.SharedTruffleCompilerOptions;
import org.graalvm.compiler.truffle.compiler.nodes.asserts.NeverPartOfCompilationNode;
import org.graalvm.compiler.truffle.compiler.substitutions.KnownTruffleTypes;
import org.graalvm.compiler.truffle.runtime.OptimizedAssumption;
import org.graalvm.compiler.truffle.runtime.OptimizedCallTarget;
import org.graalvm.compiler.truffle.runtime.OptimizedCompilationProfile;
import org.graalvm.compiler.truffle.runtime.SharedTruffleRuntimeOptions;
import org.graalvm.compiler.truffle.runtime.TruffleCallBoundary;
import org.graalvm.nativeimage.hosted.Feature;
import org.graalvm.nativeimage.ImageSingletons;
import org.graalvm.nativeimage.hosted.Feature;
import org.graalvm.nativeimage.hosted.RuntimeClassInitialization;
import org.graalvm.nativeimage.hosted.RuntimeReflection;

Expand All @@ -92,6 +91,7 @@
import com.oracle.graal.pointsto.meta.AnalysisType;
import com.oracle.graal.pointsto.meta.HostedProviders;
import com.oracle.svm.core.annotate.Alias;
import com.oracle.svm.core.annotate.Delete;
import com.oracle.svm.core.annotate.NeverInline;
import com.oracle.svm.core.annotate.RecomputeFieldValue;
import com.oracle.svm.core.annotate.RecomputeFieldValue.Kind;
Expand Down Expand Up @@ -780,7 +780,23 @@ final class Target_org_graalvm_compiler_truffle_runtime_OptimizedCallTarget {
* start with a fresh profile at run time.
*/
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
OptimizedCompilationProfile compilationProfile;
int callThreshold;
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
int callAndLoopThreshold;
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
boolean compilationFailed;
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
long initializedTimestamp;
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
Class<?>[] profiledArgumentTypes;
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
OptimizedAssumption profiledArgumentTypesAssumption;
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
Class<?> profiledReturnType;
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
OptimizedAssumption profiledReturnTypeAssumption;
@Alias @RecomputeFieldValue(kind = Kind.Reset) //
Class<? extends Throwable> profiledExceptionType;
}

// Checkstyle: stop
Expand Down

0 comments on commit ca2533f

Please sign in to comment.