|
15 | 15 | #define OP_F(x, y) OP(x, y) |
16 | 16 | #endif |
17 | 17 |
|
18 | | -#if VM_MATH_SWITCH |
19 | 18 | #define LABEL(X, Y) case COMBINE(X, Y):; |
20 | | -#else |
21 | | -#define LABEL(X, Y) LABEL(X, Y):; |
22 | | -#endif |
23 | 19 |
|
24 | 20 | #define COMBINE(x, y) ((x)*VM_TAG_MAX + (y)) |
25 | 21 |
|
26 | | -#if !VM_MATH_SWITCH |
27 | | -static void *binop_table[COMBINE(VM_TAG_MAX, VM_TAG_MAX)] = { |
28 | | - [COMBINE(VM_TAG_I8, VM_TAG_I8)] = &&LABEL(VM_TAG_I8, VM_TAG_I8), |
29 | | - [COMBINE(VM_TAG_I8, VM_TAG_I16)] = &&LABEL(VM_TAG_I8, VM_TAG_I16), |
30 | | - [COMBINE(VM_TAG_I8, VM_TAG_I32)] = &&LABEL(VM_TAG_I8, VM_TAG_I32), |
31 | | - [COMBINE(VM_TAG_I8, VM_TAG_I64)] = &&LABEL(VM_TAG_I8, VM_TAG_I64), |
32 | | - [COMBINE(VM_TAG_I8, VM_TAG_F32)] = &&LABEL(VM_TAG_I8, VM_TAG_F32), |
33 | | - [COMBINE(VM_TAG_I8, VM_TAG_F64)] = &&LABEL(VM_TAG_I8, VM_TAG_F64), |
34 | | - |
35 | | - [COMBINE(VM_TAG_I16, VM_TAG_I8)] = &&LABEL(VM_TAG_I16, VM_TAG_I8), |
36 | | - [COMBINE(VM_TAG_I16, VM_TAG_I16)] = &&LABEL(VM_TAG_I16, VM_TAG_I16), |
37 | | - [COMBINE(VM_TAG_I16, VM_TAG_I32)] = &&LABEL(VM_TAG_I16, VM_TAG_I32), |
38 | | - [COMBINE(VM_TAG_I16, VM_TAG_I64)] = &&LABEL(VM_TAG_I16, VM_TAG_I64), |
39 | | - [COMBINE(VM_TAG_I16, VM_TAG_F32)] = &&LABEL(VM_TAG_I16, VM_TAG_F32), |
40 | | - [COMBINE(VM_TAG_I16, VM_TAG_F64)] = &&LABEL(VM_TAG_I16, VM_TAG_F64), |
41 | | - |
42 | | - [COMBINE(VM_TAG_I32, VM_TAG_I8)] = &&LABEL(VM_TAG_I32, VM_TAG_I8), |
43 | | - [COMBINE(VM_TAG_I32, VM_TAG_I16)] = &&LABEL(VM_TAG_I32, VM_TAG_I16), |
44 | | - [COMBINE(VM_TAG_I32, VM_TAG_I32)] = &&LABEL(VM_TAG_I32, VM_TAG_I32), |
45 | | - [COMBINE(VM_TAG_I32, VM_TAG_I64)] = &&LABEL(VM_TAG_I32, VM_TAG_I64), |
46 | | - [COMBINE(VM_TAG_I32, VM_TAG_F32)] = &&LABEL(VM_TAG_I32, VM_TAG_F32), |
47 | | - [COMBINE(VM_TAG_I32, VM_TAG_F64)] = &&LABEL(VM_TAG_I32, VM_TAG_F64), |
48 | | - |
49 | | - [COMBINE(VM_TAG_I64, VM_TAG_I8)] = &&LABEL(VM_TAG_I64, VM_TAG_I8), |
50 | | - [COMBINE(VM_TAG_I64, VM_TAG_I16)] = &&LABEL(VM_TAG_I64, VM_TAG_I16), |
51 | | - [COMBINE(VM_TAG_I64, VM_TAG_I32)] = &&LABEL(VM_TAG_I64, VM_TAG_I32), |
52 | | - [COMBINE(VM_TAG_I64, VM_TAG_I64)] = &&LABEL(VM_TAG_I64, VM_TAG_I64), |
53 | | - [COMBINE(VM_TAG_I64, VM_TAG_F32)] = &&LABEL(VM_TAG_I64, VM_TAG_F32), |
54 | | - [COMBINE(VM_TAG_I64, VM_TAG_F64)] = &&LABEL(VM_TAG_I64, VM_TAG_F64), |
55 | | - |
56 | | - [COMBINE(VM_TAG_F32, VM_TAG_I8)] = &&LABEL(VM_TAG_F32, VM_TAG_I8), |
57 | | - [COMBINE(VM_TAG_F32, VM_TAG_I16)] = &&LABEL(VM_TAG_F32, VM_TAG_I16), |
58 | | - [COMBINE(VM_TAG_F32, VM_TAG_I32)] = &&LABEL(VM_TAG_F32, VM_TAG_I32), |
59 | | - [COMBINE(VM_TAG_F32, VM_TAG_I64)] = &&LABEL(VM_TAG_F32, VM_TAG_I64), |
60 | | - [COMBINE(VM_TAG_F32, VM_TAG_F32)] = &&LABEL(VM_TAG_F32, VM_TAG_F32), |
61 | | - [COMBINE(VM_TAG_F32, VM_TAG_F64)] = &&LABEL(VM_TAG_F32, VM_TAG_F64), |
62 | | - |
63 | | - [COMBINE(VM_TAG_F64, VM_TAG_I8)] = &&LABEL(VM_TAG_F64, VM_TAG_I8), |
64 | | - [COMBINE(VM_TAG_F64, VM_TAG_I16)] = &&LABEL(VM_TAG_F64, VM_TAG_I16), |
65 | | - [COMBINE(VM_TAG_F64, VM_TAG_I32)] = &&LABEL(VM_TAG_F64, VM_TAG_I32), |
66 | | - [COMBINE(VM_TAG_F64, VM_TAG_I64)] = &&LABEL(VM_TAG_F64, VM_TAG_I64), |
67 | | - [COMBINE(VM_TAG_F64, VM_TAG_F32)] = &&LABEL(VM_TAG_F64, VM_TAG_F32), |
68 | | - [COMBINE(VM_TAG_F64, VM_TAG_F64)] = &&LABEL(VM_TAG_F64, VM_TAG_F64), |
69 | | -}; |
70 | | -#endif |
71 | | - |
72 | | -#if VM_MATH_SWITCH |
73 | 22 | switch (COMBINE(v1.tag, v2.tag)) { |
74 | 23 | default: { |
75 | 24 | __builtin_trap(); |
76 | 25 | } |
77 | | -#else |
78 | | -goto *binop_table[COMBINE(v1.tag, v2.tag)]; |
79 | | -#endif |
| 26 | +LABEL(VM_TAG_TAB, VM_TAG_NIL) |
| 27 | +LABEL(VM_TAG_TAB, VM_TAG_BOOL) |
| 28 | +LABEL(VM_TAG_TAB, VM_TAG_I8) |
| 29 | +LABEL(VM_TAG_TAB, VM_TAG_I16) |
| 30 | +LABEL(VM_TAG_TAB, VM_TAG_I32) |
| 31 | +LABEL(VM_TAG_TAB, VM_TAG_I64) |
| 32 | +LABEL(VM_TAG_TAB, VM_TAG_F32) |
| 33 | +LABEL(VM_TAG_TAB, VM_TAG_F64) |
| 34 | +LABEL(VM_TAG_TAB, VM_TAG_STR) |
| 35 | +LABEL(VM_TAG_TAB, VM_TAG_CLOSURE) |
| 36 | +LABEL(VM_TAG_TAB, VM_TAG_FUN) |
| 37 | +LABEL(VM_TAG_TAB, VM_TAG_TAB) |
| 38 | +LABEL(VM_TAG_TAB, VM_TAG_FFI) |
| 39 | +{ |
| 40 | + __builtin_trap(); |
| 41 | +} |
80 | 42 | LABEL(VM_TAG_I8, VM_TAG_I8) { |
81 | 43 | WRITE (vm_std_value_t) { |
82 | 44 | .tag = VM_TAG_I8, |
@@ -329,9 +291,7 @@ LABEL(VM_TAG_F64, VM_TAG_F64) { |
329 | 291 | }; |
330 | 292 | goto CONCAT(NAME, END); |
331 | 293 | } |
332 | | -#if VM_MATH_SWITCH |
333 | 294 | } |
334 | | -#endif |
335 | 295 | CONCAT(NAME, END):; |
336 | 296 |
|
337 | 297 | #undef COMBINE |
|
0 commit comments