ART: Speed up stack guard page install
Only the main thread doesn't have its stack mapped in under normal
conditions. Reading each page is a lot of overhead and we should
try to avoid it.
Rewrite to first try a (non-fatal) protect. If the outcome is a
success, finish. Otherwise do the stack mapping, and try again.
Bug: 27718174
Change-Id: I16b214567585ed2f09970f618ccdec7eed219fd3
diff --git a/runtime/thread.h b/runtime/thread.h
index 234750c..3123c71 100644
--- a/runtime/thread.h
+++ b/runtime/thread.h
@@ -1038,7 +1038,7 @@
tlsPtr_.rosalloc_runs[index] = run;
}
- void ProtectStack();
+ bool ProtectStack(bool fatal_on_error = true);
bool UnprotectStack();
void SetMterpDefaultIBase(void* ibase) {