diff options
author | Alon Zakai <alonzakai@gmail.com> | 2012-11-27 20:02:42 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2012-11-27 20:02:42 -0800 |
commit | ee0c41b39bcaf80144b8112d3e307d3e4630c077 (patch) | |
tree | b1c40a03e904dd2258f97989380bb3c651fa81b7 /src/parseTools.js | |
parent | bdef7bf784d5765ffb4b64c51426eb1c517c33ea (diff) |
do not index globals referred to by name in library
Diffstat (limited to 'src/parseTools.js')
-rw-r--r-- | src/parseTools.js | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/parseTools.js b/src/parseTools.js index 627bde77..558f5440 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -356,9 +356,17 @@ function hasVarArgs(params) { return false; } +var UNINDEXABLE_GLOBALS = set( + '_llvm_global_ctors' // special-cased +); + +function noticePtr(ptr) { + if (!LibraryManager.loaded) UNINDEXABLE_GLOBALS[ptr] = 1; // we cannot index globals referred to in the library, since they are used there by name +} + function isIndexableGlobal(ident) { if (!(ident in Variables.globals)) return false; - if (ident == '_llvm_global_ctors') return false; + if (ident in UNINDEXABLE_GLOBALS) return false; var data = Variables.globals[ident]; return !data.alias && !data.external; } @@ -932,6 +940,7 @@ function getHeapOffset(offset, type) { // See makeSetValue function makeGetValue(ptr, pos, type, noNeedFirst, unsigned, ignore, align, noSafe) { + noticePtr(ptr); if (UNALIGNED_MEMORY) align = 1; if (isStructType(type)) { var typeData = Types.types[type]; @@ -1012,6 +1021,7 @@ function indexizeFunctions(value, type) { //! which means we should write to all slabs, ignore type differences if any on reads, etc. //! @param noNeedFirst Whether to ignore the offset in the pointer itself. function makeSetValue(ptr, pos, value, type, noNeedFirst, ignore, align, noSafe, sep, forcedAlign) { + noticePtr(ptr); if (UNALIGNED_MEMORY && !forcedAlign) align = 1; sep = sep || ';'; if (isStructType(type)) { @@ -1083,6 +1093,7 @@ var SEEK_OPTIMAL_ALIGN_MIN = 20; var UNROLL_LOOP_MAX = 8; function makeSetValues(ptr, pos, value, type, num, align) { + noticePtr(ptr); function unroll(type, num, jump, value$) { jump = jump || 1; value$ = value$ || value; @@ -1132,6 +1143,8 @@ function makeSetValues(ptr, pos, value, type, num, align) { var TYPED_ARRAY_SET_MIN = Infinity; // .set() as memcpy seems to just slow us down function makeCopyValues(dest, src, num, type, modifier, align, sep) { + noticePtr(dest); + noticePtr(src); sep = sep || ';'; function unroll(type, num, jump) { jump = jump || 1; |