optimize SAFE_HEAP for speed and enable additional tests
This commit is contained in:
Родитель
ad9cb98dba
Коммит
76c55fb93d
|
@ -25,19 +25,20 @@ function SAFE_HEAP_ACCESS(dest, type, store) {
|
|||
// Note that this will pass even with unions: You can store X, load X, then store Y and load Y.
|
||||
// You cannot, however, do the nonportable act of store X and load Y!
|
||||
if (store) {
|
||||
HEAP_HISTORY[dest] = [{ type: type, /*stack: new Error().stack */ }]; // |stack| is useful for debugging
|
||||
HEAP_HISTORY[dest] = type; // [{ type: type, stack: new Error().stack }]; // |stack| is useful for debugging. Also uncomment the lines later down
|
||||
} else {
|
||||
if (!HEAP[dest] && HEAP[dest] !== 0 && HEAP[dest] !== false) { // false can be the result of a mathop comparator
|
||||
throw('Warning: Reading an invalid value at ' + dest + ' :: ' + new Error().stack + '\n');
|
||||
}
|
||||
var history = HEAP_HISTORY[dest];
|
||||
assert((history && history[0]) /* || HEAP[dest] === 0 */, "Loading from where there was no store! " + dest + ',' + HEAP[dest] + ',' + type + ', \n\n' + new Error().stack + '\n');
|
||||
if (history[0].type && history[0].type !== type) {
|
||||
if (history === null) return;
|
||||
assert(history);
|
||||
// assert((history && history[0]) /* || HEAP[dest] === 0 */, "Loading from where there was no store! " + dest + ',' + HEAP[dest] + ',' + type + ', \n\n' + new Error().stack + '\n');
|
||||
// if (history[0].type !== type) {
|
||||
if (history !== type) {
|
||||
print('Load-store consistency assumption failure! ' + dest);
|
||||
print('\n');
|
||||
print(history.map(function(item) {
|
||||
return item.type + ' :: ' + JSON.stringify(item.stack);
|
||||
}).join('\n\n'));
|
||||
print(JSON.stringify(history));
|
||||
print('\n');
|
||||
print('LOAD: ' + type + ', ' + new Error().stack);
|
||||
print('\n');
|
||||
|
|
|
@ -1016,16 +1016,12 @@ if 'benchmark' not in sys.argv:
|
|||
### 'Big' tests
|
||||
|
||||
def test_fannkuch(self):
|
||||
global SAFE_HEAP; SAFE_HEAP = 0 # Too slow for that
|
||||
|
||||
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_raytrace(self):
|
||||
global SAFE_HEAP; SAFE_HEAP = 0 # Too slow for that
|
||||
|
||||
src = open(path_from_root(['tests', 'raytrace.cpp']), 'r').read()
|
||||
output = open(path_from_root(['tests', 'raytrace.ppm']), 'r').read()
|
||||
self.do_test(src, output, ['3', '16'])
|
||||
|
|
Загрузка…
Ссылка в новой задаче