Remove zero-init of dynamic library static data/table region. NFC (#15390)

As of https://reviews.llvm.org/D112667 that module itself will zero
its bcc data segment at the same time as loading int its non-bss
data.

For the table region, the loop was already needless since table.grow
will have filly the region with null entries already.
This commit is contained in:
Sam Clegg 2021-10-29 11:41:21 -07:00 коммит произвёл GitHub
Родитель fec471aff5
Коммит 0e68b98e85
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 0 добавлений и 19 удалений

Просмотреть файл

@ -440,25 +440,6 @@ var LibraryDylink = {
#endif
var tableBase = metadata.tableSize ? wasmTable.length : 0;
wasmTable.grow(metadata.tableSize);
// zero-initialize memory and table
// The static area consists of explicitly initialized data, followed by zero-initialized data.
// The latter may need zeroing out if the MAIN_MODULE has already used this memory area before
// dlopen'ing the SIDE_MODULE. Since we don't know the size of the explicitly initialized data
// here, we just zero the whole thing, which is suboptimal, but should at least resolve bugs
// from uninitialized memory.
#if USE_PTHREADS
// in a pthread the module heap was already allocated and initialized in the main thread.
if (!ENVIRONMENT_IS_PTHREAD) {
#endif
for (var i = memoryBase; i < memoryBase + metadata.memorySize; i++) {
HEAP8[i] = 0;
}
#if USE_PTHREADS
}
#endif
for (var i = tableBase; i < tableBase + metadata.tableSize; i++) {
wasmTable.set(i, null);
}
// This is the export map that we ultimately return. We declare it here
// so it can be used within resolveSymbol. We resolve symbols against