Make improvements
- Emulator can now test the αcτµαlly pδrταblε εxεcµταblε bootloader - Whipped up a webserver named redbean. It services 150k requests per second on a single core. Bundling assets inside zip enables extremely fast serving for two reasons. The first is that zip central directory lookups go faster than stat() system calls. The second is that both zip and gzip content-encoding use DEFLATE, therefore, compressed responses can be served via the sendfile() system call which does an in-kernel copy directly from the zip executable structure. Also note that red bean zip executables can be deployed easily to all platforms, since these native executables work on Linux, Mac, BSD, and Windows. - Address sanitizer now works very well
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
│ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA │
|
||||
│ 02110-1301 USA │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "ape/lib/pc.h"
|
||||
#include "libc/macros.h"
|
||||
.source __FILE__
|
||||
|
||||
@ -29,7 +30,7 @@ tinymath_copysignl:
|
||||
fnstsw
|
||||
fstp %st
|
||||
fldt 16(%rbp)
|
||||
testb $2,%ah
|
||||
test $FPU_C1>>8,%ah
|
||||
fabs
|
||||
je 1f
|
||||
fchs
|
||||
|
||||
@ -26,22 +26,14 @@ tinymath_lroundl:
|
||||
mov %rsp,%rbp
|
||||
.profilable
|
||||
push %rax
|
||||
push %rax
|
||||
fldt 16(%rbp)
|
||||
fnstcw -8(%rbp)
|
||||
movzwl -8(%rbp),%edx
|
||||
and $0b11110011,%dh # RC (Rounding Control)
|
||||
or $0b00000100,%dh # →-∞
|
||||
mov %dx,-4(%rbp)
|
||||
fxam
|
||||
fnstsw
|
||||
fabs
|
||||
test $FPU_C1>>8,%ah
|
||||
fadds .Lhalf(%rip)
|
||||
fldcw -4(%rbp)
|
||||
fistpq -16(%rbp)
|
||||
fldcw -8(%rbp)
|
||||
mov -16(%rbp),%rax
|
||||
fisttpq -8(%rbp)
|
||||
mov -8(%rbp),%rax
|
||||
je 1f
|
||||
neg %rax
|
||||
1: leave
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
/
|
||||
/ @param 𝑥 is double scalar in low half of %xmm0
|
||||
/ @return double scalar in low half of %xmm0
|
||||
/ @define round(𝑥) = copysign(floor(fabs(𝑥)+.5),𝑥)
|
||||
/ @define round(𝑥) = copysign(trunc(fabs(𝑥)+.5),𝑥)
|
||||
/ round(𝑥) = trunc(𝑥+copysign(.5,𝑥))
|
||||
tinymath_round:
|
||||
#if !X86_NEED(SSE4_2)
|
||||
|
||||
@ -30,19 +30,17 @@ tinymath_roundl:
|
||||
.profilable
|
||||
push %rax
|
||||
fldt 16(%rbp)
|
||||
fnstcw -6(%rbp)
|
||||
fnstcw -8(%rbp)
|
||||
movzwl -8(%rbp),%edx
|
||||
and $0b11110011,%dh # RC (Rounding Control)
|
||||
or $0b00000100,%dh # →-∞ a.k.a. floor()
|
||||
mov %dx,-4(%rbp)
|
||||
orb $0b00001100,-7(%rbp) # RC = →0
|
||||
fxam # C1 is set to sign bit
|
||||
fnstsw
|
||||
fabs
|
||||
test $FPU_C1>>8,%ah
|
||||
fadds .Lhalf(%rip)
|
||||
fldcw -4(%rbp)
|
||||
frndint
|
||||
fldcw -8(%rbp)
|
||||
frndint
|
||||
fldcw -6(%rbp)
|
||||
je 1f
|
||||
fchs
|
||||
1: leave
|
||||
|
||||
Reference in New Issue
Block a user