global STR0/STR1 definitions

This commit is contained in:
dzaima 2023-08-19 19:56:49 +03:00
parent 721dccf636
commit 2732becf50
4 changed files with 6 additions and 12 deletions

View File

@ -1718,11 +1718,7 @@ static B getPlatformNS(void) {
#elif __arm__ #elif __arm__
char* arch = "aarch32"; char* arch = "aarch32";
#elif __riscv #elif __riscv
#define F(X) #X char* arch = "riscv" STR1(__riscv_xlen);
#define F2(X) F(X)
char* arch = "riscv" F2(__riscv_xlen);
#undef F2
#undef F
#else #else
char* arch = "unknown"; char* arch = "unknown";
#endif #endif

View File

@ -170,6 +170,8 @@ typedef size_t ux;
#define JOIN0(A,B) A##B #define JOIN0(A,B) A##B
#define JOIN(A,B) JOIN0(A,B) #define JOIN(A,B) JOIN0(A,B)
#define STR0(X) #X
#define STR1(X) STR0(X)
#if USE_REPLXX_IO #if USE_REPLXX_IO
#include <replxx.h> #include <replxx.h>

View File

@ -4,9 +4,7 @@
#include "ns.h" #include "ns.h"
#include "builtins.h" #include "builtins.h"
#define PRECOMPILED_FILE0(X) #X #define PRECOMPILED_FILE(END) STR1(../build/BYTECODE_DIR/gen/END)
#define PRECOMPILED_FILE1(X) PRECOMPILED_FILE0(X)
#define PRECOMPILED_FILE(END) PRECOMPILED_FILE1(../build/BYTECODE_DIR/gen/END)
#define FOR_INIT(F) \ #define FOR_INIT(F) \
/* initialize primary things */ F(base) F(harr) F(mutF) F(cmpA) F(fillarr) F(tyarr) F(hash) F(sfns) F(fns) F(arithm) F(arithd) F(md1) F(md2) F(derv) F(comp) F(rtWrap) F(ns) F(nfn) F(sysfn) F(inverse) F(slash) F(search) F(transp) F(ryu) F(ffi) F(mmap) \ /* initialize primary things */ F(base) F(harr) F(mutF) F(cmpA) F(fillarr) F(tyarr) F(hash) F(sfns) F(fns) F(arithm) F(arithd) F(md1) F(md2) F(derv) F(comp) F(rtWrap) F(ns) F(nfn) F(sysfn) F(inverse) F(slash) F(search) F(transp) F(ryu) F(ffi) F(mmap) \

View File

@ -5,8 +5,6 @@
#define al BN(al) #define al BN(al)
#define alCap BN(alCap) #define alCap BN(alCap)
#define alSize BN(alSize) #define alSize BN(alSize)
#define str0(X) #X
#define str1(X) str0(X)
typedef struct AllocInfo { typedef struct AllocInfo {
Value* p; Value* p;
@ -63,7 +61,7 @@ static NOINLINE void* BN(allocateMore)(i64 bucket, u8 type, i64 from, i64 to) {
} }
#if LOG_GC || LOG_MM_MORE #if LOG_GC || LOG_MM_MORE
fprintf(stderr, "allocating "N64u" more " str1(BN()) " heap (from allocation of "N64u"B/bucket %d)", sz, (u64)BSZ(bucket), (int)bucket); fprintf(stderr, "allocating "N64u" more " STR1(BN()) " heap (from allocation of "N64u"B/bucket %d)", sz, (u64)BSZ(bucket), (int)bucket);
#endif #endif
#if NO_MMAP #if NO_MMAP
EmptyValue* c = calloc(sz+getPageSize(), 1); EmptyValue* c = calloc(sz+getPageSize(), 1);
@ -197,7 +195,7 @@ void BN(dumpHeap)(FILE* f) {
u64 addrI = ptr2u64(ci.p); u64 addrI = ptr2u64(ci.p);
writeNum(f, ci.sz, 8); writeNum(f, ci.sz, 8);
writeNum(f, addrI, 8); writeNum(f, addrI, 8);
char* prefix = str1(BN()); char* prefix = STR1(BN());
fwrite(prefix, 1, strlen(prefix)+1, f); fwrite(prefix, 1, strlen(prefix)+1, f);
fwrite(ci.p, 1, ci.sz, f); fwrite(ci.p, 1, ci.sz, f);
} }