Pay off more technical debt

This makes breaking changes to add underscores to many non-standard
function names provided by the c library. MODE=tiny is now tinier and
we now use smaller locks that are better for tiny apps in this mode.
Some headers have been renamed to be in the same folder as the build
package, so it'll be easier to know which build dependency is needed.
Certain old misguided interfaces have been removed. Intel intrinsics
headers are now listed in libc/isystem (but not in the amalgamation)
to help further improve open source compatibility. Header complexity
has also been reduced. Lastly, more shell scripts are now available.

Compared to 6f7d0cb1c3, some tiny corrections were made in libc/intrin/g_fds.c and libc/zipos/open.c including double semi colons and incorrect indentation for existing vista changes that were manually pulled from this commit previously.
This commit is contained in:
Justine Tunney 2022-09-12 23:10:38 -07:00 committed by Gavin Hayes
parent 555260d2e5
commit 7b26b42769
959 changed files with 4065 additions and 4868 deletions

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/intrin/bsf.h"
#include "libc/intrin/popcnt.h"
#include "libc/limits.h"
#include "libc/log/check.h"
@ -24,7 +25,6 @@
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/bsf.h"
#include "libc/str/str.h"
#include "tool/plinko/lib/cons.h"
#include "tool/plinko/lib/gc.h"
@ -93,7 +93,7 @@ int Census(struct Gc *G) {
if (!~G->M[j]) {
l += DWBITS;
} else {
l += bsfl(~G->M[j]);
l += _bsfl(~G->M[j]);
break;
}
}
@ -124,7 +124,7 @@ void Sweep(struct Gc *G) {
for (; i < G->n; ++i) {
m = G->M[i];
if (~m) {
j = bsfl(~m);
j = _bsfl(~m);
m >>= j;
m <<= j;
d -= j;
@ -136,7 +136,7 @@ void Sweep(struct Gc *G) {
}
for (; i < G->n; b -= DWBITS, m = G->M[++i]) {
for (; m; m &= ~((dword)1 << j)) {
a = b + ~(j = bsfl(m));
a = b + ~(j = _bsfl(m));
Set(--d, MAKE(Relocate(G, LO(Get(a))), Relocate(G, HI(Get(a)))));
SetShadow(d, MAKE(LO(GetShadow(a)), Relocate(G, HI(GetShadow(a)))));
}

View file

@ -1,14 +1,14 @@
#ifndef COSMOPOLITAN_TOOL_PLINKO_LIB_HISTO_H_
#define COSMOPOLITAN_TOOL_PLINKO_LIB_HISTO_H_
#include "libc/intrin/bsr.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/bsr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
#define HISTO(H, X) \
do { \
uint64_t x_ = X; \
x_ = x_ ? bsrl(x_) + 1 : x_; \
x_ = x_ ? _bsrl(x_) + 1 : x_; \
++H[MIN(x_, ARRAYLEN(H) - 1)]; \
} while (0)

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/calls/strace.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/errno.h"
#include "libc/intrin/likely.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/nexgen32e/bsr.h"
#include "libc/intrin/bsr.h"
#include "tool/plinko/lib/char.h"
#include "tool/plinko/lib/ktpenc.h"
#include "tool/plinko/lib/plinko.h"
@ -31,7 +31,7 @@ int PrintChar(int fd, int s) {
if (c == L'\n') Flush(fd);
} else {
d = c;
e = kTpEnc[bsrl(d) - 7];
e = kTpEnc[_bsrl(d) - 7];
i = n = e & 255;
do g_buffer[fd][bp[fd] + i--] = 0200 | (d & 077);
while (d >>= 6, i);

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/strace.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/nexgen32e/rdtsc.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"

View file

@ -40,7 +40,7 @@ static const char *GetElfSymbol(uintptr_t funcaddr) {
static const char *GetDispatchName(int x) {
const char *s;
s = GetElfSymbol(LO(GetShadow(x)));
if (startswith(s, "Dispatch")) s += 8;
if (_startswith(s, "Dispatch")) s += 8;
return s;
}

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/calls/strace.internal.h"
#include "libc/intrin/strace.internal.h"
#include "libc/errno.h"
#include "libc/log/check.h"
#include "libc/runtime/runtime.h"