private SpecializationGroup(SpecializationData data) { this.node = data.getNode(); this.typeGuards = new ArrayList<>(); this.guards = new ArrayList<>(); this.specialization = data; TypeSignature sig = data.getTypeSignature(); for (int i = 1; i < sig.size(); i++) { typeGuards.add(new TypeGuard(sig.get(i), i - 1)); } this.guards.addAll(data.getGuards()); }
private SpecializationGroup(SpecializationData data) { this.node = data.getNode(); this.typeGuards = new ArrayList<>(); this.guards = new ArrayList<>(); this.specialization = data; TypeSignature sig = data.getTypeSignature(); for (int i = 1; i < sig.size(); i++) { typeGuards.add(new TypeGuard(sig.get(i), i - 1)); } this.guards.addAll(data.getGuards()); }
guards.add(new TypeGuard(p.getType(), index));
List<TypeMirror> sourceTypes = resolveOptimizedImplicitSourceTypes(execution, targetType); if (sourceTypes.size() > 1) { TypeGuard typeGuard = new TypeGuard(targetType, execution.getIndex()); TypeMirror generic = node.getPolymorphicSpecialization().findParameterOrDie(execution).getType(); fallbackVar = originalFrameState.createValue(execution, generic);
List<TypeMirror> originalSourceTypes = typeSystem.lookupSourceTypes(target.getTypeMirror()); List<TypeMirror> sourceTypes = resolveOptimizedImplicitSourceTypes(execution, target.getTypeMirror()); TypeGuard typeGuard = new TypeGuard(target.getTypeMirror(), execution.getIndex()); boolean throwsUnexpected = false; boolean elseIf = false;
List<TypeMirror> sourceTypes = typeSystem.lookupSourceTypes(targetType); if (sourceTypes.size() > 1) { implicitCasts.add(new TypeGuard(targetType, index));
private List<IfTriple> initializeCasts(FrameState frameState, SpecializationGroup group, DSLExpression expression, NodeExecutionMode specializationExecution) { Set<VariableElement> boundElements = expression.findBoundVariableElements(); if (boundElements.isEmpty()) { return Collections.emptyList(); } List<IfTriple> triples = new ArrayList<>(); for (VariableElement variable : boundElements) { Parameter p = group.getSpecialization().findByVariable(variable); if (p != null) { NodeExecutionData execution = p.getSpecification().getExecution(); if (execution != null) { LocalVariable var = frameState.getValue(execution); if (var == null) { throw new AssertionError(); } IfTriple triple = createTypeCheckOrCast(frameState, group, new TypeGuard(p.getType(), execution.getIndex()), specializationExecution, true, false); if (triple != null) { triples.add(triple); } } } } return triples; }
private CodeTree createUpdateImplicitCastState(CodeTreeBuilder parent, FrameState frameState, SpecializationData specialization) { CodeTreeBuilder builder = null; int signatureIndex = 0; for (Parameter p : specialization.getSignatureParameters()) { TypeMirror targetType = p.getType(); TypeMirror polymorphicType = node.getPolymorphicSpecialization().findParameterOrDie(p.getSpecification().getExecution()).getType(); if (typeSystem.hasImplicitSourceTypes(targetType) && needsCastTo(polymorphicType, targetType)) { String implicitFieldName = createImplicitTypeStateLocalName(p); if (builder == null) { builder = parent.create(); } builder.tree(state.createSetInteger(frameState, new TypeGuard(p.getType(), signatureIndex), CodeTreeBuilder.singleString(implicitFieldName))); } signatureIndex++; } return builder == null ? null : builder.build(); }