mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-30 17:22:27 +00:00
Rewrite ZipOS
This reduces the virtual memory usage of Emacs for me by 30%. We now have a simpler implementation that uses read(), rather mmap()ing the whole executable.
This commit is contained in:
parent
ff77f2a6af
commit
b01282e23e
21 changed files with 408 additions and 421 deletions
|
@ -28,9 +28,14 @@
|
|||
#include "libc/sysv/consts/rlim.h"
|
||||
#include "libc/sysv/consts/rlimit.h"
|
||||
|
||||
// Hack for guessing boundaries of _start()'s stack
|
||||
// Hack for guessing the unknowable boundaries of _start()'s stack
|
||||
//
|
||||
// Every UNIX system in our support vector creates arg blocks like:
|
||||
// This code always guesses correctly on Windows because WinMain()
|
||||
// is written to allocate a stack ourself. Local testing on Linux,
|
||||
// XNU, FreeBSD, OpenBSD, and NetBSD says that accuracy is ±1 page
|
||||
// and that error rate applies to both beginning and end addresses
|
||||
//
|
||||
// Every UNIX system in our support vector creates arg blocks like
|
||||
//
|
||||
// <HIGHEST-STACK-ADDRESS>
|
||||
// last environ string
|
||||
|
@ -55,11 +60,6 @@
|
|||
// up to the microprocessor page size (this computes the top addr)
|
||||
// and the bottom is computed by subtracting RLIMIT_STACK rlim_cur
|
||||
// It's simple but gets tricky if we consider environ can be empty
|
||||
//
|
||||
// This code always guesses correctly on Windows because WinMain()
|
||||
// is written to allocate a stack ourself. Local testing on Linux,
|
||||
// XNU, FreeBSD, OpenBSD, and NetBSD says that accuracy is ±1 page
|
||||
// and that error rate applies to both beginning and end addresses
|
||||
|
||||
static char *__get_last(char **list) {
|
||||
char *res = 0;
|
||||
|
|
|
@ -135,7 +135,6 @@ __msabi extern typeof(WriteFile) *const __imp_WriteFile;
|
|||
// clang-format on
|
||||
|
||||
long __klog_handle;
|
||||
extern struct SymbolTable *__symtab;
|
||||
|
||||
__funline char *kadvance(char *p, char *e, long n) {
|
||||
intptr_t t = (intptr_t)p;
|
||||
|
@ -755,11 +754,11 @@ privileged static size_t kformat(char *b, size_t n, const char *fmt,
|
|||
// can be manually consulted to look up the faulting code.
|
||||
int idx;
|
||||
x = va_arg(va, intptr_t);
|
||||
if (_weaken(__symtab) && *_weaken(__symtab) &&
|
||||
if (_weaken(__symtab) && _weaken(__symtab)->st &&
|
||||
(idx = _weaken(__get_symbol)(0, x)) != -1) {
|
||||
if (p + 1 <= e) *p++ = '&';
|
||||
s = (*_weaken(__symtab))->name_base +
|
||||
(*_weaken(__symtab))->names[idx];
|
||||
s = _weaken(__symtab)->st->name_base +
|
||||
_weaken(__symtab)->st->names[idx];
|
||||
goto FormatString;
|
||||
}
|
||||
base = 4;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue