You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 1, 2021. It is now read-only.
Copy file name to clipboardexpand all lines: lib/Target/JSBackend/JSBackend.cpp
+51-14
Original file line number
Diff line number
Diff line change
@@ -233,6 +233,7 @@ namespace {
233
233
BlockAddressMap BlockAddresses;
234
234
std::map<std::string, AsmConstInfo> AsmConsts; // code => { index, list of seen sigs }
235
235
NameSet FuncRelocatableExterns; // which externals are accessed in this function; we load them once at the beginning (avoids a potential call in a heap access, and might be faster)
236
+
std::set<const Function*> DeclaresNeedingTypeDeclarations; // list of declared funcs whose type we must declare asm.js-style with a usage, as they may not have another usage
236
237
237
238
struct {
238
239
// 0 is reserved for void type
@@ -434,6 +435,14 @@ namespace {
434
435
(this->*(CH->second))(NULL, Name, -1);
435
436
}
436
437
438
+
// and in asm.js, types are inferred from use. so if we have a method that *only* appears in a table, it therefore has no use,
439
+
// and we are in trouble; emit a fake dce-able use for it.
440
+
if (WebAssembly) {
441
+
if (F->isDeclaration()) {
442
+
DeclaresNeedingTypeDeclarations.insert(F);
443
+
}
444
+
}
445
+
437
446
return Index;
438
447
}
439
448
@@ -701,6 +710,7 @@ namespace {
701
710
/// Like getPtrUse(), but for pointers represented in string expression form.
0 commit comments