Skip to content
← Back

src/ir/runtime_operation.ghul

1
namespace IR is
2
// What a program needs from the runtime it runs on rather than from
3
// the language. Each backend maps these to members of its own
4
// runtime.
5
enum RuntimeOperation is
6
// (string, string) -> string
7
CONCAT_STRINGS,
8
9
// (string, string) -> bool, comparing content
10
STRINGS_EQUAL,
11
12
// (message) -> the exception a body-less override throws
13
NEW_NOT_IMPLEMENTED,
14
15
// () -> the exception a member with no support throws
16
NEW_NOT_SUPPORTED,
17
18
// (message) -> the exception a failed assertion throws
19
NEW_ASSERT_FAILED,
20
21
// (instance) -> nothing: runs the root constructor on an
22
// instance being constructed
23
INIT_OBJECT,
24
25
// () -> int, the id of the thread the code is running on
26
CURRENT_THREAD_ID,
27
28
// (pipe) -> string, the pipe's elements rendered as a string;
29
// the operation's type argument is the element type
30
JOIN_PIPE,
31
32
// (from, to) -> a range; the operation's type is the range type
33
NEW_RANGE,
34
35
// A string builder accumulates the text of a string
36
// interpolation or a join. Its operations take a load of the
37
// builder first.
38
39
// (literal length, value count) -> a builder; the counts are
40
// sizing hints, and the operation's type is the builder's type
41
NEW_STRING_BUILDER,
42
43
// (builder, string) -> nothing
44
APPEND_TEXT,
45
46
// (builder, value) -> nothing; the operation's type argument is
47
// the value's type
48
APPEND_VALUE,
49
50
// (builder, value, alignment) -> nothing
51
APPEND_ALIGNED_VALUE,
52
53
// (builder, value, format) -> nothing
54
APPEND_FORMATTED_VALUE,
55
56
// (builder, value, alignment, format) -> nothing
57
APPEND_ALIGNED_FORMATTED_VALUE,
58
59
// (builder) -> the string built
60
BUILD_STRING
61
si
62
si