Class AssignExpressionToSymbol
java.lang.Object
org.ek9lang.compiler.phase7.generator.AbstractGenerator
org.ek9lang.compiler.phase7.generator.AssignExpressionToSymbol
- All Implemented Interfaces:
BiFunction<ISymbol, EK9Parser.AssignmentExpressionContext, List<IRInstr>>
final class AssignExpressionToSymbol
extends AbstractGenerator
implements BiFunction<ISymbol, EK9Parser.AssignmentExpressionContext, List<IRInstr>>
-
Field Summary
Fields inherited from class AbstractGenerator
constantCopyOnAccessLoader, debugInfoCreator, instructionBuilder, MAX_MESSAGE_LENGTH, stackContext, synthesisedCallMetaData, typeNameOrException -
Constructor Summary
ConstructorsConstructorDescriptionAssignExpressionToSymbol(IRGenerationContext stackContext, VariableMemoryManagement variableMemoryManagement, ScopeRegisterOnly scopeRegisterOnly, PromotionCallGenerator promotionCallGenerator, boolean release, Function<String, List<IRInstr>> assignmentGenerator) -
Method Summary
Modifier and TypeMethodDescriptionapply(ISymbol lhsSymbol, EK9Parser.AssignmentExpressionContext ctx) (package private) static booleanTrue when the RHS hands back a temp that ALREADY carries a producer +1 (so this consumer must SCOPE_REGISTER only, never a second RETAIN — a second RETAIN leaves two RETAINs against one SCOPE_REGISTER = a +1 ARC leak on the LLVM backend).Methods inherited from class AbstractGenerator
addCoverageProbe, createTempVariable, createTempVariableFromContext, extractReturnType, getRecordedSymbolOrException, processBlockStatements, processBlockStatements, truncateMessage, truncateMessageMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Constructor Details
-
AssignExpressionToSymbol
AssignExpressionToSymbol(IRGenerationContext stackContext, VariableMemoryManagement variableMemoryManagement, ScopeRegisterOnly scopeRegisterOnly, PromotionCallGenerator promotionCallGenerator, boolean release, Function<String, List<IRInstr>> assignmentGenerator)
-
-
Method Details
-
apply
- Specified by:
applyin interfaceBiFunction<ISymbol, EK9Parser.AssignmentExpressionContext, List<IRInstr>>
-
isEscapingResultExpression
True when the RHS hands back a temp that ALREADY carries a producer +1 (so this consumer must SCOPE_REGISTER only, never a second RETAIN — a second RETAIN leaves two RETAINs against one SCOPE_REGISTER = a +1 ARC leak on the LLVM backend). Two families qualify:- the control-flow expression forms (switch/while/for/try) that
AssignmentExprInstrGenerator.processControlFlowExpressionSTOREs+RETAINs; and - the coalescing (
?? ?: <? >? <=? >=?) and ternary (control<-then:else) expressions, which lower to aCONTROL_FLOW_CHAINwhose body-results are RETAIN'd to escape the chain's inner scope (seeControlFlowChainGenerator.produceEscapingResultandgenerateTernary). Detected onctx.expression()exactly asExprInstrGeneratorroutes them.
THE predicate for this choice: a try-with-resources resource initialiser asks it too (
TryCatchStatementGenerator), so the two consumers of an assignmentExpression cannot disagree about which forms hand back a +1. - the control-flow expression forms (switch/while/for/try) that
-