diff --git a/src/builtins/arithm.c b/src/builtins/arithm.c index 39d551f6..fdce468e 100644 --- a/src/builtins/arithm.c +++ b/src/builtins/arithm.c @@ -163,7 +163,7 @@ B eq_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(0); } B r = m_i32(RNK( B ne_c1(B t, B x) { if (isAtm(x)) { decA(x); return m_i32(1); } B r = m_f64(*SH(x)); decG(x); return r; } -static GLOBAL B mathNS; +STATIC_GLOBAL B mathNS; B getMathNS(void) { if (mathNS.u == 0) { #define F(X) incG(bi_##X), diff --git a/src/builtins/fns.c b/src/builtins/fns.c index 56b1e9d3..f2159b84 100644 --- a/src/builtins/fns.c +++ b/src/builtins/fns.c @@ -303,7 +303,7 @@ B find_c2(B t, B w, B x) { decG(x); decG(w); return r; } -static GLOBAL H_b2i* globalNames; +STATIC_GLOBAL H_b2i* globalNames; GLOBAL B globalNameList; i32 str2gid(B s) { if (globalNames==NULL) { diff --git a/src/builtins/internal.c b/src/builtins/internal.c index 5d3987ce..655061a9 100644 --- a/src/builtins/internal.c +++ b/src/builtins/internal.c @@ -79,10 +79,10 @@ B info_c1(B t, B x) { F(Af) F(Sf) F(AfInc) F(SfInc) \ F(Ab) F(AbInc) -#define F(X) static GLOBAL B v_##X; +#define F(X) STATIC_GLOBAL B v_##X; FOR_VARIATION(F) #undef F -static GLOBAL B listVariations_def; +STATIC_GLOBAL B listVariations_def; B listVariations_c2(B t, B w, B x) { if (!isArr(x)) thrM("•internal.ListVariations: 𝕩 must be an array"); @@ -162,7 +162,7 @@ static bool u8_get(u8** cv, u8* cE, const char* x) { } -static GLOBAL B variation_refs; +STATIC_GLOBAL B variation_refs; B variation_c2(B t, B w, B x) { if (!isArr(w)) thrM("•internal.Variation: Non-array 𝕨"); if (!isArr(x)) thrM("•internal.Variation: Non-array 𝕩"); @@ -380,7 +380,7 @@ B unshare_c1(B t, B x) { dec(x); return r; } -static GLOBAL B internalNS; +STATIC_GLOBAL B internalNS; B getInternalNS(void) { if (internalNS.u == 0) { #define F(X) v_##X = m_c8vec_0(#X); diff --git a/src/builtins/inverse.c b/src/builtins/inverse.c index cb560ff2..0ffb0712 100644 --- a/src/builtins/inverse.c +++ b/src/builtins/inverse.c @@ -3,8 +3,8 @@ #include "../nfns.h" -static GLOBAL NFnDesc* fn_invRegDesc; -static GLOBAL NFnDesc* fn_invSwapDesc; +STATIC_GLOBAL NFnDesc* fn_invRegDesc; +STATIC_GLOBAL NFnDesc* fn_invSwapDesc; B fn_invReg_c1 (B t, B x) { B f = nfn_objU(t); return TI(f, fn_im)(f, x); } B fn_invReg_c2 (B t, B w, B x) { B f = nfn_objU(t); return TI(f, fn_ix)(f, w, x); } B fn_invSwap_c1(B t, B x) { B f = nfn_objU(t); return TI(f, fn_is)(f, x); } diff --git a/src/builtins/sysfn.c b/src/builtins/sysfn.c index c2b3ec94..f998b722 100644 --- a/src/builtins/sysfn.c +++ b/src/builtins/sysfn.c @@ -323,10 +323,10 @@ B hash_c1(B t, B x) { -static GLOBAL Body* rand_ns; -static GLOBAL B rand_rangeName; static GLOBAL NFnDesc* rand_rangeDesc; -static GLOBAL B rand_dealName; static GLOBAL NFnDesc* rand_dealDesc; -static GLOBAL B rand_subsetName; static GLOBAL NFnDesc* rand_subsetDesc; +STATIC_GLOBAL Body* rand_ns; +STATIC_GLOBAL B rand_rangeName; STATIC_GLOBAL NFnDesc* rand_rangeDesc; +STATIC_GLOBAL B rand_dealName; STATIC_GLOBAL NFnDesc* rand_dealDesc; +STATIC_GLOBAL B rand_subsetName; STATIC_GLOBAL NFnDesc* rand_subsetDesc; #define RAND_START Scope* sc = c(NS,nfn_objU(t))->sc; \ u64 seed = sc->vars[0].u | sc->vars[1].u<<32; #define RAND_END sc->vars[0].u = seed>>32; \ @@ -649,7 +649,7 @@ B makeRand_c1(B t, B x) { for (i32 i = 2; i < 5; i++) nfn_swapObj(sc->vars[i], incG(r)); return r; } -static GLOBAL B randNS; +STATIC_GLOBAL B randNS; B getRandNS(void) { if (randNS.u == 0) { #if RANDSEED==0 @@ -661,9 +661,9 @@ B getRandNS(void) { } return incG(randNS); } -static GLOBAL NFnDesc* bqnDesc; -static GLOBAL NFnDesc* rebqnDesc; -static GLOBAL NFnDesc* rebqnResDesc; +STATIC_GLOBAL NFnDesc* bqnDesc; +STATIC_GLOBAL NFnDesc* rebqnDesc; +STATIC_GLOBAL NFnDesc* rebqnResDesc; B rebqn_c1(B t, B x) { if (!isNsp(x)) thrM("•ReBQN: Argument must be a namespace"); B repl = ns_getC(x, "repl"); @@ -707,14 +707,14 @@ B currentError_c1(B t, B x) { B currentError_c1(B t, B x) { thrM("•CurrentError: No errors as error catching has been disabled"); } #endif -static GLOBAL Body* hashmap_ns; -static GLOBAL NFnDesc* hashmap_getDesc; -static GLOBAL NFnDesc* hashmap_hasDesc; -static GLOBAL NFnDesc* hashmap_setDesc; -static GLOBAL NFnDesc* hashmap_deleteDesc; -static GLOBAL NFnDesc* hashmap_countDesc; -static GLOBAL NFnDesc* hashmap_keysDesc; -static GLOBAL NFnDesc* hashmap_valuesDesc; +STATIC_GLOBAL Body* hashmap_ns; +STATIC_GLOBAL NFnDesc* hashmap_getDesc; +STATIC_GLOBAL NFnDesc* hashmap_hasDesc; +STATIC_GLOBAL NFnDesc* hashmap_setDesc; +STATIC_GLOBAL NFnDesc* hashmap_deleteDesc; +STATIC_GLOBAL NFnDesc* hashmap_countDesc; +STATIC_GLOBAL NFnDesc* hashmap_keysDesc; +STATIC_GLOBAL NFnDesc* hashmap_valuesDesc; // Hash object handling defined in search.c extern B hashmap_build(B keys, usz n); extern B hashmap_lookup(B* vars, B w, B x); @@ -761,7 +761,7 @@ B hashMap_c2(B t, B w, B x) { return ns; } -static GLOBAL NFnDesc* fileAtDesc; +STATIC_GLOBAL NFnDesc* fileAtDesc; B fileAt_c1(B d, B x) { return path_rel(nfn_objU(d), x, "•file.At"); } @@ -771,7 +771,7 @@ B fileAt_c2(B d, B w, B x) { dec(w); return r; } -static GLOBAL NFnDesc* fCharsDesc; +STATIC_GLOBAL NFnDesc* fCharsDesc; B fchars_c1(B d, B x) { return path_chars(path_rel(nfn_objU(d), x, "•file.Chars")); } @@ -782,7 +782,7 @@ B fchars_c2(B d, B w, B x) { dec(x); return p; } -static GLOBAL NFnDesc* fBytesDesc; +STATIC_GLOBAL NFnDesc* fBytesDesc; B fbytes_c1(B d, B x) { I8Arr* tf = path_bytes(path_rel(nfn_objU(d), x, "•file.Bytes")); usz ia = PIA(tf); @@ -798,7 +798,7 @@ B fbytes_c2(B d, B w, B x) { dec(x); return p; } -static GLOBAL NFnDesc* fLinesDesc; +STATIC_GLOBAL NFnDesc* fLinesDesc; B flines_c1(B d, B x) { return path_lines(path_rel(nfn_objU(d), x, "•file.Lines")); } @@ -820,7 +820,7 @@ B flines_c2(B d, B w, B x) { decG(s); return p; } -static GLOBAL NFnDesc* importDesc; +STATIC_GLOBAL NFnDesc* importDesc; @@ -863,18 +863,18 @@ B import_c1(B d, B x) { } -static GLOBAL NFnDesc* fTypeDesc; -static GLOBAL NFnDesc* fCreatedDesc; -static GLOBAL NFnDesc* fAccessedDesc; -static GLOBAL NFnDesc* fModifiedDesc; -static GLOBAL NFnDesc* fSizeDesc; -static GLOBAL NFnDesc* fExistsDesc; -static GLOBAL NFnDesc* fListDesc; -static GLOBAL NFnDesc* fMapBytesDesc; -static GLOBAL NFnDesc* createdirDesc; -static GLOBAL NFnDesc* realpathDesc; -static GLOBAL NFnDesc* renameDesc; -static GLOBAL NFnDesc* removeDesc; +STATIC_GLOBAL NFnDesc* fTypeDesc; +STATIC_GLOBAL NFnDesc* fCreatedDesc; +STATIC_GLOBAL NFnDesc* fAccessedDesc; +STATIC_GLOBAL NFnDesc* fModifiedDesc; +STATIC_GLOBAL NFnDesc* fSizeDesc; +STATIC_GLOBAL NFnDesc* fExistsDesc; +STATIC_GLOBAL NFnDesc* fListDesc; +STATIC_GLOBAL NFnDesc* fMapBytesDesc; +STATIC_GLOBAL NFnDesc* createdirDesc; +STATIC_GLOBAL NFnDesc* realpathDesc; +STATIC_GLOBAL NFnDesc* renameDesc; +STATIC_GLOBAL NFnDesc* removeDesc; B list_c1(B d, B x) { return path_list(path_rel(nfn_objU(d), x, "•file.List")); @@ -1248,7 +1248,7 @@ B tErrRaw_c1(B t, B x) { return x; } -static GLOBAL B termNS; +STATIC_GLOBAL B termNS; B getTermNS(void) { if (termNS.u == 0) { #define F(X) incG(bi_##X), @@ -1312,7 +1312,7 @@ B nHas_c2(B t, B w, B x) { decG(w); decG(x); return m_i32(!q_N(r)); } -static GLOBAL B nsNS; +STATIC_GLOBAL B nsNS; B getNsNS(void) { if (nsNS.u == 0) { #define F(X) incG(bi_##X), @@ -1612,7 +1612,7 @@ DEF_OP2(and) DEF_OP2(or) DEF_OP2(xor) DEF_OP2(add) DEF_OP2(sub) DEF_OP2(mul) #undef DEF_OP2 -static GLOBAL B bitNS; +STATIC_GLOBAL B bitNS; B getBitNS(void) { if (bitNS.u == 0) { #define F(X) incG(bi_bit##X), @@ -1627,7 +1627,7 @@ B getBitNS(void) { B getInternalNS(void); B getMathNS(void); -static GLOBAL Body* file_nsGen; +STATIC_GLOBAL Body* file_nsGen; #if FFI || FOR_BUILD #define FFIOPT 1 @@ -1732,7 +1732,7 @@ static NOINLINE void initSysDesc() { extern char* const cbqn_versionString; #endif -static GLOBAL B platformNS; +STATIC_GLOBAL B platformNS; static B getPlatformNS(void) { if (platformNS.u == 0) { diff --git a/src/core/derv.c b/src/core/derv.c index c27b6ce6..b5ab26db 100644 --- a/src/core/derv.c +++ b/src/core/derv.c @@ -109,8 +109,8 @@ static B toConstant(B x) { // doesn't consume x } return bi_N; } -static GLOBAL NFnDesc* ucwWrapDesc; -static GLOBAL NFnDesc* uc1WrapDesc; +STATIC_GLOBAL NFnDesc* ucwWrapDesc; +STATIC_GLOBAL NFnDesc* uc1WrapDesc; static B fork_uc1(B t, B o, B x) { B f = toConstant(c(Fork, t)->f); diff --git a/src/core/heap.c b/src/core/heap.c index c39d89fc..3513c4ee 100644 --- a/src/core/heap.c +++ b/src/core/heap.c @@ -32,15 +32,15 @@ void cbqn_heapVerify() { #endif -static GLOBAL u64 heap_PICounts[t_COUNT]; -static GLOBAL u64 heap_PISizes[t_COUNT]; +STATIC_GLOBAL u64 heap_PICounts[t_COUNT]; +STATIC_GLOBAL u64 heap_PISizes[t_COUNT]; NOINLINE void heap_PIFn(Value* v) { heap_PICounts[PTY(v)]++; heap_PISizes[PTY(v)]+= mm_size(v); } -static GLOBAL u64 heap_PIFreed[128]; +STATIC_GLOBAL u64 heap_PIFreed[128]; void heap_PIFreedFn(Value* v) { heap_PIFreed[v->mmInfo&127]++; } diff --git a/src/ffi.c b/src/ffi.c index 0333095f..66c877f9 100644 --- a/src/ffi.c +++ b/src/ffi.c @@ -613,7 +613,7 @@ NOINLINE B readU16Bits(B x) { usz ia=IA(x); u16* xp=tyarr_ptr(x); i32* rp; B r=m NOINLINE B readU32Bits(B x) { usz ia=IA(x); u32* xp=tyarr_ptr(x); f64* rp; B r=m_f64arrv(&rp, ia); for (usz i=0; i #include "utils/cstr.h" GLOBAL Replxx* global_replxx; - static GLOBAL char* global_histfile; - static GLOBAL u32 cfg_prefixChar = U'\\'; + STATIC_GLOBAL char* global_histfile; + STATIC_GLOBAL u32 cfg_prefixChar = U'\\'; static i8 const themes[3][12][3] = { // {-1,-1,-1} for default/unchanged color, {-1,-1,n} for grayscale 0…23, else RGB 0…5 @@ -109,11 +109,11 @@ static NOINLINE i64 readInt(char** p) { }; typedef i8 Theme[12][3]; - static GLOBAL ReplxxColor theme_replxx[12]; + STATIC_GLOBAL ReplxxColor theme_replxx[12]; - static GLOBAL i32 cfg_theme = 1; - static GLOBAL bool cfg_enableKeyboard = true; - static GLOBAL B cfg_path; + STATIC_GLOBAL i32 cfg_theme = 1; + STATIC_GLOBAL bool cfg_enableKeyboard = true; + STATIC_GLOBAL B cfg_path; static char* const command_completion[] = { ")ex ", @@ -163,7 +163,7 @@ static NOINLINE i64 readInt(char** p) { } extern u32* const dsv_text[]; - static GLOBAL B sysvalNames, sysvalNamesNorm; + STATIC_GLOBAL B sysvalNames, sysvalNamesNorm; NOINLINE void fill_color(ReplxxColor* cols, int s, int e, ReplxxColor col) { PLAINLOOP for (int i = s; i < e; i++) cols[i] = col; @@ -406,9 +406,9 @@ static NOINLINE i64 readInt(char** p) { return (TmpState){.s = s, .pos = replace? pos : pos+1}; } - static GLOBAL B b_pv; - static GLOBAL int b_pp; - static GLOBAL bool inBackslash; + STATIC_GLOBAL B b_pv; + STATIC_GLOBAL int b_pp; + STATIC_GLOBAL bool inBackslash; static void stopBackslash() { inBackslash = false; } NOINLINE void setPrev(B s, u64 pos) { // consumes decG(b_pv); @@ -440,7 +440,7 @@ static NOINLINE i64 readInt(char** p) { B indexOf_c2(B, B, B); B pick_c1(B, B); - static GLOBAL B b_key, b_val; + STATIC_GLOBAL B b_key, b_val; void modified_replxx(char** s_res, int* p_res, void* userData) { if (!cfg_enableKeyboard) return; CATCH_OOM(return) @@ -579,7 +579,7 @@ void clearImportCache(void); void switchComp(void); #endif -static GLOBAL B escape_parser; +STATIC_GLOBAL B escape_parser; static B simple_unescape(B x) { if (RARE(escape_parser.u==0)) { escape_parser = bqn_exec(utf8Decode0("{m←\"Expected surrounding quotes\" ⋄ m!2≤≠𝕩 ⋄ m!\"\"\"\"\"\"≡0‿¯1⊏𝕩 ⋄ s←¬e←<`'\\'=𝕩 ⋄ i‿o←\"\\\"\"nr\"⋈\"\\\"\"\"∾@+10‿13 ⋄ 1↓¯1↓{n←i⊐𝕩 ⋄ \"Unknown escape\"!∧´n≠≠i ⋄ n⊏o}⌾((s/»e)⊸/) s/𝕩}"), bi_N); diff --git a/src/nfns.c b/src/nfns.c index 0ac01d34..e50208ed 100644 --- a/src/nfns.c +++ b/src/nfns.c @@ -2,8 +2,8 @@ #include "h.h" #include "nfns.h" -static GLOBAL u32 nfn_curr; -static GLOBAL B nfn_list; +STATIC_GLOBAL u32 nfn_curr; +STATIC_GLOBAL B nfn_list; NFnDesc* registerNFn(B name, FC1 c1, FC2 c2) { u32 id = nfn_curr++; diff --git a/src/ns.c b/src/ns.c index 4f0c2f8c..d6d2b820 100644 --- a/src/ns.c +++ b/src/ns.c @@ -100,8 +100,8 @@ void ns_set(B ns, B name, B val) { VTY(ns, t_ns); -static GLOBAL i32* emptyi32ptr; -static GLOBAL B emptyi32obj; +STATIC_GLOBAL i32* emptyi32ptr; +STATIC_GLOBAL B emptyi32obj; Body* m_nnsDescF(i32 n, char** names) { if (emptyi32ptr==NULL) gc_add(emptyi32obj = m_i32arrv(&emptyi32ptr, 0)); incByG(emptyi32obj, 2); diff --git a/src/opt/gc.c b/src/opt/gc.c index 37d3e98c..a054e9c2 100644 --- a/src/opt/gc.c +++ b/src/opt/gc.c @@ -196,7 +196,7 @@ void gc_forceGC(bool toplevel) { #endif } -static GLOBAL bool gc_wantTopLevelGC; +STATIC_GLOBAL bool gc_wantTopLevelGC; bool gc_maybeGC(bool toplevel) { if (gc_depth) return false; u64 used = mm_heapUsed(); diff --git a/src/opt/mm_buddyTemplate.c b/src/opt/mm_buddyTemplate.c index 7e8bf057..12bf9a4c 100644 --- a/src/opt/mm_buddyTemplate.c +++ b/src/opt/mm_buddyTemplate.c @@ -31,7 +31,7 @@ FORCE_INLINE void BN(splitTo)(EmptyValue* c, i64 from, i64 to, bool notEqual) { } #if ALLOC_MODE==0 && ENABLE_GC - static GLOBAL bool BN(allocMore_rec); + STATIC_GLOBAL bool BN(allocMore_rec); #endif static NOINLINE void* BN(allocateMore)(i64 bucket, u8 type, i64 from, i64 to) { diff --git a/src/utils/ryu.c b/src/utils/ryu.c index 7e8702f4..8bc146e6 100644 --- a/src/utils/ryu.c +++ b/src/utils/ryu.c @@ -381,8 +381,8 @@ static inline B to_chars(const floating_decimal_64 v, const bool sign, const boo return r; } -static GLOBAL B fmt_nan, fmt_zero; -static GLOBAL B fmt_inf[2]; +STATIC_GLOBAL B fmt_nan, fmt_zero; +STATIC_GLOBAL B fmt_inf[2]; B ryu_d2s(double f) { const uint64_t bits = double_to_bits(f); // decode the floating-point number, and unify normalized and subnormal cases. diff --git a/src/vm.c b/src/vm.c index 01583d2c..4415fd07 100644 --- a/src/vm.c +++ b/src/vm.c @@ -140,7 +140,7 @@ typedef struct NextRequest { u32 pos2; // ↑ for dyadic; U32_MAX if not wanted } NextRequest; -static GLOBAL B emptyARMM; +STATIC_GLOBAL B emptyARMM; Block* compileBlock(B block, Comp* comp, bool* bDone, u32* bc, usz bcIA, B allBlocks, B allBodies, B nameList, Scope* sc, i32 depth, i32 myPos, i32 nsResult) { assert(sc!=NULL || nsResult==0); @@ -1154,7 +1154,7 @@ void md2Bl_print(FILE* f, B x) { fprintf(f,"{2-modifier block}"); } B block_decompose(B x) { return m_hvec2(m_i32(1), x); } #if !defined(_WIN32) && !defined(_WIN64) -static GLOBAL usz pageSizeV; +STATIC_GLOBAL usz pageSizeV; #endif usz getPageSize() {