use of com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl in project graal by oracle.
the class FieldsOffsetsFeature method beforeAnalysis.
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
BeforeAnalysisAccessImpl config = (BeforeAnalysisAccessImpl) access;
GraalSupport.get().nodeClasses = FieldsOffsetsFeature.<NodeClass<?>>registerClasses(Node.class, NodeClass::get, false, config);
GraalSupport.get().instructionClasses = FieldsOffsetsFeature.<LIRInstructionClass<?>>registerClasses(LIRInstruction.class, LIRInstructionClass::get, true, config);
GraalSupport.get().compositeValueClasses = FieldsOffsetsFeature.<CompositeValueClass<?>>registerClasses(CompositeValue.class, CompositeValueClass::get, true, config);
}
use of com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl in project graal by oracle.
the class Target_com_oracle_truffle_api_interop_java_ObjectProxyHandler method beforeAnalysis.
@SuppressWarnings("deprecation")
@Override
public void beforeAnalysis(BeforeAnalysisAccess access) {
BeforeAnalysisAccessImpl config = (BeforeAnalysisAccessImpl) access;
getLanguageClasses().forEach(config::registerForReflectiveInstantiation);
config.registerHierarchyForReflectiveInstantiation(TruffleInstrument.class);
config.registerHierarchyForReflectiveInstantiation(com.oracle.truffle.api.instrumentation.InstrumentableFactory.class);
if (useTruffleCompiler()) {
SubstrateTruffleRuntime truffleRuntime = (SubstrateTruffleRuntime) Truffle.getRuntime();
GraalFeature graalFeature = ImageSingletons.lookup(GraalFeature.class);
SnippetReflectionProvider snippetReflection = graalFeature.getHostedProviders().getSnippetReflection();
SubstrateTruffleCompiler truffleCompiler = truffleRuntime.initTruffleCompiler();
truffleRuntime.lookupCallMethods(config.getMetaAccess());
PartialEvaluator partialEvaluator = truffleCompiler.getPartialEvaluator();
registerKnownTruffleFields(config, partialEvaluator.getKnownTruffleTypes());
support.registerInterpreterEntryMethodsAsCompiled(partialEvaluator, access);
GraphBuilderConfiguration graphBuilderConfig = partialEvaluator.getConfigForParsing();
if (Options.TruffleInlineDuringParsing.getValue()) {
graphBuilderConfig.getPlugins().appendInlineInvokePlugin(new TruffleParsingInlineInvokePlugin(graalFeature.getHostedProviders().getReplacements(), graphBuilderConfig.getPlugins().getInvocationPlugins(), partialEvaluator, method -> includeCallee(method, null, null)));
}
registerNeverPartOfCompilation(graphBuilderConfig.getPlugins().getInvocationPlugins());
graphBuilderConfig.getPlugins().getInvocationPlugins().closeRegistration();
HostedProviders newHostedProviders = new HostedProviders(partialEvaluator.getProviders().getMetaAccess(), partialEvaluator.getProviders().getCodeCache(), partialEvaluator.getProviders().getConstantReflection(), new HostedTruffleConstantFieldProvider(partialEvaluator.getProviders().getConstantFieldProvider()), partialEvaluator.getProviders().getForeignCalls(), partialEvaluator.getProviders().getLowerer(), partialEvaluator.getProviders().getReplacements(), partialEvaluator.getProviders().getStampProvider(), snippetReflection, graalFeature.getHostedProviders().getWordTypes());
newHostedProviders.setGraphBuilderPlugins(graphBuilderConfig.getPlugins());
graalFeature.initializeRuntimeCompilationConfiguration(newHostedProviders, graphBuilderConfig, this::includeCallee, this::deoptimizeOnException);
for (ResolvedJavaMethod method : partialEvaluator.getCompilationRootMethods()) {
graalFeature.prepareMethodForRuntimeCompilation(method, config);
}
initializeMethodBlacklist(config.getMetaAccess());
/*
* Stack frames that are visited by Truffle-level stack walking must have full frame
* information available, otherwise SubstrateStackIntrospection cannot visit them.
*/
for (ResolvedJavaMethod method : truffleRuntime.getAnyFrameMethod()) {
graalFeature.requireFrameInformationForMethod(method);
/*
* To avoid corner case errors, we also force compilation of these methods. This
* only affects builds where no Truffle language is included, because any real
* language makes these methods reachable (and therefore compiled).
*/
config.registerAsCompiled((AnalysisMethod) method);
}
}
firstAnalysisRun = true;
}
use of com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl in project graal by oracle.
the class JNIAccessFeature method beforeAnalysis.
@Override
public void beforeAnalysis(BeforeAnalysisAccess arg) {
BeforeAnalysisAccessImpl access = (BeforeAnalysisAccessImpl) arg;
this.nativeLibraries = access.getNativeLibraries();
this.haveJavaRuntimeReflectionSupport = ImageSingletons.contains(RuntimeReflectionSupport.class);
varargsCallTrampolineMethod = createJavaCallTrampoline(access, CallVariant.VARARGS, false);
arrayCallTrampolineMethod = createJavaCallTrampoline(access, CallVariant.ARRAY, false);
valistCallTrampolineMethod = createJavaCallTrampoline(access, CallVariant.VA_LIST, false);
varargsNonvirtualCallTrampolineMethod = createJavaCallTrampoline(access, CallVariant.VARARGS, true);
arrayNonvirtualCallTrampolineMethod = createJavaCallTrampoline(access, CallVariant.ARRAY, true);
valistNonvirtualCallTrampolineMethod = createJavaCallTrampoline(access, CallVariant.VA_LIST, true);
}
use of com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl in project graal by oracle.
the class ScalaFeature method initializeScalaEnumerations.
private void initializeScalaEnumerations(BeforeAnalysisAccess a) {
BeforeAnalysisAccessImpl access = (BeforeAnalysisAccessImpl) a;
if (hasMangledPopulatesNameMapMethod) {
Class<?> scalaEnum = access.findClassByName("scala.Enumeration");
Stream<Field> scalaModuleFields = access.findSubclasses(scalaEnum).stream().map(ScalaFeature::getModuleField).filter(Objects::nonNull);
scalaModuleFields.forEach(ScalaFeature::preInitializeEnum);
}
}
use of com.oracle.svm.hosted.FeatureImpl.BeforeAnalysisAccessImpl in project graal by oracle.
the class StringInternFeature method beforeAnalysis.
@Override
public void beforeAnalysis(BeforeAnalysisAccess a) {
BeforeAnalysisAccessImpl config = (BeforeAnalysisAccessImpl) a;
/* Ensure metadata for field is created for later use during image heap writing. */
getInternedStringsField(config.getMetaAccess());
}
Aggregations