Last active
August 29, 2015 14:23
-
-
Save zz85/faa2f220080651723369 to your computer and use it in GitHub Desktop.
Strange Segmentation Fault in glsl-optimizer + emscripten opitimizations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __ZL25remove_unlinked_functionsPKvPvS1_($key, $data, $closure) { | |
$key = $key | 0; | |
$data = $data | 0; | |
$closure = $closure | 0; | |
var $0 = 0, $1 = 0, $10 = 0, $11 = 0, $12 = 0, $13 = 0, $14 = 0, $15 = 0, $16 = 0, $17 = 0, $18 = 0, $19 = 0, $2 = 0, $3 = 0, $4 = 0, $5 = 0, $6 = 0, $7 = 0, $8 = 0, $9 = 0; | |
var label = 0, sp = 0; | |
sp = STACKTOP; | |
$0 = $data + 16 | 0; | |
$1 = __ZNK9exec_list8is_emptyEv($0) | 0; | |
if (!$1) { | |
$2 = $data + 4 | 0; | |
$3 = __ZNK9exec_list8is_emptyEv($2) | 0; | |
if (!$3) { | |
return; | |
} | |
} | |
$4 = __ZNK9exec_list8is_emptyEv($0) | 0; | |
if (!$4) { | |
while (1) { | |
$7 = __ZN9exec_list8pop_headEv($0) | 0; | |
$8 = $7 + 8 | 0; | |
$9 = SAFE_HEAP_LOAD($8 | 0, 4, 0, 0) | 0 | 0; | |
$10 = $9 + 4 | 0; | |
__ZL13destroy_linksP9exec_listPN12_GLOBAL__N_18functionE($10, $data); | |
$11 = __ZNK9exec_list8is_emptyEv($0) | 0; | |
if ($11) { | |
break; | |
} | |
} | |
} | |
$5 = $data + 4 | 0; | |
$6 = __ZNK9exec_list8is_emptyEv($5) | 0; | |
if (!$6) { | |
while (1) { | |
$12 = __ZN9exec_list8pop_headEv($5) | 0; | |
$13 = $12 + 8 | 0; | |
$14 = SAFE_HEAP_LOAD($13 | 0, 4, 0, 0) | 0 | 0; | |
$15 = $14 + 16 | 0; | |
__ZL13destroy_linksP9exec_listPN12_GLOBAL__N_18functionE($15, $data); | |
$16 = __ZNK9exec_list8is_emptyEv($5) | 0; | |
if ($16) { | |
break; | |
} | |
} | |
} | |
$17 = $closure + 32 | 0; | |
$18 = SAFE_HEAP_LOAD($17 | 0, 4, 0, 0) | 0 | 0; | |
_hash_table_remove($18, $key); | |
$19 = $closure + 40 | 0; | |
SAFE_HEAP_STORE($19 >> 0 | 0, 1 | 0, 1, 0); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __ZL25remove_unlinked_functionsPKvPvS1_($key, $data, $closure) { | |
$key = $key | 0; | |
$data = $data | 0; | |
$closure = $closure | 0; | |
var $1 = 0, $11 = 0, $17 = 0, $23 = 0, $28 = 0, $30 = 0, $36 = 0, $42 = 0, $5 = 0, $7 = 0, $9 = 0, $__next$0$in$i = 0, $__next$0$in$i8 = 0, $__next$0$in$in4$i = 0, $__next$0$in$in4$i$phi = 0, $__next$0$in$in4$i4 = 0, $__next$0$in$in4$i4$phi = 0, $__next$0$in2$i = 0, $__next$0$in2$i2 = 0, $__next$0$in5$i = 0, $__next$0$in5$i3 = 0, $node$0$in3$i = 0, $node$0$in3$i$phi = 0, $node$0$in3$i5 = 0, $node$0$in3$i5$phi = 0; | |
$1 = SAFE_HEAP_LOAD($data + 16 | 0, 4, 0, 0) | 0 | 0; | |
$5 = SAFE_HEAP_LOAD($data + 4 | 0, 4, 0, 0) | 0 | 0; | |
$7 = ($5 | 0) == ($data + 8 | 0); | |
do if (($1 | 0) == ($data + 20 | 0)) { | |
if ($7) { | |
_hash_table_remove(SAFE_HEAP_LOAD($closure + 32 | 0, 4, 0, 0) | 0 | 0, $key); | |
SAFE_HEAP_STORE($closure + 40 >> 0 | 0, 1 | 0, 1, 0); | |
break; | |
} | |
L5 : while (1) { | |
if ($5) { | |
$28 = $5 + 4 | 0; | |
$30 = SAFE_HEAP_LOAD($5 | 0, 4, 0, 0) | 0 | 0; | |
SAFE_HEAP_STORE($30 + 4 | 0, SAFE_HEAP_LOAD($28 | 0, 4, 0, 0) | 0 | 0, 4, 0); | |
SAFE_HEAP_STORE(SAFE_HEAP_LOAD($28 | 0, 4, 0, 0) | 0 | 0, $30 | 0, 4, 0); | |
SAFE_HEAP_STORE($5 | 0, 0 | 0, 4, 0); | |
SAFE_HEAP_STORE($28 | 0, 0 | 0, 4, 0); | |
} | |
$36 = SAFE_HEAP_LOAD((SAFE_HEAP_LOAD($5 + 8 | 0, 4, 0, 0) | 0 | 0) + 16 | 0, 4, 0, 0) | 0 | 0; | |
$__next$0$in2$i = SAFE_HEAP_LOAD($36 | 0, 4, 0, 0) | 0 | 0; | |
if (!$__next$0$in2$i) continue; else { | |
$__next$0$in$in4$i = $36; | |
$__next$0$in5$i = $__next$0$in2$i; | |
$node$0$in3$i = $36; | |
} | |
while (1) { | |
if ((SAFE_HEAP_LOAD($node$0$in3$i + 8 | 0, 4, 0, 0) | 0 | 0) == ($data | 0)) { | |
$42 = $node$0$in3$i + 4 | 0; | |
SAFE_HEAP_STORE($__next$0$in5$i + 4 | 0, SAFE_HEAP_LOAD($42 | 0, 4, 0, 0) | 0 | 0, 4, 0); | |
SAFE_HEAP_STORE(SAFE_HEAP_LOAD($42 | 0, 4, 0, 0) | 0 | 0, $__next$0$in5$i | 0, 4, 0); | |
SAFE_HEAP_STORE($__next$0$in$in4$i | 0, 0 | 0, 4, 0); | |
SAFE_HEAP_STORE($42 | 0, 0 | 0, 4, 0); | |
} | |
$__next$0$in$i = SAFE_HEAP_LOAD($__next$0$in5$i | 0, 4, 0, 0) | 0 | 0; | |
if (!$__next$0$in$i) continue L5; else { | |
$node$0$in3$i$phi = $__next$0$in5$i; | |
$__next$0$in$in4$i$phi = $__next$0$in5$i; | |
$__next$0$in5$i = $__next$0$in$i; | |
$node$0$in3$i = $node$0$in3$i$phi; | |
$__next$0$in$in4$i = $__next$0$in$in4$i$phi; | |
} | |
} | |
} | |
} else if ($7) L16 : while (1) { | |
if ($1) { | |
$9 = $1 + 4 | 0; | |
$11 = SAFE_HEAP_LOAD($1 | 0, 4, 0, 0) | 0 | 0; | |
SAFE_HEAP_STORE($11 + 4 | 0, SAFE_HEAP_LOAD($9 | 0, 4, 0, 0) | 0 | 0, 4, 0); | |
SAFE_HEAP_STORE(SAFE_HEAP_LOAD($9 | 0, 4, 0, 0) | 0 | 0, $11 | 0, 4, 0); | |
SAFE_HEAP_STORE($1 | 0, 0 | 0, 4, 0); | |
SAFE_HEAP_STORE($9 | 0, 0 | 0, 4, 0); | |
} | |
$17 = SAFE_HEAP_LOAD((SAFE_HEAP_LOAD($1 + 8 | 0, 4, 0, 0) | 0 | 0) + 4 | 0, 4, 0, 0) | 0 | 0; | |
$__next$0$in2$i2 = SAFE_HEAP_LOAD($17 | 0, 4, 0, 0) | 0 | 0; | |
if (!$__next$0$in2$i2) continue; else { | |
$__next$0$in$in4$i4 = $17; | |
$__next$0$in5$i3 = $__next$0$in2$i2; | |
$node$0$in3$i5 = $17; | |
} | |
while (1) { | |
if ((SAFE_HEAP_LOAD($node$0$in3$i5 + 8 | 0, 4, 0, 0) | 0 | 0) == ($data | 0)) { | |
$23 = $node$0$in3$i5 + 4 | 0; | |
SAFE_HEAP_STORE($__next$0$in5$i3 + 4 | 0, SAFE_HEAP_LOAD($23 | 0, 4, 0, 0) | 0 | 0, 4, 0); | |
SAFE_HEAP_STORE(SAFE_HEAP_LOAD($23 | 0, 4, 0, 0) | 0 | 0, $__next$0$in5$i3 | 0, 4, 0); | |
SAFE_HEAP_STORE($__next$0$in$in4$i4 | 0, 0 | 0, 4, 0); | |
SAFE_HEAP_STORE($23 | 0, 0 | 0, 4, 0); | |
} | |
$__next$0$in$i8 = SAFE_HEAP_LOAD($__next$0$in5$i3 | 0, 4, 0, 0) | 0 | 0; | |
if (!$__next$0$in$i8) continue L16; else { | |
$node$0$in3$i5$phi = $__next$0$in5$i3; | |
$__next$0$in$in4$i4$phi = $__next$0$in5$i3; | |
$__next$0$in5$i3 = $__next$0$in$i8; | |
$node$0$in3$i5 = $node$0$in3$i5$phi; | |
$__next$0$in$in4$i4 = $__next$0$in$in4$i4$phi; | |
} | |
} | |
} while (0); | |
return; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Remove a function if it has either no in or no out links | |
*/ | |
static void | |
remove_unlinked_functions(const void *key, void *data, void *closure) | |
{ | |
has_recursion_visitor *visitor = (has_recursion_visitor *) closure; | |
function *f = (function *) data; | |
if (f->callers.is_empty() || f->callees.is_empty()) { | |
while (!f->callers.is_empty()) { | |
struct call_node *n = (struct call_node *) f->callers.pop_head(); | |
destroy_links(& n->func->callees, f); | |
} | |
while (!f->callees.is_empty()) { | |
struct call_node *n = (struct call_node *) f->callees.pop_head(); | |
destroy_links(& n->func->callers, f); | |
} | |
hash_table_remove(visitor->function_hash, key); | |
visitor->progress = true; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Uncaught abort("segmentation fault storing 4 bytes to address 0") at Error | |
at jsStackTrace (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:1227:13) | |
at stackTrace (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:1244:22) | |
at abort (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:139828:44) | |
at SAFE_HEAP_STORE (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:363:85) | |
at Array.__ZL25remove_unlinked_functionsPKvPvS1_ [remove_unlinked_functions(void const*, void*, void*)] (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:100247:4) | |
at _hash_table_call_foreach (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:122267:73) | |
at __Z25detect_recursion_unlinkedP22_mesa_glsl_parse_stateP9exec_list [detect_recursion_unlinked(_mesa_glsl_parse_state*, exec_list*)] (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:124528:3) | |
at __Z16_mesa_ast_to_hirP9exec_listP22_mesa_glsl_parse_state [_mesa_ast_to_hir(exec_list*, _mesa_glsl_parse_state*)] (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:75238:2) | |
at __Z16glslopt_optimizeP11glslopt_ctx19glslopt_shader_typePKcj [glslopt_optimize(glslopt_ctx*, glslopt_shader_type, char const*, unsigned int)] (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:67724:5) | |
at _optimize_glsl (http://localhost:8000/gits/glsl-optimizer/glsl-optimizer.js:109512:8)abort @ glsl-optimizer.js:139832SAFE_HEAP_STORE @ glsl-optimizer.js:363__ZL25remove_unlinked_functionsPKvPvS1_ @ glsl-optimizer.js:100247_hash_table_call_foreach @ glsl-optimizer.js:122267__Z25detect_recursion_unlinkedP22_mesa_glsl_parse_stateP9exec_list @ glsl-optimizer.js:124528__Z16_mesa_ast_to_hirP9exec_listP22_mesa_glsl_parse_state @ glsl-optimizer.js:75238__Z16glslopt_optimizeP11glslopt_ctx19glslopt_shader_typePKcj @ glsl-optimizer.js:67724_optimize_glsl @ glsl-optimizer.js:109512asm._optimize_glsl @ glsl-optimizer.js:137853(anonymous function) @ VM395:6optimize @ (index):106onclick @ (index):48 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment