mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-12-20 10:02:03 +03:00
1dc7b74e4e
* [RefC] Suppress code generation for unnecessary arglist wrappers. * [RefC] cleanup dead code of arglist. * Removed Value_Arglist to reduce Closure's allocation overhead. * fix linter error * [RefC] make trampoline() safety. * [RefC] cleanup cStatementsFromANF to keep code simple. * fix linter error * fix linter error * In another time, another galaxy. THE LINTER INVADORS conquaer the all humanity and make them slaves. Under 2024, a only leaved job for every humans is adjusting spaces of source code, or just type gg0vG$== in vim. * [ test ] update golden value * added supports 32 params on closure. * [RefC] [Cleanup] removing duplicate codes. * [RefC] Switch calling conventions based on the number of arguments to avoid limits on the number of arguments and to reduce stack usage. * [RefC] Argument that are too large are placed on the heap, as are closures. * [RefC] use idris2_malloc instead of malloc. * [RefC] [Cleanup] Keep pure things pure. * [RefC] Mapped some special constructors to NULL. This reduces malloc cost and generates simpler code in ConCase. But not work yet. * [RefC] fix merge failure. * [RefC] stringOps.c replace NULL for NIL. * [RefC] cleanup * [RefC] ConstCase now generate simple if-then statements instead of using helpers. This reduces malloc/free costs. * fix indentation * fix whitespaces * [RefC] The name field in Value_Constructor was restored for tycon. But changed to static const*. Hopefully the C compiler will remove the common string constants. The smartest thing to do would be to create a dummy global variable and use its address as a tag, but that would depend on the C compiler to resolve conflicts. * [refc] a big changes of the space * [RefC] Little tricks to reduce temporary variables * spaces * [RefC] fix compiler warnings * [RefC] [test] Perform memory leak analysis, if valgrind is installed. * [RefC] Fix invalid memory read. Fix C compiler warnings. * [RefC] Fix invalid memory read of strSubstr. [test] Perform memory leak analysis, if valgrind is installed. * [test] fix junk line * linter * linter * linter * linter * [RefC] merge with erase_trivial_constuctors * merge w/ erase_trivial_constructors * Revert "merge w/ erase_trivial_constructors" This reverts commitbe593a3715
. * Revert "[RefC] merge with erase_trivial_constuctors" This reverts commit3c21eb45d8
. * merge w/ upstream/main * fix merge failure * rename * fix renaming * [RefC] fix merge fail * [RefC] renamed C functions for safty. * [RefC] cleanup * [RefC] Fix constructor tag of UnconsResult.CHARACTER. --------- Co-authored-by: Mathew Polzin <matt.polzin@gmail.com> Co-authored-by: Guillaume Allais <guillaume.allais@ens-lyon.org>
109 lines
5.0 KiB
Plaintext
109 lines
5.0 KiB
Plaintext
2
|
|
3
|
|
4
|
|
5
|
|
2
|
|
4
|
|
Value *Main_insert
|
|
(
|
|
Value * var_0
|
|
, Value * var_1
|
|
, Value * var_2
|
|
);
|
|
Value *Main_insert
|
|
(
|
|
Value * var_0
|
|
, Value * var_1
|
|
, Value * var_2
|
|
)
|
|
{
|
|
Value * tmp_34 = NULL; // Main:6:24--6:31
|
|
if (((Value_Constructor *)var_2)->tag == 0 /* Main.Leaf */) {
|
|
Value_Constructor* constructor_35 = NULL;
|
|
if (idris2_isUnique(var_2)) {
|
|
constructor_35 = (Value_Constructor*)var_2;
|
|
}
|
|
else {
|
|
idris2_removeReference(var_2);
|
|
}
|
|
idris2_removeReference(var_0);
|
|
// constructor Main.Leaf // Main:7:22--7:26
|
|
if (! constructor_35) { // Main:7:22--7:26
|
|
constructor_35 = idris2_newConstructor(0, 0); // Main:7:22--7:26
|
|
} // Main:7:22--7:26
|
|
Value * var_3 = (Value*)constructor_35; // Main:7:17--7:21
|
|
// constructor Main.Leaf // Main:7:29--7:33
|
|
Value_Constructor* constructor_36 = idris2_newConstructor(0, 0);
|
|
// Main:7:29--7:33
|
|
Value * var_4 = (Value*)constructor_36; // Main:7:17--7:21
|
|
// constructor Main.Node // Main:7:17--7:21
|
|
Value_Constructor* constructor_37 = idris2_newConstructor(3, 1);
|
|
// Main:7:17--7:21
|
|
constructor_37->args[0] = var_3;
|
|
constructor_37->args[1] = var_1;
|
|
constructor_37->args[2] = var_4;
|
|
tmp_34 = (Value*)constructor_37;
|
|
} 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];
|
|
Value_Constructor* constructor_38 = NULL;
|
|
if (idris2_isUnique(var_2)) {
|
|
constructor_38 = (Value_Constructor*)var_2;
|
|
}
|
|
else {
|
|
idris2_newReference(var_5);
|
|
idris2_newReference(var_6);
|
|
idris2_newReference(var_7);
|
|
idris2_removeReference(var_2);
|
|
}
|
|
Value * tmp_39 = NULL; // Prelude.EqOrd:121:3--121:6
|
|
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];
|
|
Value *var_11 = ((Value_Constructor*)var_0)->args[3];
|
|
Value *var_12 = ((Value_Constructor*)var_0)->args[4];
|
|
Value *var_13 = ((Value_Constructor*)var_0)->args[5];
|
|
Value *var_14 = ((Value_Constructor*)var_0)->args[6];
|
|
Value *var_15 = ((Value_Constructor*)var_0)->args[7];
|
|
idris2_newReference(var_10);
|
|
Value * var_16 = idris2_apply_closure(var_10, idris2_newReference(var_1));
|
|
// Prelude.EqOrd:121:3--121:6
|
|
tmp_39 = idris2_apply_closure(var_16, idris2_newReference(var_6));
|
|
}
|
|
Value * var_19 = tmp_39;
|
|
Value *tmp_40 = NULL;
|
|
int64_t tmp_41 = idris2_extractInt(var_19);
|
|
if (tmp_41 == UINT8_C(1)) {
|
|
idris2_removeReference(var_19);
|
|
Value * var_17 = idris2_trampoline(Main_insert(var_0, var_1, var_5));
|
|
// Main:8:42--8:46
|
|
// constructor Main.Node // Main:8:42--8:46
|
|
if (! constructor_38) { // Main:8:42--8:46
|
|
constructor_38 = idris2_newConstructor(3, 1);
|
|
// Main:8:42--8:46
|
|
} // Main:8:42--8:46
|
|
constructor_38->args[0] = var_17;
|
|
constructor_38->args[1] = var_6;
|
|
constructor_38->args[2] = var_7;
|
|
tmp_40 = (Value*)constructor_38;
|
|
} else if (tmp_41 == UINT8_C(0)) {
|
|
idris2_removeReference(var_19);
|
|
Value * var_18 = idris2_trampoline(Main_insert(var_0, var_1, var_7));
|
|
// Main:9:42--9:46
|
|
// constructor Main.Node // Main:9:42--9:46
|
|
if (! constructor_38) { // Main:9:42--9:46
|
|
constructor_38 = idris2_newConstructor(3, 1);
|
|
// Main:9:42--9:46
|
|
} // Main:9:42--9:46
|
|
constructor_38->args[0] = var_5;
|
|
constructor_38->args[1] = var_6;
|
|
constructor_38->args[2] = var_18;
|
|
tmp_40 = (Value*)constructor_38;
|
|
}
|
|
tmp_34 = tmp_40;
|
|
}
|
|
return tmp_34;
|
|
}
|