summaryrefslogtreecommitdiff
path: root/src/compiler.h
diff options
context:
space:
mode:
author Ian Rogers <irogers@google.com> 2011-10-27 15:19:26 -0700
committer Ian Rogers <irogers@google.com> 2011-10-28 23:14:15 -0700
commit28ad40dc3ec2f09b0ffd4f6d6787bf1b532ccd5d (patch)
treef5628e47948a0d255112a3a7a01b67db41c8d424 /src/compiler.h
parente0918556e7551de638870dcad3f2023f94f85a50 (diff)
Support for unresolved types in new-instance during verification.
Also, ensure that classes that don't load are erroneous, warn early about exceptions left on a thread by the verifier/compiler, factor out slowpath checks for the compiler and fix the slowpath selector for const-class. This change causes more dex cache misses at runtime (more slowpath execution). It also requires a "mm clean-oat". Change-Id: I014b49ebdd7d8f7dd2e39cc0958fc0b708d58c4c
Diffstat (limited to 'src/compiler.h')
-rw-r--r--src/compiler.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/compiler.h b/src/compiler.h
index 0fc68df48b..55bab59e6b 100644
--- a/src/compiler.h
+++ b/src/compiler.h
@@ -55,6 +55,21 @@ class Compiler {
const CompiledMethod* GetCompiledMethod(const Method* method) const;
const CompiledInvokeStub* GetCompiledInvokeStub(const Method* method) const;
+ // Callbacks from OAT/ART compiler to see what runtime checks must be generated
+ bool CanAssumeTypeIsPresentInDexCache(const Method* referrer, uint32_t type_idx) const {
+ return IsImage() && referrer->GetDexCacheResolvedTypes()->Get(type_idx) != NULL;
+ }
+ bool CanAssumeStringIsPresentInDexCache(const Method* referrer, uint32_t string_idx) const {
+ return IsImage() && referrer->GetDexCacheStrings()->Get(string_idx) != NULL;
+ }
+ bool CanAccessTypeWithoutChecks(const Method* referrer, uint32_t type_idx) const {
+ Class* resolved_class = referrer->GetDexCacheResolvedTypes()->Get(type_idx);
+ // We should never ask whether a type needs access checks to raise a verification error,
+ // all other cases where this following test could fail should have been rewritten by the
+ // verifier to verification errors.
+ DCHECK(resolved_class == NULL || referrer->GetDeclaringClass()->CanAccess(resolved_class));
+ return resolved_class != NULL;
+ }
private:
// Attempt to resolve all type, methods, fields, and strings
// referenced from code in the dex file following PathClassLoader