forked from titzer/wizard-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExtension.v3
28 lines (27 loc) · 1.11 KB
/
Extension.v3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
// Copyright 2019 Ben L. Titzer. All rights reserved.
// See LICENSE for details of Apache 2.0 license.
// Extensions that enable various features of the engine.
enum Extension(short_name: string, help: string) {
TAIL_CALL("tail-call", "Tail calls"),
MULTI_MEMORY("multi-memory", "Multiple memories"),
FUNCTION_REFERENCES("function-references", "Typed function references"),
ATOMICS("threads", "Atomic operations"),
GC("gc", "Garbage collection"),
EXCEPTION_HANDLING("exception-handling", "Exception handling"),
MEMORY64("memory64", "64-bit memories"),
REPEAT_SECTIONS("repeat-sections", "Repeated sections and relaxed order"),
STACK_SWITCHING("stack-switching", "Stack switching"),
WIZENG("wizeng", "Wizard-specific engine capabilities"),
}
component Extensions {
def setImplications(set: Extension.set) -> Extension.set {
if (set.GC) set |= Extension.FUNCTION_REFERENCES;
if (set.FUNCTION_REFERENCES) set |= Extension.TAIL_CALL;
if (set.EXCEPTION_HANDLING) set |= Extension.TAIL_CALL;
if (set.STACK_SWITCHING) {
set |= Extension.FUNCTION_REFERENCES;
set |= Extension.EXCEPTION_HANDLING;
}
return set;
}
}