diff options
Diffstat (limited to 'patches/sauer')
-rw-r--r-- | patches/sauer | 443 |
1 files changed, 0 insertions, 443 deletions
diff --git a/patches/sauer b/patches/sauer deleted file mode 100644 index ce846e85..00000000 --- a/patches/sauer +++ /dev/null @@ -1,443 +0,0 @@ -diff --git a/patches/README b/patches/README ---- a/patches/README -+++ b/patches/README -@@ -4,7 +4,7 @@ - - ln -s patches .hg/patches - --After doing so, |hg qpush| sauer, and then running |python tests/runner.py| will run only sauer, using v8, and without optimizations or relooping. -+After doing so, |hg qpush| sauer, and then running |python tests/runner.py| will run only sauer, using v8, and without relooping. - - Note to patch queue maintainer: You need to manually copy from .hg/patches into this directory, after |qrefresh|ing the patch. - -diff --git a/src/settings.js b/src/settings.js ---- a/src/settings.js -+++ b/src/settings.js -@@ -1,5 +1,5 @@ - OPTIMIZE = 1; --RELOOP = 1; --SAFE_HEAP = 0; -+RELOOP = 0; -+SAFE_HEAP = 1; - LABEL_DEBUG = 0; - -diff --git a/tests/runner.py b/tests/runner.py ---- a/tests/runner.py -+++ b/tests/runner.py -@@ -85,6 +85,7 @@ - if output is not None and 'Traceback' in output: print output; assert (0) # 'generating JavaScript failed' - if DEBUG: print "\nGenerated JavaScript:\n\n===\n\n%s\n\n===\n\n" % output - # if not DEBUG: -+ raise Exception("Moshe"); - js_output = timeout_run(Popen([JS_ENGINE] + JS_ENGINE_OPTS + [filename + '.o.js'] + args, stdout=PIPE, stderr=STDOUT), 20, 'Execution') - if output_nicerizer is not None: - js_output = output_nicerizer(js_output) -@@ -148,7 +149,7 @@ - print "Expected to NOT find '%s' in '%s'" % (value, string) - self.assertTrue(value not in string) - -- def test_hello_world(self): -+ def zzztest_hello_world(self): - src = ''' - #include <stdio.h> - int main() -@@ -159,7 +160,7 @@ - ''' - self.do_test(src, 'hello, world!') - -- def test_intvars(self): -+ def zzztest_intvars(self): - src = ''' - #include <stdio.h> - int global = 20; -@@ -188,7 +189,7 @@ - ''' - self.do_test(src, '*5,23,10,19,121,1,37,1,0*') - -- def test_floatvars(self): -+ def zzztest_floatvars(self): - src = ''' - #include <stdio.h> - int main() -@@ -202,7 +203,7 @@ - ''' - self.do_test(src, '*1,10,10.5,1,1.2339') - -- def test_if(self): -+ def zzztest_if(self): - src = ''' - #include <stdio.h> - int main() -@@ -216,7 +217,7 @@ - ''' - self.do_test(src, '*yes*') - -- def test_loop(self): -+ def zzztest_loop(self): - src = ''' - #include <stdio.h> - int main() -@@ -230,7 +231,7 @@ - ''' - self.do_test(src, '*3600*') - -- def test_strings(self): -+ def zzztest_strings(self): - src = ''' - #include <stdio.h> - #include <stdlib.h> -@@ -245,7 +246,7 @@ - ''' - self.do_test(src, '*4*wowie*too*76*', ['wowie', 'too', '74'], lambda x: x.replace('\n', '*')) - -- def test_funcs(self): -+ def zzztest_funcs(self): - src = ''' - #include <stdio.h> - int funcy(int x) -@@ -260,7 +261,7 @@ - ''' - self.do_test(src, '*72,90*') - -- def test_structs(self): -+ def zzztest_structs(self): - src = ''' - #include <stdio.h> - struct S -@@ -304,13 +305,13 @@ - } - ''' - -- def test_mallocstruct(self): -+ def zzztest_mallocstruct(self): - self.do_test(self.gen_struct_src.replace('{{gen_struct}}', '(S*)malloc(ES_SIZEOF(S))').replace('{{del_struct}}', 'free'), '*51,62*') - -- def test_newstruct(self): -+ def zzztest_newstruct(self): - self.do_test(self.gen_struct_src.replace('{{gen_struct}}', 'new S').replace('{{del_struct}}', 'delete'), '*51,62*') - -- def test_addr_of_stacked(self): -+ def zzztest_addr_of_stacked(self): - src = ''' - #include <stdio.h> - void alter(int *y) -@@ -327,7 +328,7 @@ - ''' - self.do_test(src, '*7*') - -- def test_linked_list(self): -+ def zzztest_linked_list(self): - src = ''' - #include <stdio.h> - struct worker_args { -@@ -372,7 +373,7 @@ - ''' - self.do_test(src, '*1410,0*') - -- def test_assert(self): -+ def zzztest_assert(self): - src = ''' - #include <stdio.h> - #include <assert.h> -@@ -384,7 +385,7 @@ - ''' - self.do_test(src, 'Assertion failed: 1 == false') - -- def test_class(self): -+ def zzztest_class(self): - src = ''' - #include <stdio.h> - struct Random { -@@ -413,7 +414,7 @@ - ''' - self.do_test(src, '*0*') - -- def test_inherit(self): -+ def zzztest_inherit(self): - src = ''' - #include <stdio.h> - struct Parent { -@@ -441,7 +442,7 @@ - ''' - self.do_test(src, '*51,87,78,550,100,78,550*') - -- def test_polymorph(self): -+ def zzztest_polymorph(self): - src = ''' - #include <stdio.h> - struct Parent { -@@ -460,7 +461,7 @@ - ''' - self.do_test(src, '*11,74*') - -- def test_emptyclass(self): -+ def zzztest_emptyclass(self): - src = ''' - #include <stdio.h> - -@@ -501,7 +502,7 @@ - ''' - self.do_test(src, '*97,15,3*') - -- def test_conststructs(self): -+ def zzztest_conststructs(self): - src = ''' - #include <stdio.h> - struct IUB { -@@ -524,7 +525,7 @@ - ''' - self.do_test(src, '*97,15,3,3029*') - -- def test_ptrtoint(self): -+ def zzztest_ptrtoint(self): - src = ''' - #include <stdio.h> - -@@ -546,7 +547,7 @@ - runner.assertEquals(filter(lambda line: 'Warning' in line, output.split('\n')).__len__(), 4) - self.do_test(src, '*5*', output_processor=check_warnings) - -- def test_sizeof(self): -+ def zzztest_sizeof(self): - src = ''' - #include <stdio.h> - #include <string.h> -@@ -582,7 +583,7 @@ - ''' - self.do_test(src, '*2,2,5,8,8*\n*8,8,5,8,8*\n*7,2,6,990,7,2*') - -- def test_llvmswitch(self): -+ def zzztest_llvmswitch(self): - src = ''' - #include <stdio.h> - #include <string.h> -@@ -607,7 +608,7 @@ - ''' - self.do_test(src, '*96,97,98,101,101*') - -- def test_varargs(self): -+ def zzztest_varargs(self): - src = ''' - #include <stdio.h> - #include "stdarg.h" -@@ -629,7 +630,7 @@ - ''' - self.do_test(src, '*cheez: 10+24*') - -- def test_atexit(self): -+ def zzztest_atexit(self): - src = ''' - #include <stdio.h> - #include <stdlib.h> -@@ -646,13 +647,13 @@ - ''' - self.do_test(src, '*cleaned*') - -- def test_fannkuch(self): -+ def zzztest_fannkuch(self): - results = [ (1,0), (2,1), (3,2), (4,4), (5,7), (6,10), (7, 16), (8,22) ] - for i, j in results: - src = open(path_from_root(['tests', 'fannkuch.cpp']), 'r').read() - self.do_test(src, 'Pfannkuchen(%d) = %d.' % (i,j), [str(i)], no_build=i>1) - -- def test_fasta(self): -+ def zzztest_fasta(self): - results = [ (1,'''GG*ctt**tgagc**'''), (20,'''GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTT*cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg**tacgtgtagcctagtgtttgtgttgcgttatagtctatttgtggacacagtatggtcaaa**tgacgtcttttgatctgacggcgttaacaaagatactctg**'''), - (50,'''GGCCGGGCGCGGTGGCTCACGCCTGTAATCCCAGCACTTTGGGAGGCCGAGGCGGGCGGA*TCACCTGAGGTCAGGAGTTCGAGACCAGCCTGGCCAACAT*cttBtatcatatgctaKggNcataaaSatgtaaaDcDRtBggDtctttataattcBgtcg**tactDtDagcctatttSVHtHttKtgtHMaSattgWaHKHttttagacatWatgtRgaaa**NtactMcSMtYtcMgRtacttctWBacgaa**agatactctgggcaacacacatacttctctcatgttgtttcttcggacctttcataacct**ttcctggcacatggttagctgcacatcacaggattgtaagggtctagtggttcagtgagc**ggaatatcattcgtcggtggtgttaatctatctcggtgtagcttataaatgcatccgtaa**gaatattatgtttatttgtcggtacgttcatggtagtggtgtcgccgatttagacgtaaa**ggcatgtatg**''') ] - for i, j in results: -@@ -661,7 +662,7 @@ - - # XXX Warning: Running this in SpiderMonkey can lead to an extreme amount of memory being - # used, see Mozilla bug 593659. -- def zzztest_sauer(self): -+ def test_sauer(self): - self.do_test(path_from_root(['tests', 'sauer']), 'Hello sauer world!', main_file='command.cpp') - - if __name__ == '__main__': -diff --git a/tests/sauer/command.cpp b/tests/sauer/command.cpp ---- a/tests/sauer/command.cpp -+++ b/tests/sauer/command.cpp -@@ -1,6 +1,8 @@ - // command.cpp: implements the parsing and execution of a tiny script language which - // is largely backwards compatible with the quake console language. - -+// XXX Emscripten: changed all sizeof to ES_SIZEOF -+ - // XXX Emscripten - #define STANDALONE - -@@ -1312,7 +1314,7 @@ - void conoutfv(int type, const char *fmt, va_list args) - { - static char buf[CONSTRLEN]; -- vformatstring(buf, fmt, args, sizeof(buf)); -+ vformatstring(buf, fmt, args, ES_SIZEOF(char)*CONSTRLEN); // XXX Emscripten? - conline(type, buf); - //filtertext(buf, buf); // XXX Emscripten - puts(buf); -@@ -1404,6 +1406,11 @@ - { - execute("echo Hello from sauer"); - -+ ident moshe, david; -+ printf("cheezme1 %d,%d\n", int(&moshe), int(&(moshe.type))); -+ moshe = david; -+ printf("cheezme2\n"); -+ - return 0; - } - -diff --git a/tests/sauer/command.h b/tests/sauer/command.h ---- a/tests/sauer/command.h -+++ b/tests/sauer/command.h -@@ -84,7 +84,7 @@ - - virtual ~ident() {} - -- ident &operator=(const ident &o) { memcpy(this, &o, sizeof(ident)); return *this; } // force vtable copy, ugh -+ ident &operator=(const ident &o) { memcpy(this, &o, ES_SIZEOF(ident)); return *this; } // force vtable copy, ugh - - virtual void changed() { if(fun) fun(); } - }; -diff --git a/tests/sauer/tools.h b/tests/sauer/tools.h ---- a/tests/sauer/tools.h -+++ b/tests/sauer/tools.h -@@ -3,6 +3,8 @@ - #ifndef _TOOLS_H - #define _TOOLS_H - -+#include "emscripten.h" // XXX Emscripten -+ - #ifdef NULL - #undef NULL - #endif -@@ -173,7 +175,7 @@ - void put(const T *vals, int numvals) - { - if(maxlen-len<numvals) flags |= OVERWROTE; -- memcpy(&buf[len], vals, min(maxlen-len, numvals)*sizeof(T)); -+ memcpy(&buf[len], vals, min(maxlen-len, numvals)*ES_SIZEOF(T)); - len += min(maxlen-len, numvals); - } - -@@ -181,7 +183,7 @@ - { - int read = min(maxlen-len, numvals); - if(read<numvals) flags |= OVERREAD; -- memcpy(vals, &buf[len], read*sizeof(T)); -+ memcpy(vals, &buf[len], read*ES_SIZEOF(T)); - len += read; - return read; - } -@@ -207,7 +209,7 @@ - template<class T, class U> - static inline void quicksort(T *buf, int n, int (__cdecl *func)(U *, U *)) - { -- qsort(buf, n, sizeof(T), (int (__cdecl *)(const void *,const void *))func); -+ qsort(buf, n, ES_SIZEOF(T), (int (__cdecl *)(const void *,const void *))func); - } - - template <class T> struct vector -@@ -268,7 +270,7 @@ - else - { - growbuf(ulen+v.ulen); -- if(v.ulen) memcpy(&buf[ulen], v.buf, v.ulen*sizeof(T)); -+ if(v.ulen) memcpy(&buf[ulen], v.buf, v.ulen*ES_SIZEOF(T)); - ulen += v.ulen; - v.ulen = 0; - } -@@ -309,10 +311,10 @@ - if(!alen) alen = max(MINSIZE, sz); - else while(alen < sz) alen *= 2; - if(alen <= olen) return; -- uchar *newbuf = new uchar[alen*sizeof(T)]; -+ uchar *newbuf = new uchar[alen*ES_SIZEOF(T)]; - if(olen > 0) - { -- memcpy(newbuf, buf, olen*sizeof(T)); -+ memcpy(newbuf, buf, olen*ES_SIZEOF(T)); - delete[] (uchar *)buf; - } - buf = (T *)newbuf; -@@ -515,6 +517,7 @@ - numelems = 0; - chunks = NULL; - unused = NULL; -+ printf("unused is at %d : %d\n", int(&unused), int(unused)); - chains = new chain *[size]; - loopi(size) chains[i] = NULL; - } -@@ -527,6 +530,7 @@ - - chain *insert(uint h) - { -+ printf("Insert. Unused: %d, addr of next is offset to: %d\n", int(unused), int(&(unused->next))); - if(!unused) - { - chainchunk *chunk = new chainchunk; -@@ -535,9 +539,13 @@ - loopi(CHUNKSIZE-1) chunk->chains[i].next = &chunk->chains[i+1]; - chunk->chains[CHUNKSIZE-1].next = unused; - unused = chunk->chains; -+ loopi(CHUNKSIZE) printf("chunk %d is at %d, and points to %d\n", i, int(&(chunk->chains[i])), int(chunk->chains[i].next)); -+ printf("PRE YO unused is NOW at %d : %d, %d, %d\n", int(&unused), int(unused), int(unused->next), int(unused->next->next)); - } - chain *c = unused; -+ //printf("unused PRE: %d : %d, %d, %d\n", int(&unused), int(unused), int(unused->next), int(unused->next->next)); - unused = unused->next; -+ //printf("unused POST: %d : %d, %d, %d\n", int(&unused), int(unused), int(unused->next), int(unused->next->next)); - c->next = chains[h]; - chains[h] = c; - numelems++; -@@ -545,11 +553,11 @@ - } - - #define HTFIND(key, success, fail) \ -- uint h = hthash(key)&(this->size-1); \ -+ printf("HTFIND a\n"); uint h = hthash(key)&(this->size-1); \ - for(chain *c = this->chains[h]; c; c = c->next) \ -- { \ -+ { printf("HTFIND b\n"); \ - if(htcmp(key, c->elem)) return (success); \ -- } \ -+ } printf("HTFIND c\n"); \ - return (fail); - - template<class K> -@@ -644,7 +652,9 @@ - - entry &insert(const K &key, uint h) - { -+ printf("hashTABLE insert\n"); - chain *c = hashset<entry>::insert(h); -+ printf("hashTABLE insert moving on\n"); - c->elem.key = key; - return c->elem; - } -@@ -863,11 +873,11 @@ - virtual int printf(const char *fmt, ...) { return -1; } - virtual uint getcrc() { return 0; } - -- template<class T> bool put(T n) { return write(&n, sizeof(n)) == sizeof(n); } -+ template<class T> bool put(T n) { return write(&n, ES_SIZEOV(n)) == ES_SIZEOV(n); } - template<class T> bool putlil(T n) { return put<T>(lilswap(n)); } - template<class T> bool putbig(T n) { return put<T>(bigswap(n)); } - -- template<class T> T get() { T n; return read(&n, sizeof(n)) == sizeof(n) ? n : 0; } -+ template<class T> T get() { T n; return read(&n, ES_SIZEOV(n)) == ES_SIZEOV(n) ? n : 0; } - template<class T> T getlil() { return lilswap(get<T>()); } - template<class T> T getbig() { return bigswap(get<T>()); } - }; -diff --git a/tests/settings.py b/tests/settings.py ---- a/tests/settings.py -+++ b/tests/settings.py -@@ -9,7 +9,7 @@ - JS_ENGINE_OPTS=[]#['-j'] - PARSER_ENGINE=SPIDERMONKEY_SHELL - PARSER_OPTS=[]#['-j'] --#PARSER_ENGINE=V8_ENGINE -+PARSER_ENGINE=V8_ENGINE - #PARSER_OPTS = [] - #JS_ENGINE=V8_ENGINE - JS_COMPILER=path_from_root(['src', 'parser.js']) |