Improve redbean plus code size optimizations

This change turns symbol table compression back on using Puff, which
noticeably reduces the size of programs like redbean and Python. The
redbean web server receives some minor API additions for controlling
things like SSL in addition to filling gaps in the documentation.
This commit is contained in:
Justine Tunney 2022-05-29 08:14:55 -07:00
parent 425ff5dff0
commit 13ee75150c
58 changed files with 2077 additions and 589 deletions

79
net/http/kescapepath.S Normal file
View file

@ -0,0 +1,79 @@
#include "libc/macros.internal.h"
// generated by:
// o//tool/build/xlat.com -DUL '.-~_@:!$&'"'"'()*+,;=/' -iskEscapePath
//
// present absent
//
// 0x00
// § 0x10
// # % ! § &()*+,-./ 0x20
// < > 0123456789:; = 0x30
// @ABCDEFGHIJKLMNO 0x40
// []^ PQRSTUVWXYZ _ 0x50
// ` abcdefghijklmno 0x60
// {|} pqrstuvwxyz ~ 0x70
// ÇüéâäàåçêëèïîìÄÅ 0x80
// ÉæÆôöòûùÿÖÜ¢£¥ƒ 0x90
// áíóúñѪº¿¬½¼¡«» 0xa0
// 0xb0
// 0xc0
// 0xd0
// αßΓπΣσμτΦΘΩδφε 0xe0
// ±÷°×²λ 0xf0
//
// const char kEscapePath[256] = {
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x00
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x10
// 1, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x20
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, // 0x30
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x40
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, // 0x50
// 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0x60
// 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, // 0x70
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x80
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0x90
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xa0
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xb0
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xc0
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xd0
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xe0
// 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 0xf0
// };
.initbss 300,_init_kEscapePath
kEscapePath:
.zero 256
.endobj kEscapePath,globl
.previous
.initro 300,_init_kEscapePath
kEscapePath.rom:
.byte 33,1 # 00-20 -
.byte 1,0 # 21-21 !-!
.byte 2,1 # 22-23 -#
.byte 1,0 # 24-24 §-§
.byte 1,1 # 25-25 %-%
.byte 22,0 # 26-3b &-;
.byte 1,1 # 3c-3c <-<
.byte 1,0 # 3d-3d =-=
.byte 2,1 # 3e-3f >-
.byte 27,0 # 40-5a @-Z
.byte 4,1 # 5b-5e [-^
.byte 1,0 # 5f-5f _-_
.byte 1,1 # 60-60 `-`
.byte 26,0 # 61-7a a-z
.byte 3,1 # 7b-7d {-}
.byte 1,0 # 7e-7e ~-~
.byte 129,1 # 7f-ff -λ
.byte 0,0 # terminator
.byte 0,0 # padding
.byte 0,0 # padding
.endobj kEscapePath.rom,globl
.init.start 300,_init_kEscapePath
call rldecode
lodsl
.init.end 300,_init_kEscapePath
// 46 bytes total (18% original size)