Skip to content

Commit 95e999c

Browse files
committed
Small doc fixes. Move IrLabel and BlockVarPair into ir_builder.d
1 parent fefcf87 commit 95e999c

File tree

6 files changed

+41
-42
lines changed

6 files changed

+41
-42
lines changed

example/libvox.d

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
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
46
module libvox;
57

68
// SliceString that are passed to Vox compiler must remain valid until vox_free

readme.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
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

224225
For more in detail description of implementation see [internals.md](internals.md)

source/c_api.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff 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

source/vox/ir/ir_builder.d

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff 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
6290
struct 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)

source/vox/ir/package.d

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -29,33 +29,3 @@ public import vox.ir.ir_value_kind;
2929
public import vox.ir.ir_variable;
3030
public import vox.ir.ir_virt_reg;
3131
public 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-
}

todo.txt

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,11 @@
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

0 commit comments

Comments
 (0)