From 1906c75433adb84f241b838079331b146cb268ec Mon Sep 17 00:00:00 2001 From: "Hattori, Hiroki" Date: Tue, 20 Feb 2024 23:01:06 +0900 Subject: [PATCH] [RefC] [Cleanup] Erase trivial constructors; Stop copying constructor name. (#3206) --- CHANGELOG_NEXT.md | 6 + src/Compiler/RefC/RefC.idr | 86 ++++--- support/refc/_datatypes.h | 4 +- support/refc/memoryManagement.c | 15 +- support/refc/memoryManagement.h | 2 +- support/refc/prim.c | 14 ++ support/refc/prim.h | 14 ++ support/refc/runtime.c | 4 - support/refc/stringOps.c | 22 +- tests/refc/basicpatternmatch/Main.idr | 6 +- tests/refc/basicpatternmatch/expected | 5 +- tests/refc/callingConvention/expected | 341 +++++++++++++------------- tests/refc/reuse/expected | 32 +-- tests/refc/reuse/run | 4 +- 14 files changed, 290 insertions(+), 265 deletions(-) diff --git a/CHANGELOG_NEXT.md b/CHANGELOG_NEXT.md index b39821c41..27e418493 100644 --- a/CHANGELOG_NEXT.md +++ b/CHANGELOG_NEXT.md @@ -46,6 +46,12 @@ This CHANGELOG describes the merged but unreleased changes. Please see [CHANGELO * Pattern matching generates simpler code. This reduces malloc/free and memory consumption. It also makes debugging easier. +* Stopped useless string copying in the constructor to save memory. Also, name + generation was stopped for constructors that have tags. + +* Special constructors such as Nil and Nothing were eliminated and assigned to + NULL. + #### NodeJS Backend * The NodeJS executable output to `build/exec/` now has its executable bit set. diff --git a/src/Compiler/RefC/RefC.idr b/src/Compiler/RefC/RefC.idr index d4e60203a..62797d8a6 100644 --- a/src/Compiler/RefC/RefC.idr +++ b/src/Compiler/RefC/RefC.idr @@ -318,25 +318,25 @@ applyFunctionToVars : {auto oft : Ref OutfileText Output} -> {auto il : Ref IndentLevel Nat} -> String -> List String - -> Core $ () + -> Core () applyFunctionToVars fun vars = traverse_ (\v => emit EmptyFC $ fun ++ "(" ++ v ++ ");" ) vars removeVars : {auto oft : Ref OutfileText Output} -> {auto il : Ref IndentLevel Nat} -> List String - -> Core $ () + -> Core () removeVars = applyFunctionToVars "removeReference" dupVars : {auto oft : Ref OutfileText Output} -> {auto il : Ref IndentLevel Nat} -> List String - -> Core $ () + -> Core () dupVars = applyFunctionToVars "newReference" removeReuseConstructors : {auto oft : Ref OutfileText Output} -> {auto il : Ref IndentLevel Nat} -> List String - -> Core $ () + -> Core () removeReuseConstructors = applyFunctionToVars "removeReuseConstructor" avarToC : Env -> AVar -> String @@ -388,9 +388,9 @@ fillConstructorArgs env cons (v :: vars) k = do emit EmptyFC $ cons ++ "->args["++ show k ++ "] = " ++ avarToC env v ++ ";" fillConstructorArgs (moveFromOwnedToBorrowed env ownedVars) cons vars (S k) -showTag : Maybe Int -> String -showTag Nothing = "-1" -showTag (Just i) = show i +cArgsVectANF : {0 arity : Nat} -> Vect arity AVar -> Core (Vect arity String) +cArgsVectANF [] = pure [] +cArgsVectANF (x :: xs) = pure $ (varName x) :: !(cArgsVectANF xs) integer_switch : List AConstAlt -> Bool integer_switch [] = True @@ -565,29 +565,30 @@ mutual unless (contains (ALocal var) usedVars) $ emit fc $ "removeReference(var_\{show var});" put EnvTracker ({ owned := owned', reuseMap $= (`differenceMap` usedCons) } env) cStatementsFromANF body tailPosition - cStatementsFromANF (ACon fc n UNIT tag []) _ = pure "(Value*)NULL" - cStatementsFromANF (ACon fc n _ mTag args) _ = do - env <- get EnvTracker - let mConstr = SortedMap.lookup n $ reuseMap env - let createNewConstructor = " = newConstructor(" - ++ (show (length args)) - ++ ", " ++ showTag mTag ++ ", " - ++ "\"" ++ cName n ++ "\"" - ++ ");" - case mConstr of - Just constr => do - emit fc $ "if (!" ++ constr ++ ") {" - increaseIndentation - emit fc $ constr ++ createNewConstructor - decreaseIndentation - emit fc "}" - fillConstructorArgs env constr args 0 - pure $ "(Value*)\{constr}" - Nothing => do - c <- getNextCounter - let constr = "constructor_" ++ (show c) - emit fc $ "Value_Constructor* " ++ constr ++ createNewConstructor - emit fc $ " // constructor " ++ cName n + + cStatementsFromANF (ACon fc n coninfo tag args) _ = do + if coninfo == NIL || coninfo == NOTHING || coninfo == ZERO || coninfo == UNIT + then pure "(NULL /* \{show n} */)" + else do + env <- get EnvTracker + let createNewConstructor = " = newConstructor(" + ++ (show (length args)) + ++ ", " ++ maybe "-1" show tag ++ ");" + + emit fc " // constructor \{show n}" + constr <- case SortedMap.lookup n $ reuseMap env of + Just constr => do + emit fc "if (! \{constr}) {" + increaseIndentation + emit fc $ constr ++ createNewConstructor + decreaseIndentation + emit fc "}" + pure constr + Nothing => do + let constr = "constructor_\{show !(getNextCounter)}" + emit fc $ "Value_Constructor* " ++ constr ++ createNewConstructor + when (Nothing == tag) $ emit fc "\{constr}->name = idris2_constr_\{cName n};" + pure constr fillConstructorArgs env constr args 0 pure $ "(Value*)\{constr}" @@ -611,20 +612,28 @@ mutual _ => throw $ InternalError $ "INTERNAL ERROR: Unknown primitive: " ++ cName p emit fc $ "// call to external primitive " ++ cName p pure $ "idris2_\{cName p}("++ showSep ", " (map varName args) ++")" + cStatementsFromANF (AConCase fc sc alts mDef) tailPosition = do let sc' = varName sc switchReturnVar <- getNewVarThatWillNotBeFreedAtEndOfBlock emit fc "Value * \{switchReturnVar} = NULL;" env <- get EnvTracker _ <- foldlC (\els, (MkAConAlt name coninfo tag args body) => do + let erased = coninfo == NIL || coninfo == NOTHING || coninfo == ZERO || coninfo == UNIT + if erased then emit emptyFC "\{els}if (NULL == \{sc'} /* \{show name} \{show coninfo} */) {" + else if coninfo == CONS || coninfo == JUST || coninfo == SUCC + then emit emptyFC "\{els}if (NULL != \{sc'} /* \{show name} \{show coninfo} */) {" + else do + case tag of + Nothing => emit emptyFC "\{els}if (! strcmp(((Value_Constructor *)\{sc'})->name, idris2_constr_\{cName name})) {" + Just tag' => emit emptyFC "\{els}if (((Value_Constructor *)\{sc'})->tag == \{show tag'} /* \{show name} */) {" + let conArgs = ALocal <$> args - let ownedWithArgs = union (fromList conArgs) env.owned + let owned = if erased then delete sc env.owned else env.owned + let ownedWithArgs = union (fromList conArgs) owned let (shouldDrop, actualOwned) = dropUnusedOwnedVars ownedWithArgs (freeVariables body) let usedCons = usedConstructors body let (dropReuseCons, actualReuseMap) = dropUnusedReuseCons env.reuseMap usedCons - case tag of - Nothing => emit emptyFC "\{els}if (! strcmp(((Value_Constructor *)\{sc'})->name, \{cStringQuoted $ cName name})) {" - Just tag' => emit emptyFC "\{els}if (((Value_Constructor *)\{sc'})->tag == \{show tag'}) {" increaseIndentation _ <- foldlC (\k, arg => do emit emptyFC "Value *var_\{show arg} = ((Value_Constructor*)\{sc'})->args[\{show k}];" @@ -636,6 +645,7 @@ mutual emit emptyFC "\{switchReturnVar} = \{!(cStatementsFromANF body tailPosition)};" decreaseIndentation pure "} else ") "" alts + case mDef of Nothing => pure () Just body => do @@ -873,8 +883,14 @@ createCFunctions n (MkAFun args anf) = do pure () +createCFunctions n (MkACon Nothing _ _) = do + let n' = cName n + update FunctionDefinitions $ \otherDefs => "char const idris2_constr_\{n'}[];" :: otherDefs + emit EmptyFC "char const idris2_constr_\{n'}[] = \{cStringQuoted $ show n};" + pure () + createCFunctions n (MkACon tag arity nt) = do - emit EmptyFC $ ( "// Constructor tag " ++ show tag ++ " arity " ++ show arity) -- Nothing to compile here + emit EmptyFC $ ( "// \{show n} Constructor tag " ++ show tag ++ " arity " ++ show arity) -- Nothing to compile here createCFunctions n (MkAForeign ccs fargs ret) = do diff --git a/support/refc/_datatypes.h b/support/refc/_datatypes.h index ab3fc8481..77c3fa00b 100644 --- a/support/refc/_datatypes.h +++ b/support/refc/_datatypes.h @@ -114,8 +114,8 @@ typedef struct { Value_header header; int32_t total; int32_t tag; - char *name; - Value **args; + char const *name; + Value *args[]; } Value_Constructor; typedef struct { diff --git a/support/refc/memoryManagement.c b/support/refc/memoryManagement.c index a4adffc76..f15bf7779 100644 --- a/support/refc/memoryManagement.c +++ b/support/refc/memoryManagement.c @@ -19,16 +19,13 @@ Value_Arglist *newArglist(int missing, int total) { return retVal; } -Value_Constructor *newConstructor(int total, int tag, const char *name) { - Value_Constructor *retVal = IDRIS2_NEW_VALUE(Value_Constructor); +Value_Constructor *newConstructor(int total, int tag) { + Value_Constructor *retVal = (Value_Constructor *)newValue( + sizeof(Value_Constructor) + sizeof(Value *) * total); retVal->header.tag = CONSTRUCTOR_TAG; retVal->total = total; retVal->tag = tag; - int nameLength = strlen(name); - retVal->name = malloc(nameLength + 1); - memset(retVal->name, 0, nameLength + 1); - memcpy(retVal->name, name, nameLength); - retVal->args = (Value **)malloc(sizeof(Value *) * total); + retVal->name = NULL; return retVal; } @@ -246,10 +243,6 @@ void removeReference(Value *elem) { for (int i = 0; i < constr->total; i++) { removeReference(constr->args[i]); } - if (constr->name) { - free(constr->name); - } - free(constr->args); break; } case IOREF_TAG: diff --git a/support/refc/memoryManagement.h b/support/refc/memoryManagement.h index a3536cc9d..186de8b95 100644 --- a/support/refc/memoryManagement.h +++ b/support/refc/memoryManagement.h @@ -9,7 +9,7 @@ void removeReference(Value *source); #define IDRIS2_NEW_VALUE(t) ((t *)newValue(sizeof(t))) Value_Arglist *newArglist(int missing, int total); -Value_Constructor *newConstructor(int total, int tag, const char *name); +Value_Constructor *newConstructor(int total, int tag); // copies arglist, no pointer bending Value_Closure *makeClosureFromArglist(fun_ptr_t f, Value_Arglist *); diff --git a/support/refc/prim.c b/support/refc/prim.c index 17a2b880e..2854afc38 100644 --- a/support/refc/prim.c +++ b/support/refc/prim.c @@ -231,3 +231,17 @@ Value *System_Concurrency_Raw_prim__conditionBroadcast(Value *_condition, IDRIS2_REFC_VERIFY(!r, "pthread_cond_broadcast failed: %s", strerror(r)); return NULL; } + +char const idris2_constr_Int[] = "Int"; +char const idris2_constr_Int8[] = "Int8"; +char const idris2_constr_Int16[] = "Int16"; +char const idris2_constr_Int32[] = "Int32"; +char const idris2_constr_Int64[] = "Int64"; +char const idris2_constr_Bits8[] = "Bits8"; +char const idris2_constr_Bits16[] = "Bits16"; +char const idris2_constr_Bits32[] = "Bits32"; +char const idris2_constr_Bits64[] = "Bits64"; +char const idris2_constr_Double[] = "Double"; +char const idris2_constr_Integer[] = "Integer"; +char const idris2_constr_Char[] = "Char"; +char const idris2_constr_String[] = "String"; diff --git a/support/refc/prim.h b/support/refc/prim.h index bcfee4898..be56e1be4 100644 --- a/support/refc/prim.h +++ b/support/refc/prim.h @@ -48,3 +48,17 @@ Value *System_Concurrency_Raw_prim__conditionWaitTimeout(Value *, Value *, Value *System_Concurrency_Raw_prim__conditionSignal(Value *, Value *); Value *System_Concurrency_Raw_prim__conditionBroadcast(Value *, Value *); + +extern char const idris2_constr_Int[]; +extern char const idris2_constr_Int8[]; +extern char const idris2_constr_Int16[]; +extern char const idris2_constr_Int32[]; +extern char const idris2_constr_Int64[]; +extern char const idris2_constr_Bits8[]; +extern char const idris2_constr_Bits16[]; +extern char const idris2_constr_Bits32[]; +extern char const idris2_constr_Bits64[]; +extern char const idris2_constr_Double[]; +extern char const idris2_constr_Integer[]; +extern char const idris2_constr_Char[]; +extern char const idris2_constr_String[]; diff --git a/support/refc/runtime.c b/support/refc/runtime.c index 89150cc3a..c30640ed2 100644 --- a/support/refc/runtime.c +++ b/support/refc/runtime.c @@ -51,10 +51,6 @@ void removeReuseConstructor(Value_Constructor *constr) { (long long)constr->header.refCounter); constr->header.refCounter--; if (constr->header.refCounter == 0) { - if (constr->name) { - free(constr->name); - } - free(constr->args); free(constr); } } diff --git a/support/refc/stringOps.c b/support/refc/stringOps.c index b286b7afa..cb327a108 100644 --- a/support/refc/stringOps.c +++ b/support/refc/stringOps.c @@ -92,7 +92,7 @@ char *fastPack(Value *charList) { int l = 0; current = (Value_Constructor *)charList; - while (current->total == 2) { + while (current != NULL) { l++; current = (Value_Constructor *)current->args[1]; } @@ -102,7 +102,7 @@ char *fastPack(Value *charList) { int i = 0; current = (Value_Constructor *)charList; - while (current->total == 2) { + while (current != NULL) { retVal[i++] = ((Value_Char *)current->args[0])->c; current = (Value_Constructor *)current->args[1]; } @@ -112,25 +112,24 @@ char *fastPack(Value *charList) { Value *fastUnpack(char *str) { if (str[0] == '\0') { - return (Value *)newConstructor(0, 0, "Prelude_Types_Nil"); + return (Value *)NULL; } - Value_Constructor *retVal = - newConstructor(2, 1, "Prelude_Types__colon_colon"); + Value_Constructor *retVal = newConstructor(2, 1); retVal->args[0] = (Value *)makeChar(str[0]); int i = 1; Value_Constructor *current = retVal; Value_Constructor *next; while (str[i] != '\0') { - next = newConstructor(2, 1, "Prelude_Types__colon_colon"); + next = newConstructor(2, 1); next->args[0] = (Value *)makeChar(str[i]); current->args[1] = (Value *)next; i++; current = next; } - current->args[1] = (Value *)newConstructor(0, 0, "Prelude_Types_Nil"); + current->args[1] = (Value *)NULL; return (Value *)retVal; } @@ -140,7 +139,7 @@ char *fastConcat(Value *strList) { int totalLength = 0; current = (Value_Constructor *)strList; - while (current->total == 2) { + while (current != NULL) { totalLength += strlen(((Value_String *)current->args[0])->str); current = (Value_Constructor *)current->args[1]; } @@ -152,7 +151,7 @@ char *fastConcat(Value *strList) { int currentStrLen; int offset = 0; current = (Value_Constructor *)strList; - while (current->total == 2) { + while (current != NULL) { currentStr = ((Value_String *)current->args[0])->str; currentStrLen = strlen(currentStr); memcpy(retVal + offset, currentStr, currentStrLen); @@ -209,13 +208,12 @@ Value *stringIteratorNext(char *s, Value *it_p) { char c = it->str[it->pos]; if (c == '\0') { - return (Value *)newConstructor(0, 0, "Data_String_Iterator_EOF"); + return (Value *)NULL; } it->pos++; // Ok to do this as StringIterator linear - Value_Constructor *retVal = - newConstructor(2, 1, "Data_String_Iterator_Character"); + Value_Constructor *retVal = newConstructor(2, 1); retVal->args[0] = (Value *)makeChar(c); retVal->args[1] = newReference(it_p); diff --git a/tests/refc/basicpatternmatch/Main.idr b/tests/refc/basicpatternmatch/Main.idr index 5aeb8b84b..3cde2f5ca 100644 --- a/tests/refc/basicpatternmatch/Main.idr +++ b/tests/refc/basicpatternmatch/Main.idr @@ -7,6 +7,7 @@ bw Bits8 = Just 8 bw Bits16 = Just 16 bw Int8 = Just 8 bw String = Nothing +bw Char = Just 8 bw _ = Nothing data D = D0 | D1 Int | D2 | D3 @@ -19,10 +20,7 @@ Show D where main : IO () main = do - printLn $ bw Int8 - printLn $ bw Bits16 - printLn $ bw String - printLn $ bw Integer + printLn $ map bw [Int8, Bits16, Char, String, Integer, (), Nat] -- printLn $ map (\case "ABCDE" => "U" diff --git a/tests/refc/basicpatternmatch/expected b/tests/refc/basicpatternmatch/expected index a2d2b22fc..8a11a38b4 100644 --- a/tests/refc/basicpatternmatch/expected +++ b/tests/refc/basicpatternmatch/expected @@ -1,7 +1,4 @@ -Just 8 -Just 16 -Nothing -Nothing +[Just 8, Just 16, Just 8, Nothing, Nothing, Nothing, Nothing] ["empty", "U", "ZZZ", "L", "L"] ["?", "?", "?", "1.0", "?", "?", "2.2"] "AbC????" diff --git a/tests/refc/callingConvention/expected b/tests/refc/callingConvention/expected index bac1c5b5b..d2ac989dc 100644 --- a/tests/refc/callingConvention/expected +++ b/tests/refc/callingConvention/expected @@ -10,11 +10,10 @@ Value *Main_last , Value * var_1 ) { - Value * tmp_136 = NULL; // Main:5:8--5:14 - if (((Value_Constructor *)var_0)->tag == 0) { - removeReference(var_0); - tmp_136 = var_1; - } else if (((Value_Constructor *)var_0)->tag == 1) { + Value * tmp_134 = NULL; // Main:5:8--5:14 + if (NULL == var_0 /* Prelude.Basics.Nil [nil] */) { + tmp_134 = var_1; + } else if (NULL != var_0 /* Prelude.Basics.(::) [cons] */) { Value *var_2 = ((Value_Constructor*)var_0)->args[0]; Value *var_3 = ((Value_Constructor*)var_0)->args[1]; newReference(var_2); @@ -22,17 +21,17 @@ Value *Main_last removeReference(var_0); removeReference(var_1); // start Main_last(var_3, var_2) // Main:7:20--7:24 - Value_Arglist *arglist_137 = newArglist(0,2); - arglist_137->args[0] = var_3; - arglist_137->args[1] = var_2; - Value *(*fPtr_138)(Value_Arglist*) = Main_last_arglist; + Value_Arglist *arglist_135 = newArglist(0,2); + arglist_135->args[0] = var_3; + arglist_135->args[1] = var_2; + Value *(*fPtr_136)(Value_Arglist*) = Main_last_arglist; // Main:7:20--7:24 - Value *closure_138 = (Value*)makeClosureFromArglist(fPtr_138, arglist_137); + Value *closure_136 = (Value*)makeClosureFromArglist(fPtr_136, arglist_135); // Main:7:20--7:24 // end Main_last(var_3, var_2) // Main:7:20--7:24 - tmp_136 = closure_138; + tmp_134 = closure_136; } - return tmp_136; + return tmp_134; } Value *Main_last_arglist(Value_Arglist* arglist) { @@ -148,70 +147,64 @@ Value *Main_main(void) // Main:10:27--10:28 Value * var_9 = (Value*)makeClosureFromArglist(closure_77, arglist_76); // Main:10:8--10:12 - Value_Constructor* constructor_78 = newConstructor(0, 0, "Prelude_Basics_Nil"); - // Main:11:8--11:10 - // constructor Prelude_Basics_Nil // Main:11:8--11:10 - Value * var_6 = (Value*)constructor_78; // Main:11:11--11:13 - Value_Constructor* constructor_79 = newConstructor(0, 0, "Prelude_Basics_Lin"); - // Prelude.Types:605:21--605:24 - // constructor Prelude_Basics_Lin // Prelude.Types:605:21--605:24 - Value * var_3 = (Value*)constructor_79; // Prelude.Types:605:11--605:20 - Value_Arglist *arglist_80 = newArglist(1,1); - Value *(*closure_81)(Value_Arglist*) = Main_main_11_arglist; + Value * var_6 = (NULL /* Prelude.Basics.Nil */); // Main:11:11--11:13 + Value * var_3 = (NULL /* Prelude.Basics.Lin */); // Prelude.Types:605:11--605:20 + Value_Arglist *arglist_78 = newArglist(1,1); + Value *(*closure_79)(Value_Arglist*) = Main_main_11_arglist; // Main:11:21--11:22 - Value * var_4 = (Value*)makeClosureFromArglist(closure_81, arglist_80); + Value * var_4 = (Value*)makeClosureFromArglist(closure_79, arglist_78); // Prelude.Types:605:11--605:20 // start csegen_44() - Value_Arglist *arglist_82 = newArglist(0,0); - Value *(*fPtr_83)(Value_Arglist*) = csegen_44_arglist; - Value *closure_83 = (Value*)makeClosureFromArglist(fPtr_83, arglist_82); + Value_Arglist *arglist_80 = newArglist(0,0); + Value *(*fPtr_81)(Value_Arglist*) = csegen_44_arglist; + Value *closure_81 = (Value*)makeClosureFromArglist(fPtr_81, arglist_80); // end csegen_44() - Value * var_0 = trampoline(closure_83); // Prelude.Types:1121:1--1138:48 + Value * var_0 = trampoline(closure_81); // Prelude.Types:1121:1--1138:48 Value * var_1 = (Value*)makeIntegerLiteral("1"); // Prelude.Types:1121:1--1138:48 Value * var_2 = (Value*)makeIntegerLiteral("5"); // Prelude.Types:1121:1--1138:48 // start Prelude_Types_rangeFromTo_Range__dollara(var_0, var_1, var_2) // Prelude.Types:1121:1--1138:48 - Value_Arglist *arglist_84 = newArglist(0,3); - arglist_84->args[0] = var_0; - arglist_84->args[1] = var_1; - arglist_84->args[2] = var_2; - Value *(*fPtr_85)(Value_Arglist*) = Prelude_Types_rangeFromTo_Range__dollara_arglist; + Value_Arglist *arglist_82 = newArglist(0,3); + arglist_82->args[0] = var_0; + arglist_82->args[1] = var_1; + arglist_82->args[2] = var_2; + Value *(*fPtr_83)(Value_Arglist*) = Prelude_Types_rangeFromTo_Range__dollara_arglist; // Prelude.Types:1121:1--1138:48 - Value *closure_85 = (Value*)makeClosureFromArglist(fPtr_85, arglist_84); + Value *closure_83 = (Value*)makeClosureFromArglist(fPtr_83, arglist_82); // Prelude.Types:1121:1--1138:48 // end Prelude_Types_rangeFromTo_Range__dollara(var_0, var_1, var_2) // Prelude.Types:1121:1--1138:48 - Value * var_5 = trampoline(closure_85); // Prelude.Types:605:11--605:20 + Value * var_5 = trampoline(closure_83); // Prelude.Types:605:11--605:20 // start Prelude_Types_List_mapAppend(var_3, var_4, var_5) // Prelude.Types:605:11--605:20 - Value_Arglist *arglist_86 = newArglist(0,3); - arglist_86->args[0] = var_3; - arglist_86->args[1] = var_4; - arglist_86->args[2] = var_5; - Value *(*fPtr_87)(Value_Arglist*) = Prelude_Types_List_mapAppend_arglist; + Value_Arglist *arglist_84 = newArglist(0,3); + arglist_84->args[0] = var_3; + arglist_84->args[1] = var_4; + arglist_84->args[2] = var_5; + Value *(*fPtr_85)(Value_Arglist*) = Prelude_Types_List_mapAppend_arglist; // Prelude.Types:605:11--605:20 - Value *closure_87 = (Value*)makeClosureFromArglist(fPtr_87, arglist_86); + Value *closure_85 = (Value*)makeClosureFromArglist(fPtr_85, arglist_84); // Prelude.Types:605:11--605:20 // end Prelude_Types_List_mapAppend(var_3, var_4, var_5) // Prelude.Types:605:11--605:20 - Value * var_7 = trampoline(closure_87); // Main:11:11--11:13 - Value_Constructor* constructor_88 = newConstructor(2, 1, "Prelude_Basics__colon_colon"); + Value * var_7 = trampoline(closure_85); // Main:11:11--11:13 + // constructor Prelude.Basics.(::) // Main:11:11--11:13 + Value_Constructor* constructor_86 = newConstructor(2, 1); // Main:11:11--11:13 - // constructor Prelude_Basics__colon_colon // Main:11:11--11:13 - constructor_88->args[0] = var_6; - constructor_88->args[1] = var_7; - Value * var_10 = (Value*)constructor_88; // Main:10:8--10:12 + constructor_86->args[0] = var_6; + constructor_86->args[1] = var_7; + Value * var_10 = (Value*)constructor_86; // Main:10:8--10:12 // start Prelude_Basics_flip(var_8, var_9, var_10) // Main:10:8--10:12 - Value_Arglist *arglist_89 = newArglist(0,3); - arglist_89->args[0] = var_8; - arglist_89->args[1] = var_9; - arglist_89->args[2] = var_10; - Value *(*fPtr_90)(Value_Arglist*) = Prelude_Basics_flip_arglist; + Value_Arglist *arglist_87 = newArglist(0,3); + arglist_87->args[0] = var_8; + arglist_87->args[1] = var_9; + arglist_87->args[2] = var_10; + Value *(*fPtr_88)(Value_Arglist*) = Prelude_Basics_flip_arglist; // Main:10:8--10:12 - Value *closure_90 = (Value*)makeClosureFromArglist(fPtr_90, arglist_89); + Value *closure_88 = (Value*)makeClosureFromArglist(fPtr_88, arglist_87); // Main:10:8--10:12 // end Prelude_Basics_flip(var_8, var_9, var_10) // Main:10:8--10:12 - return closure_90; + return closure_88; } Value *Main_main_arglist(Value_Arglist* arglist) { @@ -225,25 +218,25 @@ Value *Main_main_11 ) { // start csegen_44() - Value_Arglist *arglist_91 = newArglist(0,0); - Value *(*fPtr_92)(Value_Arglist*) = csegen_44_arglist; - Value *closure_92 = (Value*)makeClosureFromArglist(fPtr_92, arglist_91); + Value_Arglist *arglist_89 = newArglist(0,0); + Value *(*fPtr_90)(Value_Arglist*) = csegen_44_arglist; + Value *closure_90 = (Value*)makeClosureFromArglist(fPtr_90, arglist_89); // end csegen_44() - Value * var_1 = trampoline(closure_92); // Prelude.Types:1121:1--1138:48 + Value * var_1 = trampoline(closure_90); // Prelude.Types:1121:1--1138:48 Value * var_2 = (Value*)makeIntegerLiteral("1"); // Prelude.Types:1121:1--1138:48 // start Prelude_Types_rangeFromTo_Range__dollara(var_1, var_2, var_0) // Prelude.Types:1121:1--1138:48 - Value_Arglist *arglist_93 = newArglist(0,3); - arglist_93->args[0] = var_1; - arglist_93->args[1] = var_2; - arglist_93->args[2] = var_0; - Value *(*fPtr_94)(Value_Arglist*) = Prelude_Types_rangeFromTo_Range__dollara_arglist; + Value_Arglist *arglist_91 = newArglist(0,3); + arglist_91->args[0] = var_1; + arglist_91->args[1] = var_2; + arglist_91->args[2] = var_0; + Value *(*fPtr_92)(Value_Arglist*) = Prelude_Types_rangeFromTo_Range__dollara_arglist; // Prelude.Types:1121:1--1138:48 - Value *closure_94 = (Value*)makeClosureFromArglist(fPtr_94, arglist_93); + Value *closure_92 = (Value*)makeClosureFromArglist(fPtr_92, arglist_91); // Prelude.Types:1121:1--1138:48 // end Prelude_Types_rangeFromTo_Range__dollara(var_1, var_2, var_0) // Prelude.Types:1121:1--1138:48 - return closure_94; + return closure_92; } Value *Main_main_11_arglist(Value_Arglist* arglist) { @@ -260,38 +253,38 @@ Value *Main_main_10 { Value * var_2 = (Value*)makeIntegerLiteral("0"); // Main:10:30--10:36 // start Main_last(var_1, var_2) // Main:10:30--10:36 - Value_Arglist *arglist_95 = newArglist(0,2); - arglist_95->args[0] = var_1; - arglist_95->args[1] = var_2; - Value *(*fPtr_96)(Value_Arglist*) = Main_last_arglist; // Main:10:30--10:36 - Value *closure_96 = (Value*)makeClosureFromArglist(fPtr_96, arglist_95); + Value_Arglist *arglist_93 = newArglist(0,2); + arglist_93->args[0] = var_1; + arglist_93->args[1] = var_2; + Value *(*fPtr_94)(Value_Arglist*) = Main_last_arglist; // Main:10:30--10:36 + Value *closure_94 = (Value*)makeClosureFromArglist(fPtr_94, arglist_93); // Main:10:30--10:36 // end Main_last(var_1, var_2) // Main:10:30--10:36 - Value * var_3 = trampoline(closure_96); // Prelude.Show:110:1--112:50 + Value * var_3 = trampoline(closure_94); // Prelude.Show:110:1--112:50 // start Prelude_Show_show_Show_Integer(var_3) // Prelude.Show:110:1--112:50 - Value_Arglist *arglist_97 = newArglist(0,1); - arglist_97->args[0] = var_3; - Value *(*fPtr_98)(Value_Arglist*) = Prelude_Show_show_Show_Integer_arglist; + Value_Arglist *arglist_95 = newArglist(0,1); + arglist_95->args[0] = var_3; + Value *(*fPtr_96)(Value_Arglist*) = Prelude_Show_show_Show_Integer_arglist; // Prelude.Show:110:1--112:50 - Value *closure_98 = (Value*)makeClosureFromArglist(fPtr_98, arglist_97); + Value *closure_96 = (Value*)makeClosureFromArglist(fPtr_96, arglist_95); // Prelude.Show:110:1--112:50 // end Prelude_Show_show_Show_Integer(var_3) // Prelude.Show:110:1--112:50 - Value * var_4 = trampoline(closure_98); + Value * var_4 = trampoline(closure_96); Value * var_5 = (Value*)makeString("\x0a"""); - Value *primVar_99 = strAppend(var_4, var_5); + Value *primVar_97 = strAppend(var_4, var_5); removeReference(var_5); removeReference(var_4); - Value * var_6 = primVar_99; // Prelude.IO:98:22--98:34 + Value * var_6 = primVar_97; // Prelude.IO:98:22--98:34 // start Prelude_IO_prim__putStr(var_6, var_0) // Prelude.IO:98:22--98:34 - Value_Arglist *arglist_100 = newArglist(0,2); - arglist_100->args[0] = var_6; - arglist_100->args[1] = var_0; - Value *(*fPtr_101)(Value_Arglist*) = Prelude_IO_prim__putStr_arglist; + Value_Arglist *arglist_98 = newArglist(0,2); + arglist_98->args[0] = var_6; + arglist_98->args[1] = var_0; + Value *(*fPtr_99)(Value_Arglist*) = Prelude_IO_prim__putStr_arglist; // Prelude.IO:98:22--98:34 - Value *closure_101 = (Value*)makeClosureFromArglist(fPtr_101, arglist_100); + Value *closure_99 = (Value*)makeClosureFromArglist(fPtr_99, arglist_98); // Prelude.IO:98:22--98:34 // end Prelude_IO_prim__putStr(var_6, var_0) // Prelude.IO:98:22--98:34 - return closure_101; + return closure_99; } Value *Main_main_10_arglist(Value_Arglist* arglist) { @@ -307,73 +300,73 @@ Value *Main_main_9 , Value * var_0 ) { - Value_Arglist *arglist_102 = newArglist(5,5); - Value *(*closure_103)(Value_Arglist*) = Main_main_0_arglist; - Value * var_2 = (Value*)makeClosureFromArglist(closure_103, arglist_102); + Value_Arglist *arglist_100 = newArglist(5,5); + Value *(*closure_101)(Value_Arglist*) = Main_main_0_arglist; + Value * var_2 = (Value*)makeClosureFromArglist(closure_101, arglist_100); // Prelude.IO:19:1--26:30 - Value_Arglist *arglist_104 = newArglist(3,3); - Value *(*closure_105)(Value_Arglist*) = Main_main_1_arglist; - Value * var_3 = (Value*)makeClosureFromArglist(closure_105, arglist_104); + Value_Arglist *arglist_102 = newArglist(3,3); + Value *(*closure_103)(Value_Arglist*) = Main_main_1_arglist; + Value * var_3 = (Value*)makeClosureFromArglist(closure_103, arglist_102); // Prelude.IO:19:1--26:30 - Value_Arglist *arglist_106 = newArglist(5,5); - Value *(*closure_107)(Value_Arglist*) = Main_main_2_arglist; - Value * var_4 = (Value*)makeClosureFromArglist(closure_107, arglist_106); + Value_Arglist *arglist_104 = newArglist(5,5); + Value *(*closure_105)(Value_Arglist*) = Main_main_2_arglist; + Value * var_4 = (Value*)makeClosureFromArglist(closure_105, arglist_104); // Prelude.IO:19:1--26:30 - Value_Constructor* constructor_108 = newConstructor(3, 0, "Prelude_Interfaces_MkApplicative"); + // constructor Prelude.Interfaces.MkApplicative // Prelude.IO:19:1--26:30 + Value_Constructor* constructor_106 = newConstructor(3, 0); // Prelude.IO:19:1--26:30 - // constructor Prelude_Interfaces_MkApplicative // Prelude.IO:19:1--26:30 - constructor_108->args[0] = var_2; - constructor_108->args[1] = var_3; - constructor_108->args[2] = var_4; - Value * var_11 = (Value*)constructor_108; // Main:10:13--10:17 + constructor_106->args[0] = var_2; + constructor_106->args[1] = var_3; + constructor_106->args[2] = var_4; + Value * var_11 = (Value*)constructor_106; // Main:10:13--10:17 + Value_Arglist *arglist_107 = newArglist(5,5); + Value *(*closure_108)(Value_Arglist*) = Main_main_3_arglist; + Value * var_5 = (Value*)makeClosureFromArglist(closure_108, arglist_107); + // Prelude.Types:656:1--669:59 Value_Arglist *arglist_109 = newArglist(5,5); - Value *(*closure_110)(Value_Arglist*) = Main_main_3_arglist; - Value * var_5 = (Value*)makeClosureFromArglist(closure_110, arglist_109); + Value *(*closure_110)(Value_Arglist*) = Main_main_4_arglist; + Value * var_6 = (Value*)makeClosureFromArglist(closure_110, arglist_109); // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_111 = newArglist(5,5); - Value *(*closure_112)(Value_Arglist*) = Main_main_4_arglist; - Value * var_6 = (Value*)makeClosureFromArglist(closure_112, arglist_111); + Value_Arglist *arglist_111 = newArglist(2,2); + Value *(*closure_112)(Value_Arglist*) = Main_main_5_arglist; + Value * var_7 = (Value*)makeClosureFromArglist(closure_112, arglist_111); // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_113 = newArglist(2,2); - Value *(*closure_114)(Value_Arglist*) = Main_main_5_arglist; - Value * var_7 = (Value*)makeClosureFromArglist(closure_114, arglist_113); + Value_Arglist *arglist_113 = newArglist(7,7); + Value *(*closure_114)(Value_Arglist*) = Main_main_6_arglist; + Value * var_8 = (Value*)makeClosureFromArglist(closure_114, arglist_113); // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_115 = newArglist(7,7); - Value *(*closure_116)(Value_Arglist*) = Main_main_6_arglist; - Value * var_8 = (Value*)makeClosureFromArglist(closure_116, arglist_115); + Value_Arglist *arglist_115 = newArglist(2,2); + Value *(*closure_116)(Value_Arglist*) = Main_main_7_arglist; + Value * var_9 = (Value*)makeClosureFromArglist(closure_116, arglist_115); // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_117 = newArglist(2,2); - Value *(*closure_118)(Value_Arglist*) = Main_main_7_arglist; - Value * var_9 = (Value*)makeClosureFromArglist(closure_118, arglist_117); + Value_Arglist *arglist_117 = newArglist(5,5); + Value *(*closure_118)(Value_Arglist*) = Main_main_8_arglist; + Value * var_10 = (Value*)makeClosureFromArglist(closure_118, arglist_117); // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_119 = newArglist(5,5); - Value *(*closure_120)(Value_Arglist*) = Main_main_8_arglist; - Value * var_10 = (Value*)makeClosureFromArglist(closure_120, arglist_119); + // constructor Prelude.Interfaces.MkFoldable // Prelude.Types:656:1--669:59 + Value_Constructor* constructor_119 = newConstructor(6, 0); // Prelude.Types:656:1--669:59 - Value_Constructor* constructor_121 = newConstructor(6, 0, "Prelude_Interfaces_MkFoldable"); - // Prelude.Types:656:1--669:59 - // constructor Prelude_Interfaces_MkFoldable // Prelude.Types:656:1--669:59 - constructor_121->args[0] = var_5; - constructor_121->args[1] = var_6; - constructor_121->args[2] = var_7; - constructor_121->args[3] = var_8; - constructor_121->args[4] = var_9; - constructor_121->args[5] = var_10; - Value * var_12 = (Value*)constructor_121; // Main:10:13--10:17 + constructor_119->args[0] = var_5; + constructor_119->args[1] = var_6; + constructor_119->args[2] = var_7; + constructor_119->args[3] = var_8; + constructor_119->args[4] = var_9; + constructor_119->args[5] = var_10; + Value * var_12 = (Value*)constructor_119; // Main:10:13--10:17 // start Prelude_Interfaces_for_(var_11, var_12, var_1, var_0) // Main:10:13--10:17 - Value_Arglist *arglist_122 = newArglist(0,4); - arglist_122->args[0] = var_11; - arglist_122->args[1] = var_12; - arglist_122->args[2] = var_1; - arglist_122->args[3] = var_0; - Value *(*fPtr_123)(Value_Arglist*) = Prelude_Interfaces_for__arglist; + Value_Arglist *arglist_120 = newArglist(0,4); + arglist_120->args[0] = var_11; + arglist_120->args[1] = var_12; + arglist_120->args[2] = var_1; + arglist_120->args[3] = var_0; + Value *(*fPtr_121)(Value_Arglist*) = Prelude_Interfaces_for__arglist; // Main:10:13--10:17 - Value *closure_123 = (Value*)makeClosureFromArglist(fPtr_123, arglist_122); + Value *closure_121 = (Value*)makeClosureFromArglist(fPtr_121, arglist_120); // Main:10:13--10:17 // end Prelude_Interfaces_for_(var_11, var_12, var_1, var_0) // Main:10:13--10:17 - return closure_123; + return closure_121; } Value *Main_main_9_arglist(Value_Arglist* arglist) { @@ -396,17 +389,17 @@ Value *Main_main_8 removeReference(var_4); // start Prelude_Types_foldMap_Foldable_List(var_2, var_1, var_0) // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_124 = newArglist(0,3); - arglist_124->args[0] = var_2; - arglist_124->args[1] = var_1; - arglist_124->args[2] = var_0; - Value *(*fPtr_125)(Value_Arglist*) = Prelude_Types_foldMap_Foldable_List_arglist; + Value_Arglist *arglist_122 = newArglist(0,3); + arglist_122->args[0] = var_2; + arglist_122->args[1] = var_1; + arglist_122->args[2] = var_0; + Value *(*fPtr_123)(Value_Arglist*) = Prelude_Types_foldMap_Foldable_List_arglist; // Prelude.Types:656:1--669:59 - Value *closure_125 = (Value*)makeClosureFromArglist(fPtr_125, arglist_124); + Value *closure_123 = (Value*)makeClosureFromArglist(fPtr_123, arglist_122); // Prelude.Types:656:1--669:59 // end Prelude_Types_foldMap_Foldable_List(var_2, var_1, var_0) // Prelude.Types:656:1--669:59 - return closure_125; + return closure_123; } Value *Main_main_8_arglist(Value_Arglist* arglist) { @@ -452,18 +445,18 @@ Value *Main_main_6 removeReference(var_6); // start Prelude_Types_foldlM_Foldable_List(var_3, var_2, var_1, var_0) // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_126 = newArglist(0,4); - arglist_126->args[0] = var_3; - arglist_126->args[1] = var_2; - arglist_126->args[2] = var_1; - arglist_126->args[3] = var_0; - Value *(*fPtr_127)(Value_Arglist*) = Prelude_Types_foldlM_Foldable_List_arglist; + Value_Arglist *arglist_124 = newArglist(0,4); + arglist_124->args[0] = var_3; + arglist_124->args[1] = var_2; + arglist_124->args[2] = var_1; + arglist_124->args[3] = var_0; + Value *(*fPtr_125)(Value_Arglist*) = Prelude_Types_foldlM_Foldable_List_arglist; // Prelude.Types:656:1--669:59 - Value *closure_127 = (Value*)makeClosureFromArglist(fPtr_127, arglist_126); + Value *closure_125 = (Value*)makeClosureFromArglist(fPtr_125, arglist_124); // Prelude.Types:656:1--669:59 // end Prelude_Types_foldlM_Foldable_List(var_3, var_2, var_1, var_0) // Prelude.Types:656:1--669:59 - return closure_127; + return closure_125; } Value *Main_main_6_arglist(Value_Arglist* arglist) { @@ -486,14 +479,14 @@ Value *Main_main_5 { removeReference(var_1); // start Prelude_Types_null_Foldable_List(var_0) // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_128 = newArglist(0,1); - arglist_128->args[0] = var_0; - Value *(*fPtr_129)(Value_Arglist*) = Prelude_Types_null_Foldable_List_arglist; + Value_Arglist *arglist_126 = newArglist(0,1); + arglist_126->args[0] = var_0; + Value *(*fPtr_127)(Value_Arglist*) = Prelude_Types_null_Foldable_List_arglist; // Prelude.Types:656:1--669:59 - Value *closure_129 = (Value*)makeClosureFromArglist(fPtr_129, arglist_128); + Value *closure_127 = (Value*)makeClosureFromArglist(fPtr_127, arglist_126); // Prelude.Types:656:1--669:59 // end Prelude_Types_null_Foldable_List(var_0) // Prelude.Types:656:1--669:59 - return closure_129; + return closure_127; } Value *Main_main_5_arglist(Value_Arglist* arglist) { @@ -516,17 +509,17 @@ Value *Main_main_4 removeReference(var_4); // start Prelude_Types_foldl_Foldable_List(var_2, var_1, var_0) // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_130 = newArglist(0,3); - arglist_130->args[0] = var_2; - arglist_130->args[1] = var_1; - arglist_130->args[2] = var_0; - Value *(*fPtr_131)(Value_Arglist*) = Prelude_Types_foldl_Foldable_List_arglist; + Value_Arglist *arglist_128 = newArglist(0,3); + arglist_128->args[0] = var_2; + arglist_128->args[1] = var_1; + arglist_128->args[2] = var_0; + Value *(*fPtr_129)(Value_Arglist*) = Prelude_Types_foldl_Foldable_List_arglist; // Prelude.Types:656:1--669:59 - Value *closure_131 = (Value*)makeClosureFromArglist(fPtr_131, arglist_130); + Value *closure_129 = (Value*)makeClosureFromArglist(fPtr_129, arglist_128); // Prelude.Types:656:1--669:59 // end Prelude_Types_foldl_Foldable_List(var_2, var_1, var_0) // Prelude.Types:656:1--669:59 - return closure_131; + return closure_129; } Value *Main_main_4_arglist(Value_Arglist* arglist) { @@ -552,17 +545,17 @@ Value *Main_main_3 removeReference(var_4); // start Prelude_Types_foldr_Foldable_List(var_2, var_1, var_0) // Prelude.Types:656:1--669:59 - Value_Arglist *arglist_132 = newArglist(0,3); - arglist_132->args[0] = var_2; - arglist_132->args[1] = var_1; - arglist_132->args[2] = var_0; - Value *(*fPtr_133)(Value_Arglist*) = Prelude_Types_foldr_Foldable_List_arglist; + Value_Arglist *arglist_130 = newArglist(0,3); + arglist_130->args[0] = var_2; + arglist_130->args[1] = var_1; + arglist_130->args[2] = var_0; + Value *(*fPtr_131)(Value_Arglist*) = Prelude_Types_foldr_Foldable_List_arglist; // Prelude.Types:656:1--669:59 - Value *closure_133 = (Value*)makeClosureFromArglist(fPtr_133, arglist_132); + Value *closure_131 = (Value*)makeClosureFromArglist(fPtr_131, arglist_130); // Prelude.Types:656:1--669:59 // end Prelude_Types_foldr_Foldable_List(var_2, var_1, var_0) // Prelude.Types:656:1--669:59 - return closure_133; + return closure_131; } Value *Main_main_3_arglist(Value_Arglist* arglist) { @@ -634,16 +627,16 @@ Value *Main_main_0 removeReference(var_3); removeReference(var_4); // start Prelude_IO_map_Functor_IO(var_2, var_1, var_0) // Prelude.IO:15:1--17:38 - Value_Arglist *arglist_134 = newArglist(0,3); - arglist_134->args[0] = var_2; - arglist_134->args[1] = var_1; - arglist_134->args[2] = var_0; - Value *(*fPtr_135)(Value_Arglist*) = Prelude_IO_map_Functor_IO_arglist; + Value_Arglist *arglist_132 = newArglist(0,3); + arglist_132->args[0] = var_2; + arglist_132->args[1] = var_1; + arglist_132->args[2] = var_0; + Value *(*fPtr_133)(Value_Arglist*) = Prelude_IO_map_Functor_IO_arglist; // Prelude.IO:15:1--17:38 - Value *closure_135 = (Value*)makeClosureFromArglist(fPtr_135, arglist_134); + Value *closure_133 = (Value*)makeClosureFromArglist(fPtr_133, arglist_132); // Prelude.IO:15:1--17:38 // end Prelude_IO_map_Functor_IO(var_2, var_1, var_0) // Prelude.IO:15:1--17:38 - return closure_135; + return closure_133; } Value *Main_main_0_arglist(Value_Arglist* arglist) { diff --git a/tests/refc/reuse/expected b/tests/refc/reuse/expected index 51915b9c4..3716d8216 100644 --- a/tests/refc/reuse/expected +++ b/tests/refc/reuse/expected @@ -19,7 +19,7 @@ Value *Main_insert ) { Value * tmp_88 = NULL; // Main:6:24--6:31 - if (((Value_Constructor *)var_2)->tag == 0) { + if (((Value_Constructor *)var_2)->tag == 0 /* Main.Leaf */) { Value_Constructor* constructor_89 = NULL; if (isUnique(var_2)) { constructor_89 = (Value_Constructor*)var_2; @@ -28,23 +28,23 @@ Value *Main_insert removeReference(var_2); } removeReference(var_0); - if (!constructor_89) { // Main:7:22--7:26 - constructor_89 = newConstructor(0, 0, "Main_Leaf"); - // Main:7:22--7:26 + // constructor Main.Leaf // Main:7:22--7:26 + if (! constructor_89) { // Main:7:22--7:26 + constructor_89 = newConstructor(0, 0); // Main:7:22--7:26 } // Main:7:22--7:26 Value * var_3 = (Value*)constructor_89; // Main:7:17--7:21 - Value_Constructor* constructor_90 = newConstructor(0, 0, "Main_Leaf"); + // constructor Main.Leaf // Main:7:29--7:33 + Value_Constructor* constructor_90 = newConstructor(0, 0); // Main:7:29--7:33 - // constructor Main_Leaf // Main:7:29--7:33 Value * var_4 = (Value*)constructor_90; // Main:7:17--7:21 - Value_Constructor* constructor_91 = newConstructor(3, 1, "Main_Node"); + // constructor Main.Node // Main:7:17--7:21 + Value_Constructor* constructor_91 = newConstructor(3, 1); // Main:7:17--7:21 - // constructor Main_Node // Main:7:17--7:21 constructor_91->args[0] = var_3; constructor_91->args[1] = var_1; constructor_91->args[2] = var_4; tmp_88 = (Value*)constructor_91; - } else if (((Value_Constructor *)var_2)->tag == 1) { + } else if (((Value_Constructor *)var_2)->tag == 1 /* Main.Node */) { Value *var_5 = ((Value_Constructor*)var_2)->args[0]; Value *var_6 = ((Value_Constructor*)var_2)->args[1]; Value *var_7 = ((Value_Constructor*)var_2)->args[2]; @@ -59,7 +59,7 @@ Value *Main_insert removeReference(var_2); } Value * tmp_93 = NULL; // Prelude.EqOrd:121:3--121:6 - if (((Value_Constructor *)var_0)->tag == 0) { + if (((Value_Constructor *)var_0)->tag == 0 /* Prelude.EqOrd.MkOrd */) { Value *var_8 = ((Value_Constructor*)var_0)->args[0]; Value *var_9 = ((Value_Constructor*)var_0)->args[1]; Value *var_10 = ((Value_Constructor*)var_0)->args[2]; @@ -89,9 +89,9 @@ Value *Main_insert // Main:8:48--8:54 // end Main_insert(var_0, var_1, var_5) // Main:8:48--8:54 Value * var_17 = trampoline(closure_97); // Main:8:42--8:46 - if (!constructor_92) { // Main:8:42--8:46 - constructor_92 = newConstructor(3, 1, "Main_Node"); - // Main:8:42--8:46 + // constructor Main.Node // Main:8:42--8:46 + if (! constructor_92) { // Main:8:42--8:46 + constructor_92 = newConstructor(3, 1); // Main:8:42--8:46 } // Main:8:42--8:46 constructor_92->args[0] = var_17; constructor_92->args[1] = var_6; @@ -110,9 +110,9 @@ Value *Main_insert // Main:9:52--9:58 // end Main_insert(var_0, var_1, var_7) // Main:9:52--9:58 Value * var_18 = trampoline(closure_99); // Main:9:42--9:46 - if (!constructor_92) { // Main:9:42--9:46 - constructor_92 = newConstructor(3, 1, "Main_Node"); - // Main:9:42--9:46 + // constructor Main.Node // Main:9:42--9:46 + if (! constructor_92) { // Main:9:42--9:46 + constructor_92 = newConstructor(3, 1); // Main:9:42--9:46 } // Main:9:42--9:46 constructor_92->args[0] = var_5; constructor_92->args[1] = var_6; diff --git a/tests/refc/reuse/run b/tests/refc/reuse/run index 2d6a0825d..20b3b22f3 100644 --- a/tests/refc/reuse/run +++ b/tests/refc/reuse/run @@ -1,5 +1,5 @@ -rm -rf build +. ../../testutils.sh -$1 --no-banner --no-color --console-width 0 --cg refc -o main Main.idr > /dev/null +idris2 --cg refc -o main Main.idr $VALGRIND ./build/exec/main awk -v RS= '/Value \*Main_insert/' build/exec/main.c \ No newline at end of file