public void registerAsInTypeCheck() { isInTypeCheck = true; universe.hostVM.checkForbidden(this, UsageKind.InTypeCheck); }
@Override public final boolean isInitialized() { return universe.hostVM.isInitialized(this); }
@Override public OptionDescriptor next() { switch (i++) { case 0: return get("AllocationSiteSensitiveHeap"); case 1: return get("AnalysisContextSensitivity"); case 2: return get("AnalysisSizeCutoff"); case 3: return get("DivertParameterReturningMethod"); case 4: return get("ExtendedAsserts"); case 5: return get("HybridStaticContext"); case 6: return get("InspectServerContentPath"); case 7: return get("LimitObjectArrayLength"); case 8: return get("MaxCallingContextDepth"); case 9: return get("MaxCallingContextWidth"); case 10: return get("MaxConstantObjectsPerType"); case 11: return get("MaxHeapContextDepth"); case 12: return get("MaxHeapContextWidth"); case 13: return get("MaxObjectSetSize"); case 14: return get("MinCallingContextDepth"); case 15: return get("MinHeapContextDepth"); case 16: return get("PrintSynchronizedAnalysis"); case 17: return get("ProfileAnalysisOperations"); case 18: return get("ProfileConstantObjects"); case 19: return get("ReportAnalysisStatistics"); case 20: return get("ReportUnsupportedFeaturesDuringAnalysis"); case 21: return get("TrackAccessChain"); case 22: return get("TrackInputFlows"); case 23: return get("UnresolvedIsError");
public void registerAsUnsafeAccessed() { registerAsUnsafeAccessed(DefaultUnsafePartition.get()); }
/** * Intercept {@link Word} types. They are boxed objects in the hosted world, but primitive * values in the runtime world. */ private JavaConstant interceptWordType(AnalysisField field, JavaConstant value) { if (value.getJavaKind() == JavaKind.Object) { Object originalObject = universe.getSnippetReflection().asObject(Object.class, value); if (universe.hostVM().isRelocatedPointer(originalObject)) { /* * Such pointers are subject to relocation therefore we don't know their values yet. * Therefore there should not be a relocated pointer constant in a function which is * compiled. RelocatedPointers are only allowed in non-constant fields. The caller * of readValue is responsible of handling the returned value correctly. */ return value; } else if (originalObject instanceof WordBase) { return JavaConstant.forIntegerKind(universe.getWordKind(), ((WordBase) originalObject).rawValue()); } else if (originalObject == null && field.getType().isWordType()) { return JavaConstant.forIntegerKind(universe.getWordKind(), 0); } } return value; }
this.debug = DebugContext.create(options, debugHandlerFactories); this.hostVM = hostVM; String imageName = hostVM.getImageName(); this.typeFlowTimer = new Timer(imageName, "(typeflow)", false); this.checkObjectsTimer = new Timer(imageName, "(objects)", false);
} else { executorService.execute(() -> { bb.getHostVM().installInThread(vmConfig); long startTime = 0L; if (timing != null) { thrown = x; } finally { bb.getHostVM().clearInThread(); if (timing != null) { long taskTime = System.nanoTime() - startTime;
public ContextSensitiveAnalysisObject(AnalysisUniverse universe, AnalysisType type, AnalysisObjectKind kind) { super(universe, type, kind); assert PointstoOptions.AllocationSiteSensitiveHeap.getValue(universe.hostVM().options()); }
private static void registerForeignCall(BigBang bb, ForeignCallDescriptor foreignCallDescriptor) { Optional<AnalysisMethod> targetMethod = bb.getHostVM().handleForeignCall(foreignCallDescriptor, bb.getProviders().getForeignCalls()); targetMethod.ifPresent(analysisMethod -> { bb.addRootMethod(analysisMethod); }); }
@Override public boolean isLocal() { /* * Meta programs and languages often get the naming of their anonymous classes wrong. This * makes, getSimpleName in isLocal to fail and prevents us from compiling those bytecodes. * Since, isLocal is not very important for anonymous classes we can ignore this failure. */ try { return wrapped.isLocal(); } catch (InternalError e) { universe.hostVM().warn("unknown locality of class " + wrapped.getName() + ", assuming class is not local. To remove the warning report an issue " + "to the library or language author. The issue is caused by " + wrapped.getName() + " which is not following the naming convention."); return false; } }
public void init(Timing newTiming) { assert isSequential() || !executorService.hasQueuedSubmissions(); assert Thread.currentThread() == mainThread; timing = newTiming; setState(State.BEFORE_START); postedOperations.reset(); completedOperations.reset(); postedBeforeStart.clear(); vmConfig = bb.getHostVM().getConfiguration(); }
JavaKind storageKind = getStorageKind(type, originalMetaAccess); AnalysisType newValue = new AnalysisType(this, type, storageKind, objectClass); hostVM.registerType(newValue);
public List<AnalysisField> unsafeAccessedFields() { return unsafeAccessedFields(DefaultUnsafePartition.get()); }
if (fieldValue.getJavaKind() == JavaKind.Object && bb.getHostVM().isRelocatedPointer(bb.getSnippetReflectionProvider().asObject(Object.class, fieldValue))) { forRelocatedPointerFieldValue(receiver, field, fieldValue); } else if (fieldValue.isNull()) {
@SuppressWarnings("try") public void finish(DebugContext debug) { try { String imageName = universe.getBigBang().getHostVM().getImageName(); try (StopTimer t = new Timer(imageName, "(parse)").start()) { parseAll();
public void registerAsInHeap() { assert isArray() || (isInstanceClass() && !Modifier.isAbstract(getModifiers())); isInHeap = true; universe.hostVM.checkForbidden(this, UsageKind.InHeap); }
public AnalysisField(AnalysisUniverse universe, ResolvedJavaField wrappedField) { assert !wrappedField.isInternal(); this.position = -1; this.isUnsafeAccessed = new AtomicBoolean(); this.unsafeFrozenTypeState = new AtomicBoolean(); this.wrapped = wrappedField; this.id = universe.nextFieldId.getAndIncrement(); readBy = PointstoOptions.TrackAccessChain.getValue(universe.hostVM().options()) ? new ConcurrentHashMap<>() : null; writtenBy = new ConcurrentHashMap<>(); declaringClass = universe.lookup(wrappedField.getDeclaringClass()); fieldType = getDeclaredType(universe, wrappedField); isUsedInComparison = false; if (this.isStatic()) { this.canBeNull = false; this.staticFieldFlow = new FieldTypeFlow(this, getType()); this.initialInstanceFieldFlow = null; } else { this.canBeNull = true; this.instanceFieldFlow = new FieldSinkTypeFlow(this, getType()); this.initialInstanceFieldFlow = new FieldTypeFlow(this, getType()); } }
private static void registerFields(FieldIntrospection<?> introspection, BeforeAnalysisAccessImpl config) { if (introspection instanceof NodeClass<?>) { NodeClass<?> nodeClass = (NodeClass<?>) introspection; Fields dataFields = nodeClass.getData(); registerFields(dataFields, DefaultUnsafePartition.get(), config); Fields inputEdges = nodeClass.getInputEdges(); registerFields(inputEdges, GraalEdgeUnsafePartition.get(), config); Fields successorEdges = nodeClass.getSuccessorEdges(); registerFields(successorEdges, GraalEdgeUnsafePartition.get(), config); /* Ensure field shortName is initialized, so that the instance is immutable. */ nodeClass.shortName(); } else { for (Fields fields : introspection.getAllFields()) { registerFields(fields, DefaultUnsafePartition.get(), config); } } }
/** * @param node For future use and debugging */ public void registerAsAllocated(Node node) { assert isArray() || (isInstanceClass() && !Modifier.isAbstract(getModifiers())) : this; if (!isAllocated) { isAllocated = true; } universe.hostVM.checkForbidden(this, UsageKind.Allocated); }