File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -26,16 +26,15 @@ static void wl(ulong x){ //debug-only
2626 int i = 31 ;while (x ){s [-- i ]= '0' + (x %10 );x /=10 ;}
2727 swrite (1 ,s + i ,32 - i );}
2828
29- extern char _end [];
30- #define M_ _end
29+ static char * M_ ;
3130#define I_ ((int*)M_)
3231#define U_ ((ulong*)M_)
3332static void * F_ []; //dispatch table
3433#define int32_t int //some literals
3534static ulong pages_ = 0 ;
3635static int Memorysize (void ){return pages_ ;}
37- static int Memorygrow (int d ){pages_ += d ;if (pages_ > 16384 )return -1 ;brk ((pages_ <<16 )+ (ulong )_end );return pages_ - d ;}
38- static void Memory (int x ){Memorygrow ( x ); wl ( brk (0 )- ( long ) _end );}
36+ static int Memorygrow (int d ){pages_ += d ;if (pages_ > 16384 )return -1 ;brk ((pages_ <<16 )+ (ulong )M_ );return pages_ - d ;}
37+ static void Memory (int x ){M_ = ( char * ) brk (0 ); Memorygrow ( x );}
3938static void Memory2 (int x ){}
4039
4140//todo try/catch
Original file line number Diff line number Diff line change @@ -22,9 +22,8 @@ elif [ "$1" = "ctest" ]; then
2222 ./kc ../k.t -e
2323elif [ "$1" = "l8" ]; then
2424 k k.k cc.k -e 'x:`<cc``l8' > k.c
25- gcc -Os -s -nostdlib -static -fomit-frame-pointer -Wl,--nmagic -Wl,--build-id=none -fno-asynchronous-unwind-tables -ol8 k.c
26- #gcc -Wall -Wfatal-errors -Os -s -nostdlib -static -Wl,--nmagic -Wl,--build-id=none -fno-asynchronous-unwind-tables -ol8 k.c
27- #gcc -Wall -Wfatal-errors -nostdlib -static -ol8 k.c -lm
25+ gcc -Os -s -nostdlib -static -Wl,--nmagic -Wl,--build-id=none -fno-asynchronous-unwind-tables -ol8_ k.c
26+ objcopy --remove-section .comment l8_ l8
2827elif [ "$1" = "wa" ]; then
2928 k k.k wa.k -e 'x:`<wa``' > k.wa
3029 /c/local/wabt/wat2wasm k.wa
You can’t perform that action at this time.
0 commit comments