Bug 1518210 - Wasm: Make wasm::IsHugeMemoryEnabled() a component of the BuildID for correct invalidation of cached code. r=lth
authorRyan Hunt <rhunt@eqrion.net>
Fri, 30 Aug 2019 20:55:21 +0000
changeset 551464 f493fd84da04b4e32de28dd4da7c2cb544f4353a
parent 551463 5bd0f481e985190cf9bf6235d055d97a1378432b
child 551465 eee3b548e7cd4757d7611ec319aabcea8bf3c2df
push id11865
push userbtara@mozilla.com
push dateMon, 02 Sep 2019 08:54:37 +0000
treeherdermozilla-beta@37f59c4671b3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1518210
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518210 - Wasm: Make wasm::IsHugeMemoryEnabled() a component of the BuildID for correct invalidation of cached code. r=lth We can't deserialize code that doesn't contain bounds checks if we have dynamically switched to not using huge memory. This commit uses BuildID to invalidate cached code correctly. Differential Revision: https://phabricator.services.mozilla.com/D41870
js/src/wasm/WasmModule.cpp
--- a/js/src/wasm/WasmModule.cpp
+++ b/js/src/wasm/WasmModule.cpp
@@ -340,27 +340,31 @@ bool wasm::GetOptimizedEncodingBuildId(J
   // and cpu-id.
 
   if (!GetBuildId || !GetBuildId(buildId)) {
     return false;
   }
 
   uint32_t cpu = ObservedCPUFeatures();
 
-  if (!buildId->reserve(buildId->length() + 10 /* "()" + 8 nibbles */)) {
+  if (!buildId->reserve(buildId->length() +
+                        12 /* "()" + 8 nibbles + "m[+-]" */)) {
     return false;
   }
 
   buildId->infallibleAppend('(');
   while (cpu) {
     buildId->infallibleAppend('0' + (cpu & 0xf));
     cpu >>= 4;
   }
   buildId->infallibleAppend(')');
 
+  buildId->infallibleAppend('m');
+  buildId->infallibleAppend(wasm::IsHugeMemoryEnabled() ? '+' : '-');
+
   return true;
 }
 
 /* virtual */
 void Module::addSizeOfMisc(MallocSizeOf mallocSizeOf,
                            Metadata::SeenSet* seenMetadata,
                            Code::SeenSet* seenCode, size_t* code,
                            size_t* data) const {