Introduce MODE=fastbuild for 28% speedup

This commit is contained in:
Justine Tunney 2022-09-09 08:59:59 -07:00
parent 094ccbb4bd
commit 1729a8259c
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
14 changed files with 82 additions and 111 deletions

View file

@ -1,24 +0,0 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi
Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the
above copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
.privileged
_spinlock_yield:
jmp sched_yield
.endfn _spinlock_yield,globl

View file

@ -27,7 +27,10 @@
* This function does not need to issue a system call. The PID is
* tracked by a global variable which is updated at fork(). The only
* exception is when the process is vfork()'d in which case a system
* call shall be issued.
* call shall be issued. This optimization helps make functions like
* rand64() fork-safe, however it could lead to race conditions in
* programs that mix fork() with threads. In that case, apps should
* consider using `sys_getpid().ax` instead to force a system call.
*
* On Linux, and only Linux, the process id is guaranteed to be the same
* as gettid() for the main thread.

View file

@ -21,13 +21,13 @@
.macro .e e s
.long \e - kClockNames
.long 1f - kClockNames
.long .L\@ - kClockNames
.rodata.str1.1
1: .string "\s"
.L\@: .string "\s"
.previous
.endm
.section .rodata
.section .rodata,"a",@progbits
.align 4
.underrun
kClockNames:

View file

@ -28,6 +28,7 @@
.endm
.section .rodata,"a",@progbits
.align 4
.underrun
kDos2Errno:
// .e kNtErrorInvalidFunction,ENOSYS # in consts.sh

View file

@ -21,9 +21,9 @@
.macro .e e s
.long \e - kErrnoDocs
.long 1f - kErrnoDocs
.long .L\@ - kErrnoDocs
.rodata.str1.1
1: .asciz "\s"
.L\@: .asciz "\s"
.previous
.endm

View file

@ -21,9 +21,9 @@
.macro .e e
.long \e - kErrnoNames
.long 1f - kErrnoNames
.long .L\@ - kErrnoNames
.rodata.str1.1
1: .string "\e"
.L\@: .string "\e"
.previous
.endm

View file

@ -21,9 +21,9 @@
.macro .e e s
.long \e - kIpOptnames
.long 1f - kIpOptnames
.long .L\@ - kIpOptnames
.rodata.str1.1
1: .string "\s"
.L\@: .string "\s"
.previous
.endm

View file

@ -21,9 +21,9 @@
.macro .e e s
.long \e - kOpenFlags
.long 1f - kOpenFlags
.long .L\@ - kOpenFlags
.rodata.str1.1
1: .string "\s"
.L\@: .string "\s"
.previous
.endm

View file

@ -21,14 +21,14 @@
.macro .e e s
.long \e - kRlimitNames
.long 1f - kRlimitNames
.long .L\@ - kRlimitNames
.rodata.str1.1
1: .string "\s"
.L\@: .string "\s"
.previous
.endm
.section .rodata
.align 4
.align 4
.underrun
kRlimitNames:
.e RLIMIT_AS,"AS"

View file

@ -21,14 +21,14 @@
.macro .e e s
.long \e - kSignalNames
.long 1f - kSignalNames
.long .L\@ - kSignalNames
.rodata.str1.1
1: .string "\s"
.L\@: .string "\s"
.previous
.endm
.section .rodata
.align 4
.align 4
.underrun
kSignalNames:
.e SIGHUP,"SIGHUP"

View file

@ -21,14 +21,14 @@
.macro .e e s
.long \e - kSockOptnames
.long 1f - kSockOptnames
.long .L\@ - kSockOptnames
.rodata.str1.1
1: .string "\s"
.L\@: .string "\s"
.previous
.endm
.section .rodata
.align 4
.align 4
.underrun
kSockOptnames:
.e SO_DEBUG,"DEBUG" # bool32

View file

@ -21,9 +21,9 @@
.macro .e e s
.long \e - kTcpOptnames
.long 1f - kTcpOptnames
.long .L\@ - kTcpOptnames
.rodata.str1.1
1: .string "\s"
.L\@: .string "\s"
.previous
.endm

View file

@ -174,7 +174,8 @@ int pthread_barrier_init(pthread_barrier_t *, const pthread_barrierattr_t *,
#define pthread_spin_init(pSpin, multiprocess) ((pSpin)->lock = 0, 0)
#define pthread_spin_destroy(pSpin) ((pSpin)->lock = -1, 0)
#if (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 407
#if (__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 407 && \
!defined(__STRICT_ANSI__)
extern const errno_t EBUSY;
#define pthread_spin_lock(pSpin) \
({ \