mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 23:02:20 +00:00
Bug 1777604
- wasm: Conservatively flush icache for all threads when compiling a module on ARM64. r=nbp
See https://bugzilla.mozilla.org/show_bug.cgi?id=1777604#c12 for more information. Differential Revision: https://phabricator.services.mozilla.com/D151677
This commit is contained in:
parent
a064a6ac2d
commit
3eea487471
@ -331,7 +331,7 @@ UniqueModuleSegment ModuleSegment::create(Tier tier, const Bytes& unlinkedBytes,
|
||||
linkData);
|
||||
}
|
||||
|
||||
bool ModuleSegment::initialize(IsTier2 isTier2, const CodeTier& codeTier,
|
||||
bool ModuleSegment::initialize(const CodeTier& codeTier,
|
||||
const LinkData& linkData,
|
||||
const Metadata& metadata,
|
||||
const MetadataTier& metadataTier) {
|
||||
@ -339,15 +339,11 @@ bool ModuleSegment::initialize(IsTier2 isTier2, const CodeTier& codeTier,
|
||||
return false;
|
||||
}
|
||||
|
||||
// Optimized compilation finishes on a background thread, so we must make sure
|
||||
// to flush the icaches of all the executing threads.
|
||||
FlushICacheSpec flushIcacheSpec = isTier2 == IsTier2::Tier2
|
||||
? FlushICacheSpec::AllThreads
|
||||
: FlushICacheSpec::LocalThreadOnly;
|
||||
|
||||
// Reprotect the whole region to avoid having separate RW and RX mappings.
|
||||
// Flush the icache for all threads, as we may be on a background thread or
|
||||
// the module may be posted to another thread.
|
||||
if (!ExecutableAllocator::makeExecutableAndFlushICache(
|
||||
flushIcacheSpec, base(), RoundupCodeLength(length()))) {
|
||||
FlushICacheSpec::AllThreads, base(), RoundupCodeLength(length()))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -849,15 +845,15 @@ bool Metadata::getFuncName(NameContext ctx, uint32_t funcIndex,
|
||||
return AppendFunctionIndexName(funcIndex, name);
|
||||
}
|
||||
|
||||
bool CodeTier::initialize(IsTier2 isTier2, const Code& code,
|
||||
const LinkData& linkData, const Metadata& metadata) {
|
||||
bool CodeTier::initialize(const Code& code, const LinkData& linkData,
|
||||
const Metadata& metadata) {
|
||||
MOZ_ASSERT(!initialized());
|
||||
code_ = &code;
|
||||
|
||||
MOZ_ASSERT(lazyStubs_.readLock()->entryStubsEmpty());
|
||||
|
||||
// See comments in CodeSegment::initialize() for why this must be last.
|
||||
if (!segment_->initialize(isTier2, *this, linkData, metadata, *metadata_)) {
|
||||
if (!segment_->initialize(*this, linkData, metadata, *metadata_)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -946,7 +942,7 @@ Code::Code(UniqueCodeTier tier1, const Metadata& metadata,
|
||||
bool Code::initialize(const LinkData& linkData) {
|
||||
MOZ_ASSERT(!initialized());
|
||||
|
||||
if (!tier1_->initialize(IsTier2::NotTier2, *this, linkData, *metadata_)) {
|
||||
if (!tier1_->initialize(*this, linkData, *metadata_)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -960,7 +956,7 @@ bool Code::setAndBorrowTier2(UniqueCodeTier tier2, const LinkData& linkData,
|
||||
MOZ_RELEASE_ASSERT(tier2->tier() == Tier::Optimized &&
|
||||
tier1_->tier() == Tier::Baseline);
|
||||
|
||||
if (!tier2->initialize(IsTier2::Tier2, *this, linkData, *metadata_)) {
|
||||
if (!tier2->initialize(*this, linkData, *metadata_)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -209,8 +209,6 @@ class CodeSegment {
|
||||
|
||||
using UniqueModuleSegment = UniquePtr<ModuleSegment>;
|
||||
|
||||
enum IsTier2 { Tier2, NotTier2 };
|
||||
|
||||
class ModuleSegment : public CodeSegment {
|
||||
const Tier tier_;
|
||||
uint8_t* const trapCode_;
|
||||
@ -224,9 +222,8 @@ class ModuleSegment : public CodeSegment {
|
||||
static UniqueModuleSegment create(Tier tier, const Bytes& unlinkedBytes,
|
||||
const LinkData& linkData);
|
||||
|
||||
bool initialize(IsTier2 isTier2, const CodeTier& codeTier,
|
||||
const LinkData& linkData, const Metadata& metadata,
|
||||
const MetadataTier& metadataTier);
|
||||
bool initialize(const CodeTier& codeTier, const LinkData& linkData,
|
||||
const Metadata& metadata, const MetadataTier& metadataTier);
|
||||
|
||||
Tier tier() const { return tier_; }
|
||||
|
||||
@ -654,7 +651,7 @@ class CodeTier {
|
||||
lazyStubs_(mutexForTier(segment_->tier())) {}
|
||||
|
||||
bool initialized() const { return !!code_ && segment_->initialized(); }
|
||||
bool initialize(IsTier2 isTier2, const Code& code, const LinkData& linkData,
|
||||
bool initialize(const Code& code, const LinkData& linkData,
|
||||
const Metadata& metadata);
|
||||
|
||||
Tier tier() const { return segment_->tier(); }
|
||||
|
Loading…
Reference in New Issue
Block a user