public interface TruffleCompilerRuntime
TruffleCompiler without
exposing a Truffle compiler directly to Truffle AST classes. This allows a Truffle runtime and
Truffle compiler to exists in separate heaps or even separate processes.| Modifier and Type | Interface and Description |
|---|---|
static class |
TruffleCompilerRuntime.InlineKind |
static class |
TruffleCompilerRuntime.LoopExplosionKind
Controls behavior of
ExplodeLoop annotation. |
| Modifier and Type | Method and Description |
|---|---|
TruffleCompilable |
asCompilableTruffleAST(JavaConstant constant)
Gets the
TruffleCompilable represented by constant. |
default String |
formatEvent(int depth,
String event,
int eventWidth,
String subject,
int subjectWidth,
Map<String,Object> properties,
int propertyWidth)
Formats a message describing a Truffle event as a single line of text.
|
ConstantFieldInfo |
getConstantFieldInfo(ResolvedJavaField field)
Gets an object describing how a read of
field can be constant folded based on Truffle
annotations. |
HostMethodInfo |
getHostMethodInfo(ResolvedJavaMethod method)
Returns Truffle related method information during host compilation.
|
PartialEvaluationMethodInfo |
getPartialEvaluationMethodInfo(ResolvedJavaMethod method)
Returns Truffle related method information during host compilation.
|
boolean |
isSuppressedFailure(TruffleCompilable compilable,
Supplier<String> serializedException)
Determines if the exception which happened during the compilation is suppressed and should be
silent.
|
boolean |
isValueType(ResolvedJavaType type)
Determines if
type is a value type. |
void |
log(String loggerId,
TruffleCompilable compilable,
String message) |
default void |
log(TruffleCompilable compilable,
String message)
Writes
message followed by a new line to the Truffle logger. |
default void |
logEvent(TruffleCompilable compilable,
int depth,
String event,
Map<String,Object> properties)
Formats a Truffle event
and writes it to the log output.
|
default void |
logEvent(TruffleCompilable compilable,
int depth,
String event,
String subject,
Map<String,Object> properties,
String message)
Formats a Truffle event
and writes it to the log output.
|
void |
onCodeInstallation(TruffleCompilable compilable,
InstalledCode installedCode)
Notifies this runtime once
installedCode has been installed in the code cache. |
Consumer<OptimizedAssumptionDependency> |
registerOptimizedAssumptionDependency(JavaConstant optimizedAssumption)
Registers some dependent code on an assumption.
|
default ResolvedJavaType |
resolveType(MetaAccessProvider metaAccess,
String className)
Looks up a type in this runtime.
|
ResolvedJavaType |
resolveType(MetaAccessProvider metaAccess,
String className,
boolean required)
Looks up a type in this runtime.
|
void onCodeInstallation(TruffleCompilable compilable, InstalledCode installedCode)
installedCode has been installed in the code cache. On
SubstrateVM this callback is currently unused.compilable - the compilable to install code intoinstalledCode - code that has just been installed in the code cachePartialEvaluationMethodInfo getPartialEvaluationMethodInfo(ResolvedJavaMethod method)
HostMethodInfo getHostMethodInfo(ResolvedJavaMethod method)
ConstantFieldInfo getConstantFieldInfo(ResolvedJavaField field)
field can be constant folded based on Truffle
annotations. Do not call this method directly use PartialEvaluator#getConstantFieldInfo
instead.
TODO GR-44222 as soon as the annotation API is available in libgraal this can be moved to the
compiler implementation side.null if there are no constant folding related Truffle annotations on
fieldTruffleCompilable asCompilableTruffleAST(JavaConstant constant)
TruffleCompilable represented by constant.null if constant does not represent a TruffleCompilable or it
cannot be converted to a TruffleCompilable in the calling contextConsumer<OptimizedAssumptionDependency> registerOptimizedAssumptionDependency(JavaConstant optimizedAssumption)
Consumer is returned that must be
notified when the code becomes available. If there is an
error while compiling or installing the code, the returned consumer must be called with a
null argument.
If the assumption is already invalid, then null is returned in which case the caller
(e.g., the compiler) must ensure the dependent code is never executed.optimizedAssumption - compiler constant representing an OptimizedAssumptiondefault void logEvent(TruffleCompilable compilable, int depth, String event, Map<String,Object> properties)
compilable - the currently compiled AST used as a subjectdepth - nesting depth of the eventevent - a short description of the event being tracedproperties - name/value pairs describing properties relevant to the eventdefault void logEvent(TruffleCompilable compilable, int depth, String event, String subject, Map<String,Object> properties, String message)
compilable - the currently compiled ASTdepth - nesting depth of the eventevent - a short description of the event being tracedsubject - a description of the event's subjectproperties - name/value pairs describing properties relevant to the eventmessage - optional additional message appended to the formatted eventdefault void log(TruffleCompilable compilable, String message)
message followed by a new line to the Truffle logger.compilable - the currently compiled ASTmessage - message to logvoid log(String loggerId, TruffleCompilable compilable, String message)
default String formatEvent(int depth, String event, int eventWidth, String subject, int subjectWidth, Map<String,Object> properties, int propertyWidth)
opt queued :anonymous|ASTSize 20/ 20 |Calls/Thres 7723/ 3 |CallsAndLoop/Thres 7723/ 1000 |Inval# 0
depth - nesting depth of the event (subject column is indented @{code depth * 2})event - a short description of the event being traced (e.g., "opt done")eventWidth - the minimum width of the event columnsubject - a description of the event's subject (e.g., name of a Truffle AST)subjectWidth - the minimum width of the subject columnproperties - name/value pairs describing properties relevant to the eventpropertyWidth - the minimum width of the column for each propertydefault ResolvedJavaType resolveType(MetaAccessProvider metaAccess,
String className)
className - name of the type to lookup (same format as Class.forName(String)NoClassDefFoundError - if resolution failsResolvedJavaType resolveType(MetaAccessProvider metaAccess,
String className,
boolean required)
className - name of the type to lookup (same format as Class.forName(String)required - specifies if NoClassDefFoundError should be thrown or null
should be returned if resolution failsnull if resolution fails and required == falseNoClassDefFoundError - if resolution fails and required == trueboolean isValueType(ResolvedJavaType type)
type is a value type. Reference comparisons (==) between value type
instances have undefined semantics and can either return true or false.boolean isSuppressedFailure(TruffleCompilable compilable, Supplier<String> serializedException)