summaryrefslogtreecommitdiffstats
path: root/runtime/mem_map.cc
diff options
context:
space:
mode:
authorAndreas Gampe <agampe@google.com>2015-10-26 20:47:28 -0700
committerThe Android Automerger <android-build@android.com>2015-10-28 18:30:14 -0700
commit7f57e8c60ec31461151a8bfdd2b3fabfa78cb3f5 (patch)
treec38a3fc65deb8e28e8913a6c85129a6cb4560f7b /runtime/mem_map.cc
parent54d8f4bc810e7e0767f44cb77e5706a232b644bb (diff)
downloadart-7f57e8c60ec31461151a8bfdd2b3fabfa78cb3f5.zip
art-7f57e8c60ec31461151a8bfdd2b3fabfa78cb3f5.tar.gz
art-7f57e8c60ec31461151a8bfdd2b3fabfa78cb3f5.tar.bz2
[WIP] ART: Write-protect TLS
Change-Id: I6762a3a30d01bd6eb8bb25f23f390c91147fe9b4
Diffstat (limited to 'runtime/mem_map.cc')
-rw-r--r--runtime/mem_map.cc31
1 files changed, 17 insertions, 14 deletions
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index 6566060..e13822a 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -511,26 +511,29 @@ MemMap::~MemMap() {
if (base_begin_ == nullptr && base_size_ == 0) {
return;
}
+
+ // Remove it from maps_.
+ {
+ MutexLock mu(Thread::Current(), *Locks::mem_maps_lock_);
+ bool found = false;
+ DCHECK(maps_ != nullptr);
+ for (auto it = maps_->lower_bound(base_begin_), end = maps_->end();
+ it != end && it->first == base_begin_; ++it) {
+ if (it->second == this) {
+ found = true;
+ maps_->erase(it);
+ break;
+ }
+ }
+ CHECK(found) << "MemMap not found";
+ }
+
if (!reuse_) {
int result = munmap(base_begin_, base_size_);
if (result == -1) {
PLOG(FATAL) << "munmap failed";
}
}
-
- // Remove it from maps_.
- MutexLock mu(Thread::Current(), *Locks::mem_maps_lock_);
- bool found = false;
- DCHECK(maps_ != nullptr);
- for (auto it = maps_->lower_bound(base_begin_), end = maps_->end();
- it != end && it->first == base_begin_; ++it) {
- if (it->second == this) {
- found = true;
- maps_->erase(it);
- break;
- }
- }
- CHECK(found) << "MemMap not found";
}
MemMap::MemMap(const std::string& name, uint8_t* begin, size_t size, void* base_begin,