-
Notifications
You must be signed in to change notification settings - Fork 51
Expand file tree
/
Copy pathExtension.v3
More file actions
58 lines (57 loc) · 2.08 KB
/
Extension.v3
File metadata and controls
58 lines (57 loc) · 2.08 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// 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"),
LEGACY_EH("legacy-eh", "Non-standard legacy exception handling"),
MEMORY64("memory64", "64-bit memories"),
REPEAT_SECTIONS("repeat-sections", "Repeated sections and relaxed order"),
STACK_SWITCHING("stack-switching", "Stack switching"),
CUSTOM_PAGE_SIZES("custom-page-sizes", "Custom page sizes"),
EXTENDED_CONST("extended-const", "Extended constant expressions"),
RELAXED_SIMD("relaxed-simd", "Relaxed SIMD"),
WASM_3_0("wasm-3.0", "All Wasm 3.0 features"),
WIZENG("wizeng", "Wizard-specific engine capabilities"),
}
component Extensions {
def getDefaults() -> Extension.set {
return setImplications(Extension.WASM_3_0);
}
def setImplications(set: Extension.set) -> Extension.set {
if (set.WASM_3_0) {
set |= Extension.MULTI_MEMORY;
set |= Extension.TAIL_CALL;
set |= Extension.FUNCTION_REFERENCES;
set |= Extension.GC;
set |= Extension.EXCEPTION_HANDLING;
set |= Extension.EXTENDED_CONST;
set |= Extension.RELAXED_SIMD;
set |= Extension.MEMORY64;
}
if (set.STACK_SWITCHING) {
set |= Extension.GC;
set |= Extension.EXCEPTION_HANDLING;
}
if (set.MEMORY64) {
set |= Extension.MULTI_MEMORY;
set |= Extension.EXTENDED_CONST;
set |= Extension.GC;
set |= Extension.EXCEPTION_HANDLING;
}
if (set.CUSTOM_PAGE_SIZES) {
set |= Extension.MULTI_MEMORY;
set |= Extension.MEMORY64;
set |= Extension.EXCEPTION_HANDLING;
set |= Extension.EXTENDED_CONST;
}
if (set.GC) set |= Extension.FUNCTION_REFERENCES;
if (set.FUNCTION_REFERENCES) set |= Extension.TAIL_CALL;
if (set.EXCEPTION_HANDLING) set |= Extension.TAIL_CALL;
return set;
}
}