summaryrefslogtreecommitdiffstats
path: root/test/201-built-in-exception-detail-messages
diff options
context:
space:
mode:
authorSebastien Hertz <shertz@google.com>2013-05-17 11:31:37 +0200
committerSebastien Hertz <shertz@google.com>2013-06-24 15:29:06 +0200
commit2d6ba5158d7fd459db2870df47300b517dc4d08c (patch)
tree51e306969d4d707aee7a6bc36481390721e0f81f /test/201-built-in-exception-detail-messages
parent1e2ee7de9dff66f7ca2bdf83a7262e21d75b37d1 (diff)
downloadart-2d6ba5158d7fd459db2870df47300b517dc4d08c.zip
art-2d6ba5158d7fd459db2870df47300b517dc4d08c.tar.gz
art-2d6ba5158d7fd459db2870df47300b517dc4d08c.tar.bz2
Quickening support.
This CL adds quickening support for methods which are interpreted at runtime. This CL introduces a DEX-to-DEX compiler. A method is now compiled in one of the two following modes: - Native compilation: the method is compiled by the Quick or Portable backends. At runtime, the generated native target-dependent code is executed. - DEX-to-DEX compilation: the method is executed by the interpreter at runtime. Its DEX code is compiled so some instructions can be replaced by special instructions only valid at runtime. No native code is generated. The quickening adds special instructions to improve runtime performance. They are "-quick" versions of the following instructions: - iget/iput - iget-wide/iput-wide - iget-object/iput-object - invoke-virtual/range. These special instructions cannot be treated by the verifier since they lose the field/method index referencing the field/method being accessed/invoked. To prevent this, the DEX-to-DEX compiler is run only on methods of preverified classes (without verification error at compilation time). The DEX-to-DEX compiler implements quickening support using the CompilerDriver interface like the native compiler does (Quick or Portable backends). To replace instructions, the DEX-to-DEX compiler must be able to modify the mmapped DEX file. Since it can be read-only protected, the DEX-to-DEX compiler must be able to temporarily change its protection to read-write mmapped file. To achieve this, this CL adds support for changing DEX file protection with DexFile::EnableWrite and DexFile::DisableWrite methods. Besides, it also adds a dedicated lock (DexFile::modification_lock) to ensure thread-safety and avoid concurrent DEX file protection change (from a parallel DEX-to-DEX compiler on the same DEX file). Change-Id: Iaafd103b9766810d7fc94a2c424a8fafba66e26a
Diffstat (limited to 'test/201-built-in-exception-detail-messages')
-rw-r--r--test/201-built-in-exception-detail-messages/src/Main.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/test/201-built-in-exception-detail-messages/src/Main.java b/test/201-built-in-exception-detail-messages/src/Main.java
index f8da644..24ee6e0 100644
--- a/test/201-built-in-exception-detail-messages/src/Main.java
+++ b/test/201-built-in-exception-detail-messages/src/Main.java
@@ -286,10 +286,19 @@ public class Main {
}
}
+ // Defeat the fact that null's are untyped for precise detail message creation with quickening.
+ private static Object returnNullObject() {
+ return null;
+ }
+
+ private static A returnNullA() {
+ return null;
+ }
+
private static void nullPointers() throws Exception {
// Invoke method.
try {
- Object o = null;
+ Object o = returnNullObject();
o.hashCode();
fail();
} catch (NullPointerException ex) {
@@ -298,7 +307,7 @@ public class Main {
// Read field.
try {
- A a = null;
+ A a = returnNullA();
int i = a.i;
fail();
} catch (NullPointerException ex) {
@@ -307,7 +316,7 @@ public class Main {
// Write field.
try {
- A a = null;
+ A a = returnNullA();
a.i = 1;
fail();
} catch (NullPointerException ex) {
@@ -332,7 +341,7 @@ public class Main {
assertEquals("Attempt to write to null array", ex.getMessage());
}
- // Invoke method.
+ // Array length.
try {
int[] is = null;
int i = is.length;