path
stringlengths
14
112
content
stringlengths
0
6.32M
size
int64
0
6.32M
max_lines
int64
1
100k
repo_name
stringclasses
2 values
autogenerated
bool
1 class
cosmopolitan/third_party/lua/lcorolib.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
7,553
232
jart/cosmopolitan
false
cosmopolitan/third_party/lua/luaparseurl.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
2,868
61
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/gc.lua
-- $Id: test/gc.lua $ -- See Copyright Notice in file all.lua print('testing incremental garbage collection') local debug = require"debug" assert(collectgarbage("isrunning")) collectgarbage() local oldmode = collectgarbage("incremental") -- changing modes should return previous mode assert(collectgarbage("generat...
17,929
690
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/attrib.lua
-- $Id: test/attrib.lua $ -- See Copyright Notice in file all.lua print "testing require" assert(require"string" == string) assert(require"math" == math) assert(require"table" == table) assert(require"io" == io) assert(require"os" == os) assert(require"coroutine" == coroutine) assert(type(package.path) == "string") ...
13,123
516
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/tracegc.lua
-- track collections local M = {} -- import list local setmetatable, stderr, collectgarbage = setmetatable, io.stderr, collectgarbage _ENV = nil local active = false -- each time a table is collected, remark it for finalization on next -- cycle local mt = {} function mt.__gc (o) stderr:write'.' -- m...
680
41
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/sort.lua
-- $Id: test/sort.lua $ -- See Copyright Notice in file all.lua print "testing (parts of) table library" print "testing unpack" local unpack = table.unpack local maxI = math.maxinteger local minI = math.mininteger local function checkerror (msg, f, ...) local s, err = pcall(f, ...) assert(not s and string.fin...
8,311
311
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/strings.lua
-- $Id: test/strings.lua $ -- See Copyright Notice in file all.lua print('testing strings and string library') local maxi <const> = math.maxinteger local mini <const> = math.mininteger local function checkerror (msg, f, ...) local s, err = pcall(f, ...) assert(not s and string.find(err, msg)) end -- testing s...
17,152
499
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/closure.lua
-- $Id: test/closure.lua $ -- See Copyright Notice in file all.lua print "testing closures" local A,B = 0,{g=10} function f(x) local a = {} for i=1,1000 do local y = 0 do a[i] = function () B.g = B.g+1; y = y+x; return y+A end end end local dummy = function () return a[A] end collectgarbag...
5,710
271
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/events.lua
-- $Id: test/events.lua $ -- See Copyright Notice in file all.lua print('testing metatables') local debug = require'debug' X = 20; B = 30 _ENV = setmetatable({}, {__index=_G}) collectgarbage() X = X+10 assert(X == 30 and _G.X == 20) B = false assert(B == false) _ENV["B"] = undef assert(B == 30) assert(getmetatab...
12,399
489
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/code.lua
-- $Id: test/code.lua $ -- See Copyright Notice in file all.lua if T==nil then (Message or print)('\n >>> testC not active: skipping opcode tests <<<\n') return end print "testing code generation and optimizations" -- to test constant propagation local k0aux <const> = 0 local k0 <const> = k0aux local k1 <const> =...
12,853
436
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/main.lua
# testing special comment on first line -- $Id: test/main.lua $ -- See Copyright Notice in file all.lua -- most (all?) tests here assume a reasonable "Unix-like" shell if _port then return end -- use only "double quotes" inside shell scripts (better change to -- run on Windows) print ("testing stand-alone interpret...
13,445
505
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/utf8.lua
-- $Id: test/utf8.lua $ -- See Copyright Notice in file all.lua print "testing UTF-8 library" local utf8 = require'utf8' local function checkerror (msg, f, ...) local s, err = pcall(f, ...) assert(not s and string.find(err, msg)) end local function len (s) return #string.gsub(s, "[\x80-\xBF]", "") end loc...
6,793
242
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/math.lua
-- $Id: test/math.lua $ -- See Copyright Notice in file all.lua print("testing numbers and math lib") local minint <const> = math.mininteger local maxint <const> = math.maxinteger local intbits <const> = math.floor(math.log(maxint, 2) + 0.5) + 1 assert((1 << intbits) == 0) assert(minint == 1 << (intbits - 1)) asser...
29,609
1,024
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/constructs.lua
-- $Id: test/constructs.lua $ -- See Copyright Notice in file all.lua ;;print "testing syntax";; local debug = require "debug" local function checkload (s, msg) assert(string.find(select(2, load(s)), msg)) end -- testing semicollons do ;;; end ; do ; a = 3; assert(a == 3) end; ; -- invalid operations should no...
9,206
378
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/goto.lua
-- $Id: test/goto.lua $ -- See Copyright Notice in file all.lua collectgarbage() local function errmsg (code, m) local st, msg = load(code) assert(not st and string.find(msg, m)) end -- cannot see label inside block errmsg([[ goto l1; do ::l1:: end ]], "label 'l1'") errmsg([[ do ::l1:: end goto l1; ]], "label 'l...
5,754
272
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/nextvar.lua
-- $Id: test/nextvar.lua $ -- See Copyright Notice in file all.lua print('testing tables, next, and for') local function checkerror (msg, f, ...) local s, err = pcall(f, ...) assert(not s and string.find(err, msg)) end local a = {} -- make sure table has lots of space in hash part for i=1,100 do a[i.."+"] = tr...
18,556
768
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/vararg.lua
-- $Id: test/vararg.lua $ -- See Copyright Notice in file all.lua print('testing vararg') function f(a, ...) local x = {n = select('#', ...), ...} for i = 1, x.n do assert(a[i] == x[i]) end return x.n end function c12 (...) assert(arg == _G.arg) -- no local 'arg' local x = {...}; x.n = #x local res = ...
3,358
152
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/calls.lua
-- $Id: test/calls.lua $ -- See Copyright Notice in file all.lua print("testing functions and calls") local debug = require "debug" -- get the opportunity to test 'type' too ;) assert(type(1<2) == 'boolean') assert(type(true) == 'boolean' and type(false) == 'boolean') assert(type(nil) == 'nil' and type(-3) == 'n...
11,613
482
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/all.lua
#!../lua -- $Id: test/all.lua $ -- See Copyright Notice at the end of this file local version = "Lua 5.4" if _VERSION ~= version then io.stderr:write("This test suite is for ", version, ", not for ", _VERSION, "\nExiting tests") return end _G.ARG = arg -- save arg for other tests -- next v...
8,150
312
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/heavy.lua
-- $Id: heavy.lua,v 1.7 2017/12/29 15:42:15 roberto Exp $ -- See Copyright Notice in file all.lua local function teststring () print("creating a string too long") do local a = "x" local st, msg = pcall(function () while true do a = a .. a.. a.. a.. a.. a.. a.. a.. a.. a .. a .. a.. a...
4,462
174
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/tpack.lua
-- $Id: test/tpack.lua $ -- See Copyright Notice in file all.lua local pack = string.pack local packsize = string.packsize local unpack = string.unpack print "testing pack/unpack" -- maximum size for integers local NB = 16 local sizeshort = packsize("h") local sizeint = packsize("i") local sizelong = packsize("l") ...
10,525
323
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/coroutine.lua
-- $Id: test/coroutine.lua $ -- See Copyright Notice in file all.lua print "testing coroutines" local debug = require'debug' local f local main, ismain = coroutine.running() assert(type(main) == "thread" and ismain) assert(not coroutine.resume(main)) assert(not coroutine.isyieldable(main) and not coroutine.isyielda...
29,839
1,102
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/gengc.lua
-- $Id: test/gengc.lua $ -- See Copyright Notice in file all.lua print('testing generational garbage collection') local debug = require"debug" assert(collectgarbage("isrunning")) collectgarbage() local oldmode = collectgarbage("generational") -- ensure that table barrier evolves correctly do local U = {} -- ...
5,218
173
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/api.lua
-- $Id: test/api.lua $ -- See Copyright Notice in file all.lua if T==nil then (Message or print)('\n >>> testC not active: skipping API tests <<<\n') return end local debug = require "debug" local pack = table.pack -- standard error message for memory errors local MEMERRMSG = "not enough memory" function tche...
42,135
1,535
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/errors.lua
-- $Id: test/errors.lua $ -- See Copyright Notice in file all.lua print("testing errors") local debug = require"debug" -- avoid problems with 'strict' module (which may generate other error messages) local mt = getmetatable(_G) or {} local oldmm = mt.__index mt.__index = nil local function checkerr (msg, f, ...) ...
18,156
646
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/bwcoercion.lua
local tonumber, tointeger = tonumber, math.tointeger local type, getmetatable, rawget, error = type, getmetatable, rawget, error local strsub = string.sub local print = print _ENV = nil -- Try to convert a value to an integer, without assuming any coercion. local function toint (x) x = tonumber(x) -- handle nume...
1,791
79
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/locals.lua
-- $Id: test/locals.lua $ -- See Copyright Notice in file all.lua print('testing local variables and environments') local debug = require"debug" local tracegc = require"tracegc" -- bug in 5.1: local function f(x) x = nil; return x end assert(f(10) == nil) local function f() local x; return x end assert(f(10) == ...
25,956
1,054
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/pm.lua
-- $Id: test/pm.lua $ -- See Copyright Notice in file all.lua print('testing pattern matching') local function checkerror (msg, f, ...) local s, err = pcall(f, ...) assert(not s and string.find(err, msg)) end function f(s, p) local i,e = string.find(s, p) if i then return string.sub(s, i, e) end end a,b = ...
13,268
422
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/packtests
NAME=$1"-tests" ln -s . $NAME ln -s .. ltests tar --create --gzip --no-recursion --file=$NAME.tar.gz \ $NAME/all.lua \ $NAME/api.lua \ $NAME/attrib.lua \ $NAME/big.lua \ $NAME/bitwise.lua \ $NAME/bwcoercion.lua \ $NAME/calls.lua \ $NAME/closure.lua \ $NAME/code.lua \ $NAME/constructs.lua \ $NAME/coroutine....
1,001
56
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/big.lua
-- $Id: test/big.lua $ -- See Copyright Notice in file all.lua if _soft then return 'a' end print "testing large tables" local debug = require"debug" local lim = 2^18 + 1000 local prog = { "local y = {0" } for i = 1, lim do prog[#prog + 1] = i end prog[#prog + 1] = "}\n" prog[#prog + 1] = "X = y\n" prog[#prog +...
2,142
83
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/cstack.lua
-- $Id: test/cstack.lua $ -- See Copyright Notice in file all.lua local tracegc = require"tracegc" print"testing stack overflow detection" -- Segmentation faults in these tests probably result from a C-stack -- overflow. To avoid these errors, you should set a smaller limit for -- the use of C stack by Lua, by chan...
4,187
158
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/db.lua
-- $Id: test/db.lua $ -- See Copyright Notice in file all.lua -- testing debug library local debug = require "debug" local function dostring(s) return assert(load(s))() end print"testing debug library and debug information" do local a=1 end assert(not debug.gethook()) local testline = 19 -- line where 't...
24,788
994
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/files.lua
-- $Id: test/files.lua $ -- See Copyright Notice in file all.lua local debug = require "debug" local maxint = math.maxinteger assert(type(os.getenv"PATH") == "string") assert(io.input(io.stdin) == io.stdin) assert(not pcall(io.input, "non-existent-file")) assert(io.output(io.stdout) == io.stdout) local function t...
25,918
940
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/literals.lua
-- $Id: test/literals.lua $ -- See Copyright Notice in file all.lua print('testing scanner') local debug = require "debug" local function dostring (x) return assert(load(x), "")() end dostring("x \v\f = \t\r 'a\0a' \v\f\f") assert(x == 'a\0a' and string.len(x) == 3) -- escape sequences assert('\n\"\'\\' == [[ "'...
10,780
319
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/verybig.lua
-- $Id: test/verybig.lua $ -- See Copyright Notice in file all.lua print "testing RK" -- testing opcodes with RK arguments larger than K limit local function foo () local dummy = { -- fill first 256 entries in table of constants 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 2...
3,682
153
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/bitwise.lua
-- $Id: test/bitwise.lua $ -- See Copyright Notice in file all.lua print("testing bitwise operations") require "bwcoercion" local numbits = string.packsize('j') * 8 assert(~0 == -1) assert((1 << (numbits - 1)) == math.mininteger) -- basic tests for bitwise operators; -- use variables to avoid constant folding loc...
9,601
347
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/libs/makefile
# change this variable to point to the directory with Lua headers # of the version being tested LUA_DIR = ../../ CC = gcc # compilation should generate Dynamic-Link Libraries CFLAGS = -Wall -std=gnu99 -O2 -I$(LUA_DIR) -fPIC -shared # libraries used by the tests all: lib1.so lib11.so lib2.so lib21.so lib2-v2.so touc...
707
28
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/libs/lib2.c
#include "lua.h" #include "lauxlib.h" static int id (lua_State *L) { return lua_gettop(L); } static const struct luaL_Reg funcs[] = { {"id", id}, {NULL, NULL} }; LUAMOD_API int luaopen_lib2 (lua_State *L) { lua_settop(L, 2); lua_setglobal(L, "y"); /* y gets 2nd parameter */ lua_setglobal(L, "x"); /* ...
385
24
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/libs/lib11.c
#include "lua.h" /* function from lib1.c */ int lib1_export (lua_State *L); LUAMOD_API int luaopen_lib11 (lua_State *L) { return lib1_export(L); }
153
11
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/libs/lib22.c
#include "lua.h" #include "lauxlib.h" static int id (lua_State *L) { lua_pushboolean(L, 1); lua_insert(L, 1); return lua_gettop(L); } static const struct luaL_Reg funcs[] = { {"id", id}, {NULL, NULL} }; LUAMOD_API int luaopen_lib2 (lua_State *L) { lua_settop(L, 2); lua_setglobal(L, "y"); /* y gets 2...
430
26
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/libs/lib1.c
#include "lua.h" #include "lauxlib.h" static int id (lua_State *L) { return lua_gettop(L); } static const struct luaL_Reg funcs[] = { {"id", id}, {NULL, NULL} }; /* function used by lib11.c */ LUAMOD_API int lib1_export (lua_State *L) { lua_pushstring(L, "exported"); return 1; } LUAMOD_API int onefunct...
835
45
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/libs/lib21.c
#include "lua.h" int luaopen_lib2 (lua_State *L); LUAMOD_API int luaopen_lib21 (lua_State *L) { return luaopen_lib2(L); }
129
11
jart/cosmopolitan
false
cosmopolitan/third_party/lua/test/libs/P1/dummy
# This is a dummy file just to make git keep the otherwise empty # directory 'P1' in the repository.
101
3
jart/cosmopolitan
false
cosmopolitan/third_party/maxmind/maxminddb.h
#ifndef COSMOPOLITAN_THIRD_PARTY_MAXMIND_MAXMINDDB_H_ #define COSMOPOLITAN_THIRD_PARTY_MAXMIND_MAXMINDDB_H_ #include "libc/sock/sock.h" #include "libc/stdio/stdio.h" #define MMDB_MODE_MMAP 1 #define MMDB_MODE_MASK 7 #define MMDB_DATA_TYPE_EXTENDED 0 #define MMDB_DATA_TYPE_POINTER 1 #define MMDB_DATA_TYPE_UTF8_...
6,268
183
jart/cosmopolitan
false
cosmopolitan/third_party/maxmind/maxminddb.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
61,306
1,620
jart/cosmopolitan
false
cosmopolitan/third_party/maxmind/README.cosmo
ORIGIN git@github.com:maxmind/libmaxminddb.git commit d918412fe7d514108d01e346a832d51e5ccf83c0 Author: Will Storey <wstorey@maxmind.com> Date: Thu Apr 29 11:53:54 2021 -0700 Merge pull request #265 from maxmind/greg/release 1.6.0 LOCAL CHANGES - Added MMDB_lookup() - Remove Berkeleyisms from API design...
333
14
jart/cosmopolitan
false
cosmopolitan/third_party/maxmind/getmetroname.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
9,397
258
jart/cosmopolitan
false
cosmopolitan/third_party/maxmind/maxmind.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ PKGS += THIRD_PARTY_MAXMIND THIRD_PARTY_MAXMIND_ARTIFACTS += THIRD_PARTY_MAXMIND_A THIRD_PARTY_MAXMIND = $(THIRD_PARTY...
2,122
58
jart/cosmopolitan
false
cosmopolitan/third_party/vqsort/vqsort_int32.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
2,081
30
jart/cosmopolitan
false
cosmopolitan/third_party/vqsort/README.cosmo
DESCRIPTION vqsort implements vectorized quicksort using avx2. this is the fastest way to sort integers. this goes as fast as djbsort for 32-bit integers except it supports 64-bit integers too, which go just as fast: about a gigabyte of memory sorted per second. It's 3x faster than simple radix sort. It's 5x...
726
24
jart/cosmopolitan
false
cosmopolitan/third_party/vqsort/vqsort.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ PKGS += THIRD_PARTY_VQSORT THIRD_PARTY_VQSORT_ARTIFACTS += THIRD_PARTY_VQSORT_A THIRD_PARTY_VQSORT = $(THIRD_PARTY_VQS...
2,279
53
jart/cosmopolitan
false
cosmopolitan/third_party/vqsort/vqsort_int64.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
2,081
30
jart/cosmopolitan
false
cosmopolitan/third_party/vqsort/vqsort.h
#ifndef COSMOPOLITAN_THIRD_PARTY_VQSORT_H_ #define COSMOPOLITAN_THIRD_PARTY_VQSORT_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ void vqsort_int64(int64_t *, size_t); void vqsort_int64_avx2(int64_t *, size_t); void vqsort_int64_sse4(int64_t *, size_t); void vqsort_int64_ssse3(int64_t *, size_t); void ...
686
21
jart/cosmopolitan
false
cosmopolitan/third_party/vqsort/vqsort_i32a.S
.text .globl __popcountdi2 .section .text._ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIiEEEEEEiEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits .p2align 4 .type _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIiLm4...
560,349
24,733
jart/cosmopolitan
false
cosmopolitan/third_party/vqsort/vqsort_i64a.S
.text .globl __popcountdi2 .section .text._ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2ELi0EEENS1_12SharedTraitsINS1_10TraitsLaneINS1_14OrderAscendingIlEEEEEElEEbT_T0_PT1_mDTcl4ZerocvSB__EEESF_RSF_SE_.isra.0,"ax",@progbits .p2align 4 .type _ZN3hwy6N_SSE26detail22MaybePartitionTwoValueINS0_4SimdIlLm2...
527,044
23,680
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/system.inc
// clang-format off /* -------------------------- system alloc setup ------------------------- */ /* Operations on mflags */ #define use_lock(M) ((M)->mflags & USE_LOCK_BIT) #define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) #if USE_LOCKS #define disable_lock(M) ((M)->mflags &= ~USE_LOCK_...
2,820
95
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/dlmalloc_abort.greg.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
2,144
32
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/debuglib.inc
// clang-format off #if DEBUG /* ------------------------- Debugging Support --------------------------- */ /* Check properties of any chunk, whether free, inuse, mmapped etc */ static void do_check_any_chunk(mstate m, mchunkptr p) { assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); assert(ok_ad...
8,074
271
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/binmaps.inc
// clang-format off /* ------------------------ Operations on bin maps ----------------------- */ /* bit corresponding to given index */ #define idx2bit(i) ((binmap_t)(1) << (i)) /* Mark/Clear bits with given index */ #define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i)) #define clear_smallmap(...
1,855
68
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/chunks.inc
// clang-format off /* ------------------- Chunks sizes and alignments ----------------------- */ #define MCHUNK_SIZE (sizeof(mchunk)) #if FOOTERS #define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) #else /* FOOTERS */ #define CHUNK_OVERHEAD (SIZE_T_SIZE) #endif /* FOOTERS */ /* MMapped chunks need a second...
1,444
39
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/dlmalloc.c
#include "third_party/dlmalloc/dlmalloc.h" #include "libc/assert.h" #include "libc/calls/calls.h" #include "libc/dce.h" #include "libc/errno.h" #include "libc/intrin/bsr.h" #include "libc/intrin/likely.h" #include "libc/intrin/weaken.h" #include "libc/macros.internal.h" #include "libc/mem/mem.h" #include "libc/nexgen32...
43,673
1,444
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/init.inc
// clang-format off /* ---------------------------- setting mparams -------------------------- */ #if LOCK_AT_FORK static void dlmalloc_pre_fork(void) { ACQUIRE_LOCK(&(gm)->mutex); } static void dlmalloc_post_fork_parent(void) { RELEASE_LOCK(&(gm)->mutex); } static void dlmalloc_post_fork_child(void) { INITI...
3,820
125
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/README.cosmo
DESCRIPTION malloc-2.8.6 written by Doug Lea LICENSE http://creativecommons.org/publicdomain/zero/1.0/ LOCAL CHANGES - Use faster two power roundup for memalign() - Poison maps to integrate with Address Sanitizer - Introduce __oom_hook() by using _mapanon() vs. mmap() - Wrap locks with __threaded che...
402
17
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/directmap.inc
// clang-format off /* ----------------------- Direct-mmapping chunks ----------------------- */ /* Directly mmapped chunks are set up with an offset to the start of the mmapped region stored in the prev_foot field of the chunk. This allows reconstruction of the required argument to MUNMAP when freed, and al...
2,822
80
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/README
This is a version (aka dlmalloc) of malloc/free/realloc written by Doug Lea and released to the public domain, as explained at http://creativecommons.org/publicdomain/zero/1.0/ Send questions, comments, complaints, performance data, etc to dl@cs.oswego.edu * Version 2.8.6 Wed Aug 29 06:57:58 2012 Doug Lea ...
61,750
1,192
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/trees.inc
// clang-format off /* ------------------------- Operations on trees ------------------------- */ /* Insert chunk into tree */ #define insert_large_chunk(M, X, S) {\ tbinptr* H;\ bindex_t I;\ compute_tree_index(S, I);\ H = treebin_at(M, I);\ X->index = I;\ X->child[0] = X->child[1] = 0;\ if (!treemap_is...
4,706
172
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/indexing.inc
// clang-format off /* ---------------------------- Indexing Bins ---------------------------- */ #define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) #define small_index(s) (bindex_t)((s) >> SMALLBIN_SHIFT) #define small_index2size(i) ((i) << SMALLBIN_SHIFT) #define MIN_SMALL_INDEX (small_in...
2,764
92
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/hooks.inc
// clang-format off /* ------------------------------- Hooks -------------------------------- */ /* PREACTION should be defined to return 0 on success, and nonzero on failure. If you are not using locking, you can redefine these to do anything you like. */ #if USE_LOCKS #define PREACTION(M) ((use_lock(M))? A...
1,487
57
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/vespene.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
2,316
38
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/vespene.internal.h
#ifndef COSMOPOLITAN_THIRD_PARTY_DLMALLOC_VESPENE_INTERNAL_H_ #define COSMOPOLITAN_THIRD_PARTY_DLMALLOC_VESPENE_INTERNAL_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ void *dlmalloc_requires_more_vespene_gas(size_t); COSMOPOLITAN_C_END_ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* COSMOPO...
370
11
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/dlmalloc.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ PKGS += THIRD_PARTY_DLMALLOC THIRD_PARTY_DLMALLOC_ARTIFACTS += THIRD_PARTY_DLMALLOC_A THIRD_PARTY_DLMALLOC = $(THIRD_P...
3,128
80
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/mspaces.inc
#include "third_party/dlmalloc/dlmalloc.h" // clang-format off static mstate init_user_mstate(char* tbase, size_t tsize) { size_t msize = pad_request(sizeof(struct malloc_state)); mchunkptr mn; mchunkptr msp = align_as_chunk(tbase); mstate m = (mstate)(chunk2mem(msp)); bzero(m, msize); (void)INITIAL_LOCK(&...
15,782
582
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/locks.inc
// clang-format off #include "third_party/nsync/mu.h" #include "libc/atomic.h" #include "libc/intrin/atomic.h" #include "libc/calls/calls.h" #include "libc/thread/tls.h" /* --------------------------- Lock preliminaries ------------------------ */ /* When locks are defined, there is one global lock, plus one per-...
3,792
99
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/smallbins.inc
// clang-format off /* ----------------------- Operations on smallbins ----------------------- */ /* Various forms of linking and unlinking are defined as macros. Even the ones for trees, which are very long but have very short typical paths. This is ugly but reduces reliance on inlining support of compiler...
2,079
87
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/management.inc
// clang-format off /* -------------------------- mspace management -------------------------- */ /* Initialize top chunk and its size */ static void init_top(mstate m, mchunkptr p, size_t psize) { /* Ensure alignment */ size_t offset = align_offset(chunk2mem(p)); p = (mchunkptr)((char*)p + offset); psize -= ...
4,282
143
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/dlmalloc.h
#ifndef COSMOPOLITAN_THIRD_PARTY_DLMALLOC_DLMALLOC_H_ #define COSMOPOLITAN_THIRD_PARTY_DLMALLOC_DLMALLOC_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ /* malloc(size_t n) Returns a pointer to a newly allocated chunk of at least n bytes, or null if no space is available, in which case errno is se...
20,841
514
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/debugging.inc
// clang-format off /* -------------------------- Debugging setup ---------------------------- */ #if ! DEBUG #define check_free_chunk(M,P) #define check_inuse_chunk(M,P) #define check_malloced_chunk(M,P,N) #define check_mmapped_chunk(M,P) #define check_malloc_state(M) #define check_top_chunk(M,P) #else /* DEBUG */...
1,377
35
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/statistics.inc
// clang-format off /* ----------------------------- statistics ------------------------------ */ #if !NO_MALLINFO static struct mallinfo internal_mallinfo(mstate m) { struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; ensure_initialization(); if (!PREACTION(m)) { check_malloc_state(m); if (is_initi...
2,120
78
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/global.inc
// clang-format off /* ------------- Global malloc_state and malloc_params ------------------- */ /* malloc_params holds global properties, including those that can be dynamically set using mallopt. There is a single instance, mparams, initialized in init_mparams. Note that the non-zeroness of "magic" also se...
891
36
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/runtimechecks.inc
// clang-format off /* ----------------------- Runtime Check Support ------------------------- */ /* For security, the main invariant is that malloc/free/etc never writes to a static address other than malloc_state, unless static malloc_state itself has been corrupted, which cannot occur via malloc (because o...
4,160
113
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/platform.inc
// clang-format off #define LACKS_UNISTD_H #define LACKS_FCNTL_H #define LACKS_SYS_PARAM_H #define LACKS_SYS_MMAN_H #define LACKS_STRINGS_H #define LACKS_STRING_H #define LACKS_SYS_TYPES_H #define LACKS_ERRNO_H #define LACKS_STDLIB_H #define LACKS_SCHED_H #define LACKS_TIME_H /* Version identifier to allow people to ...
16,340
524
jart/cosmopolitan
false
cosmopolitan/third_party/dlmalloc/headfoot.inc
// clang-format off /* ------------------ Operations on head and foot fields ----------------- */ /* The head field of a chunk is or'ed with PINUSE_BIT when previous adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in use, unless mmapped, in which case both bits are cleared. FLAG4_BIT is not...
4,751
138
jart/cosmopolitan
false
cosmopolitan/third_party/regex/regerror.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╞═════════════════════════════════════════════════â•...
2,922
54
jart/cosmopolitan
false
cosmopolitan/third_party/regex/tre-mem.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
8,039
152
jart/cosmopolitan
false
cosmopolitan/third_party/regex/regexec.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
36,009
901
jart/cosmopolitan
false
cosmopolitan/third_party/regex/regex.h
#ifndef COSMOPOLITAN_LIBC_REGEX_REGEX_H_ #define COSMOPOLITAN_LIBC_REGEX_REGEX_H_ #if !(__ASSEMBLER__ + __LINKER__ + 0) COSMOPOLITAN_C_START_ #if 0 /*────────────────────────────────────────────────────────â...
1,883
62
jart/cosmopolitan
false
cosmopolitan/third_party/regex/regcomp.c
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
89,390
2,624
jart/cosmopolitan
false
cosmopolitan/third_party/regex/notice.inc
asm(".ident\t\"\\n\ Musl Libc (MIT License)\\n\ Copyright 2005-2014 Rich Felker\""); asm(".include \"libc/disclaimer.inc\""); asm(".ident\t\"\\n\ TRE regex (BSD-2 License)\\n\ Copyright 2001-2009 Ville Laurikari <vl@iki.fi>\\n\ Copyright 2016 Szabolcs Nagy\""); asm(".include \"libc/disclaimer.inc\"");
304
11
jart/cosmopolitan
false
cosmopolitan/third_party/regex/regex.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ PKGS += THIRD_PARTY_REGEX THIRD_PARTY_REGEX_ARTIFACTS += THIRD_PARTY_REGEX_A THIRD_PARTY_REGEX = $(THIRD_PARTY_REGEX_A...
2,200
59
jart/cosmopolitan
false
cosmopolitan/third_party/regex/tre.inc
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│ │vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│ ╚─────────────────────────────────────────────────â”...
11,107
249
jart/cosmopolitan
false
cosmopolitan/third_party/intel/fxsrintrin.internal.h
#if !defined _IMMINTRIN_H_INCLUDED #error "Never use <fxsrintrin.h> directly; include <immintrin.h> instead." #endif #ifndef _FXSRINTRIN_H_INCLUDED #define _FXSRINTRIN_H_INCLUDED #ifndef __FXSR__ #pragma GCC push_options #pragma GCC target("fxsr") #define __DISABLE_FXSR__ #endif /* __FXSR__ */ __funline void _fxsave...
750
38
jart/cosmopolitan
false
cosmopolitan/third_party/intel/xsaveoptintrin.internal.h
#if !defined _IMMINTRIN_H_INCLUDED #error "Never use <xsaveoptintrin.h> directly; include <immintrin.h> instead." #endif #ifndef _XSAVEOPTINTRIN_H_INCLUDED #define _XSAVEOPTINTRIN_H_INCLUDED #ifndef __XSAVEOPT__ #pragma GCC push_options #pragma GCC target("xsaveopt") #define __DISABLE_XSAVEOPT__ #endif /* __XSAVEOPT_...
696
30
jart/cosmopolitan
false
cosmopolitan/third_party/intel/bmiintrin.internal.h
#if !defined _X86INTRIN_H_INCLUDED && !defined _IMMINTRIN_H_INCLUDED #error "Never use <bmiintrin.h> directly; include <x86intrin.h> instead." #endif #ifndef _BMIINTRIN_H_INCLUDED #define _BMIINTRIN_H_INCLUDED #ifndef __BMI__ #pragma GCC push_options #pragma GCC target("bmi") #define __DISABLE_BMI__ #endif /* __BMI__...
4,767
161
jart/cosmopolitan
false
cosmopolitan/third_party/intel/lwpintrin.internal.h
#ifndef _X86INTRIN_H_INCLUDED #error "Never use <lwpintrin.h> directly; include <x86intrin.h> instead." #endif #ifndef _LWPINTRIN_H_INCLUDED #define _LWPINTRIN_H_INCLUDED #ifndef __LWP__ #pragma GCC push_options #pragma GCC target("lwp") #define __DISABLE_LWP__ #endif /* __LWP__ */ __funline void __llwpcb(void *__pc...
2,271
74
jart/cosmopolitan
false
cosmopolitan/third_party/intel/avx512erintrin.internal.h
#ifndef _IMMINTRIN_H_INCLUDED #error "Never use <avx512erintrin.h> directly; include <immintrin.h> instead." #endif #ifndef _AVX512ERINTRIN_H_INCLUDED #define _AVX512ERINTRIN_H_INCLUDED #ifndef __AVX512ER__ #pragma GCC push_options #pragma GCC target("avx512er") #define __DISABLE_AVX512ER__ #endif /* __AVX512ER__ */ ...
10,350
282
jart/cosmopolitan
false
cosmopolitan/third_party/intel/avx512vldqintrin.internal.h
#ifndef _IMMINTRIN_H_INCLUDED #error "Never use <avx512vldqintrin.h> directly; include <immintrin.h> instead." #endif #ifndef _AVX512VLDQINTRIN_H_INCLUDED #define _AVX512VLDQINTRIN_H_INCLUDED #if !defined(__AVX512VL__) || !defined(__AVX512DQ__) #pragma GCC push_options #pragma GCC target("avx512vl,avx512dq") #define ...
48,770
1,160
jart/cosmopolitan
false
cosmopolitan/third_party/intel/emmintrin.internal.h
#ifndef _EMMINTRIN_H_INCLUDED #define _EMMINTRIN_H_INCLUDED #ifdef __x86_64__ #include "third_party/intel/xmmintrin.internal.h" #ifndef __SSE2__ #pragma GCC push_options #pragma GCC target("sse2") #define __DISABLE_SSE2__ #endif /* __SSE2__ */ typedef double __v2df __attribute__((__vector_size__(16))); typedef long l...
31,151
1,039
jart/cosmopolitan
false
cosmopolitan/third_party/intel/avx512vbmi2intrin.internal.h
#ifndef _IMMINTRIN_H_INCLUDED #error \ "Never use <avx512vbmi2intrin.h> directly; include <immintrin.h> instead." #endif #ifndef __AVX512VBMI2INTRIN_H_INCLUDED #define __AVX512VBMI2INTRIN_H_INCLUDED #if !defined(__AVX512VBMI2__) #pragma GCC push_options #pragma GCC target("avx512vbmi2") #define __DISABLE_AVX512VB...
16,951
382
jart/cosmopolitan
false
cosmopolitan/third_party/intel/adxintrin.internal.h
#if !defined _IMMINTRIN_H_INCLUDED #error "Never use <adxintrin.h> directly; include <immintrin.h> instead." #endif #ifndef _ADXINTRIN_H_INCLUDED #define _ADXINTRIN_H_INCLUDED __funline unsigned char _subborrow_u32(unsigned char __CF, unsigned int __X, unsigned int __Y, unsigned i...
1,682
44
jart/cosmopolitan
false
cosmopolitan/third_party/intel/intel.mk
#-*-mode:makefile-gmake;indent-tabs-mode:t;tab-width:8;coding:utf-8-*-┐ #───vi: set et ft=make ts=8 tw=8 fenc=utf-8 :vi───────────────────────┘ PKGS += THIRD_PARTY_INTEL THIRD_PARTY_INTEL_HDRS = $(filter %.h,$(THIRD_PARTY_INTEL_FILES)) THIRD_PARTY_INTEL_FILES := ...
352
7
jart/cosmopolitan
false