File tree Expand file tree Collapse file tree 6 files changed +41
-42
lines changed Expand file tree Collapse file tree 6 files changed +41
-42
lines changed Original file line number Diff line number Diff line change 11// / Copyright: Copyright (c) 2022 Andrey Penechko.
22// / License: $(WEB boost.org/LICENSE_1_0.txt, Boost License 1.0).
33// / Authors: Andrey Penechko.
4+
5+ // / C API bindings
46module libvox ;
57
68// SliceString that are passed to Vox compiler must remain valid until vox_free
Original file line number Diff line number Diff line change 33[ ![ CI] ( https://github.com/MrSmith33/vox/workflows/CI/badge.svg?branch=master&event=push )] ( https://github.com/MrSmith33/tiny_jit/releases/tag/CI )
44
55* [ Latest CI build] ( https://github.com/MrSmith33/tiny_jit/releases/tag/CI )
6- * [ Channel on /r/ProgrammingLanguages discord] ( https://discord.gg/HpYYhH4 ) - Projects P -Y -> Vox
6+ * [ Channel on /r/ProgrammingLanguages discord] ( https://discord.gg/HpYYhH4 ) - Projects Q -Y -> Vox
77
88# Vox programming language
99
@@ -217,8 +217,9 @@ All `.vx` files will be highlighted and classified as D.
217217
218218## Stats
219219
220- - Impl size: 36k LoC of D, 3MB exe
220+ - Impl size: 40k LoC of D, 3MB exe
221221- Time to compile: 4s debug / 45s release
222- - Test suite: 75ms for 302 tests
222+ - Test suite: 95ms for 361 tests
223+ - Time to compile 10MLoC of fibonacci: 8s on Windows, 7.5s on Linux
223224
224225For more in detail description of implementation see [ internals.md] ( internals.md )
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ void vox_begin_compilation(VoxCompiler* compiler) {
4545 compiler.driver.beginCompilation();
4646}
4747
48- Identifier vox_id_get_or_reg (VoxCompiler* compiler, SliceString hostModuleName ) {
49- return compiler.driver.context.idMap.getOrRegFqn(&compiler.driver.context, cast (string )hostModuleName );
48+ Identifier vox_id_get_or_reg (VoxCompiler* compiler, SliceString str ) {
49+ return compiler.driver.context.idMap.getOrRegFqn(&compiler.driver.context, cast (string )str );
5050}
5151
5252// String is owned by the library
Original file line number Diff line number Diff line change @@ -57,6 +57,34 @@ struct ExtraInstrArgs
5757 IrIndex type;
5858}
5959
60+ struct IrLabel
61+ {
62+ // / If isAllocated
63+ // / blockIndex points to new block
64+ // / else
65+ // / If numPredecessors == 0, blockIndex points to currentBlock at
66+ // scope start
67+ // / If numPredecessors == 1, blockIndex points to first predecessor
68+ // / If numPredecessors > 1, blockIndex points to a new block and isAllocated must be true
69+ IrIndex blockIndex;
70+ // /
71+ bool isAllocated;
72+ // /
73+ uint numPredecessors;
74+ }
75+
76+ struct BlockVarPair
77+ {
78+ IrIndex blockId;
79+ IrIndex var;
80+
81+ void toString ()(scope void delegate (const (char )[]) sink) const {
82+ import std.format : formattedWrite;
83+ sink.formattedWrite(" (%s %s)" , blockId, var);
84+ }
85+ }
86+
87+
6088// papers:
6189// 1. Simple and Efficient Construction of Static Single Assignment Form
6290struct IrBuilder
@@ -808,9 +836,6 @@ struct IrBuilder
808836 label.numPredecessors += newPredecessors;
809837 }
810838
811- private void incBlockRefcount (IrIndex basicBlock) { assert (false ); }
812- private void decBlockRefcount (IrIndex basicBlock) { assert (false ); }
813-
814839 // / Creates virtual register to represent result of phi/instruction
815840 // / `definition` is phi/instruction that produces a value
816841 IrIndex addVirtualRegister (IrIndex definition, IrIndex type)
Original file line number Diff line number Diff line change @@ -29,33 +29,3 @@ public import vox.ir.ir_value_kind;
2929public import vox.ir.ir_variable;
3030public import vox.ir.ir_virt_reg;
3131public import vox.ir.ir_vm;
32-
33- import vox.all;
34-
35-
36- struct IrLabel
37- {
38- // / If isAllocated
39- // / blockIndex points to new block
40- // / else
41- // / If numPredecessors == 0, blockIndex points to currentBlock at
42- // scope start
43- // / If numPredecessors == 1, blockIndex points to first predecessor
44- // / If numPredecessors > 1, blockIndex points to a new block and isAllocated must be true
45- IrIndex blockIndex;
46- // /
47- bool isAllocated;
48- // /
49- uint numPredecessors;
50- }
51-
52- struct BlockVarPair
53- {
54- IrIndex blockId;
55- IrIndex var;
56-
57- void toString ()(scope void delegate (const (char )[]) sink) const {
58- import std.format : formattedWrite;
59- sink.formattedWrite(" (%s %s)" , blockId, var);
60- }
61- }
Original file line number Diff line number Diff line change 195195 - ref parameters
196196 - ref in foreach
197197 - this is ref in methods (it is ptr atm)
198+ + enum
199+ - enum with bigger than i32 values doesn't compile
200+ - autoincrementing enum member values
201+ - enum type
202+ - Decide if enums should implicitly convert to bool. There are cases where you don't want that
198203
199204- context format/writefln
200205+ pipeline ordering (run all passes per function) will allow to release temporary memory (worse perf if no memory is released)
@@ -225,10 +230,6 @@ o dll linking
225230 cons: simple passing allows all module externals to be searched for in passed .dll/.def
226231 pros: --optname=modulename:.dll/.def allows for benefit of above options
227232 - custom .def-like format (binary, combine all libs description in a single file)
228- + enum
229- - enum with bigger than i32 values doesn't compile
230- - autoincrementing enum member values
231- - enum type
232233- constant folding << >> >>> shifts needs to know type of left operand to mask the shift size
233234- Check that constants on either side of every instruction is correctly lowered to mov/load when needed
234235
You can’t perform that action at this time.
0 commit comments