diff --git a/c_runtime/bosatsu_generated.h b/c_runtime/bosatsu_generated.h index 30d0e2bdf..c496bb538 100644 --- a/c_runtime/bosatsu_generated.h +++ b/c_runtime/bosatsu_generated.h @@ -1560,7 +1560,7 @@ BValue call_fn1(BValue fn, BValue arg0) { BPureFn1 pure = (BPureFn1)PURE_VALUE(fn); return pure(arg0); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn1* purefn = (BoxedPureFn1*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0); @@ -1605,7 +1605,7 @@ BValue call_fn2(BValue fn, BValue arg0, BValue arg1) { BPureFn2 pure = (BPureFn2)PURE_VALUE(fn); return pure(arg0, arg1); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn2* purefn = (BoxedPureFn2*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1); @@ -1650,7 +1650,7 @@ BValue call_fn3(BValue fn, BValue arg0, BValue arg1, BValue arg2) { BPureFn3 pure = (BPureFn3)PURE_VALUE(fn); return pure(arg0, arg1, arg2); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn3* purefn = (BoxedPureFn3*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2); @@ -1695,7 +1695,7 @@ BValue call_fn4(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3) { BPureFn4 pure = (BPureFn4)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn4* purefn = (BoxedPureFn4*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3); @@ -1740,7 +1740,7 @@ BValue call_fn5(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, B BPureFn5 pure = (BPureFn5)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn5* purefn = (BoxedPureFn5*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4); @@ -1785,7 +1785,7 @@ BValue call_fn6(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, B BPureFn6 pure = (BPureFn6)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn6* purefn = (BoxedPureFn6*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5); @@ -1830,7 +1830,7 @@ BValue call_fn7(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, B BPureFn7 pure = (BPureFn7)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn7* purefn = (BoxedPureFn7*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6); @@ -1875,7 +1875,7 @@ BValue call_fn8(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, B BPureFn8 pure = (BPureFn8)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn8* purefn = (BoxedPureFn8*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7); @@ -1920,7 +1920,7 @@ BValue call_fn9(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, B BPureFn9 pure = (BPureFn9)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn9* purefn = (BoxedPureFn9*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8); @@ -1965,7 +1965,7 @@ BValue call_fn10(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn10 pure = (BPureFn10)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn10* purefn = (BoxedPureFn10*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9); @@ -2010,7 +2010,7 @@ BValue call_fn11(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn11 pure = (BPureFn11)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn11* purefn = (BoxedPureFn11*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10); @@ -2055,7 +2055,7 @@ BValue call_fn12(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn12 pure = (BPureFn12)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn12* purefn = (BoxedPureFn12*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11); @@ -2100,7 +2100,7 @@ BValue call_fn13(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn13 pure = (BPureFn13)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn13* purefn = (BoxedPureFn13*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12); @@ -2145,7 +2145,7 @@ BValue call_fn14(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn14 pure = (BPureFn14)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn14* purefn = (BoxedPureFn14*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13); @@ -2190,7 +2190,7 @@ BValue call_fn15(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn15 pure = (BPureFn15)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn15* purefn = (BoxedPureFn15*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14); @@ -2235,7 +2235,7 @@ BValue call_fn16(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn16 pure = (BPureFn16)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn16* purefn = (BoxedPureFn16*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15); @@ -2280,7 +2280,7 @@ BValue call_fn17(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn17 pure = (BPureFn17)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn17* purefn = (BoxedPureFn17*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16); @@ -2325,7 +2325,7 @@ BValue call_fn18(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn18 pure = (BPureFn18)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn18* purefn = (BoxedPureFn18*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17); @@ -2370,7 +2370,7 @@ BValue call_fn19(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn19 pure = (BPureFn19)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn19* purefn = (BoxedPureFn19*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18); @@ -2415,7 +2415,7 @@ BValue call_fn20(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn20 pure = (BPureFn20)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn20* purefn = (BoxedPureFn20*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19); @@ -2460,7 +2460,7 @@ BValue call_fn21(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn21 pure = (BPureFn21)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn21* purefn = (BoxedPureFn21*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20); @@ -2505,7 +2505,7 @@ BValue call_fn22(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn22 pure = (BPureFn22)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn22* purefn = (BoxedPureFn22*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21); @@ -2550,7 +2550,7 @@ BValue call_fn23(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn23 pure = (BPureFn23)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn23* purefn = (BoxedPureFn23*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22); @@ -2595,7 +2595,7 @@ BValue call_fn24(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn24 pure = (BPureFn24)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn24* purefn = (BoxedPureFn24*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23); @@ -2640,7 +2640,7 @@ BValue call_fn25(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn25 pure = (BPureFn25)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn25* purefn = (BoxedPureFn25*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24); @@ -2685,7 +2685,7 @@ BValue call_fn26(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn26 pure = (BPureFn26)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn26* purefn = (BoxedPureFn26*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25); @@ -2730,7 +2730,7 @@ BValue call_fn27(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn27 pure = (BPureFn27)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn27* purefn = (BoxedPureFn27*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26); @@ -2775,7 +2775,7 @@ BValue call_fn28(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn28 pure = (BPureFn28)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn28* purefn = (BoxedPureFn28*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27); @@ -2820,7 +2820,7 @@ BValue call_fn29(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn29 pure = (BPureFn29)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn29* purefn = (BoxedPureFn29*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28); @@ -2865,7 +2865,7 @@ BValue call_fn30(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn30 pure = (BPureFn30)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn30* purefn = (BoxedPureFn30*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29); @@ -2910,7 +2910,7 @@ BValue call_fn31(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn31 pure = (BPureFn31)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn31* purefn = (BoxedPureFn31*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30); @@ -2955,7 +2955,7 @@ BValue call_fn32(BValue fn, BValue arg0, BValue arg1, BValue arg2, BValue arg3, BPureFn32 pure = (BPureFn32)PURE_VALUE(fn); return pure(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30, arg31); } - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn32* purefn = (BoxedPureFn32*)ptr; if (purefn->slot_len == 0) { return purefn->fn(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20, arg21, arg22, arg23, arg24, arg25, arg26, arg27, arg28, arg29, arg30, arg31); diff --git a/c_runtime/bosatsu_runtime.c b/c_runtime/bosatsu_runtime.c index 5bf73ecae..0c31dd98a 100644 --- a/c_runtime/bosatsu_runtime.c +++ b/c_runtime/bosatsu_runtime.c @@ -44,7 +44,6 @@ or gced big integers #define TO_PURE_VALUE(v) ((BValue)((((uintptr_t)v) << 2) | PURE_VALUE_TAG)) #define PURE_VALUE(ptr) ((uintptr_t)(ptr) >> 2) #define IS_POINTER(ptr) (((uintptr_t)(ptr) & TAG_MASK) == POINTER_TAG) -#define TO_POINTER(ptr) ((uintptr_t)(ptr) & ~TAG_MASK) #define DEFINE_BSTS_OBJ(name, fields) \ struct name { \ @@ -106,7 +105,7 @@ typedef struct { // Helper macros and functions #define IS_SMALL(v) IS_PURE_VALUE(v) #define GET_SMALL_INT(v) (int32_t)(PURE_VALUE(v)) -#define GET_BIG_INT(v) ((BSTS_Integer*)(TO_POINTER(v))) +#define GET_BIG_INT(v) ((BSTS_Integer*)(v)) void bsts_load_op_from_small(int32_t value, uint32_t* words, BSTS_Int_Operand* op) { op->sign = value < 0; @@ -197,7 +196,7 @@ void init_statics() { } BValue get_struct_index(BValue v, int idx) { - uintptr_t rc = TO_POINTER(v); + uintptr_t rc = (uintptr_t)(v); BValue* ptr = (BValue*)(rc + sizeof(BSTS_OBJ) + idx * sizeof(BValue)); return *ptr; } @@ -207,13 +206,17 @@ ENUM_TAG get_variant(BValue v) { return (ENUM_TAG)PURE_VALUE(v); } else { - Enum0* real_v = (Enum0*)TO_POINTER(v); + Enum0* real_v = (Enum0*)(v); return real_v->tag; } } +ENUM_TAG get_variant_value(BValue v) { + return (ENUM_TAG)PURE_VALUE(v); +} + BValue get_enum_index(BValue v, int idx) { - uintptr_t rc = TO_POINTER(v); + uintptr_t rc = (uintptr_t)(v); BValue* ptr = (BValue*)(rc + sizeof(Enum0) + idx * sizeof(BValue)); return *ptr; } @@ -237,7 +240,7 @@ BValue alloc_external(void* data, FreeFn free) { void* get_external(BValue v) { // Externals can be static also, top level external values - External* ext = (External*)TO_POINTER(v); + External* ext = (External*)(v); return ext->external; } @@ -299,7 +302,7 @@ int bsts_string_code_point_to_utf8(int code_point, char* output) { return -1; } -#define GET_STRING(v) (BSTS_String*)(TO_POINTER(v)) +#define GET_STRING(v) (BSTS_String*)(v) _Bool bsts_string_equals(BValue left, BValue right) { if (left == right) { diff --git a/c_runtime/bosatsu_runtime.h b/c_runtime/bosatsu_runtime.h index 4e033a159..a5d5c5dca 100644 --- a/c_runtime/bosatsu_runtime.h +++ b/c_runtime/bosatsu_runtime.h @@ -29,6 +29,8 @@ BValue get_struct_index(BValue v, int idx); // &BValue -> Tag ENUM_TAG get_variant(BValue v); +// This is only safe if all enums have zero args +ENUM_TAG get_variant_value(BValue v); // (&BValue, int) -> &BValue BValue get_enum_index(BValue v, int idx); diff --git a/c_runtime/typegen.py b/c_runtime/typegen.py index 3cc48f18c..fb0772a76 100644 --- a/c_runtime/typegen.py +++ b/c_runtime/typegen.py @@ -83,7 +83,7 @@ def function_impl(size): BPureFn{size} pure = (BPureFn{size})PURE_VALUE(fn); return pure({just_args}); }} - BValue ptr = (BValue)TO_POINTER(fn); + BValue ptr = (BValue)(fn); BoxedPureFn{size}* purefn = (BoxedPureFn{size}*)ptr; if (purefn->slot_len == 0) {{ return purefn->fn({just_args}); diff --git a/core/src/main/scala/org/bykn/bosatsu/codegen/clang/ClangGen.scala b/core/src/main/scala/org/bykn/bosatsu/codegen/clang/ClangGen.scala index 0780df6b1..8837ffb7e 100644 --- a/core/src/main/scala/org/bykn/bosatsu/codegen/clang/ClangGen.scala +++ b/core/src/main/scala/org/bykn/bosatsu/codegen/clang/ClangGen.scala @@ -358,10 +358,10 @@ object ClangGen { (boolToValue(e1), boolToValue(e2)) .flatMapN { (a, b) => andCode(a, b) } - case CheckVariant(expr, expect, _, _) => + case CheckVariant(expr, expect, _, famArities) => innerToValue(expr).flatMap { vl => - // this is just get_variant(expr) == expect - vl.onExpr { expr => pv(Code.Ident("get_variant")(expr) =:= Code.IntLiteral(expect)) }(newLocalName) + val fn = if (famArities.forall(_ == 0)) "get_variant_value" else "get_variant" + vl.onExpr { expr => pv(Code.Ident(fn)(expr) =:= Code.IntLiteral(expect)) }(newLocalName) } case MatchString(arg, parts, binds, mustMatch) => (