Implemented peephole optimizations including null-check elimination, redundant ld/st elimination, ad-hoc register renaming and store sinking.
diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c
index 6e8d964..5e75d15 100644
--- a/vm/compiler/Frontend.c
+++ b/vm/compiler/Frontend.c
@@ -198,6 +198,11 @@
CompilationUnit cUnit;
memset(&cUnit, 0, sizeof(CompilationUnit));
+ compilationId++;
+
+ cUnit.registerScoreboard.nullCheckedRegs =
+ dvmAllocBitVector(desc->method->registersSize, false);
+
/* Initialize the printMe flag */
cUnit.printMe = gDvmJit.printMe;
@@ -410,7 +415,7 @@
if (cUnit.printMe) {
LOGD("TRACEINFO (%d): 0x%08x %s%s 0x%x %d of %d, %d blocks",
- compilationId++,
+ compilationId,
(intptr_t) desc->method->insns,
desc->method->clazz->descriptor,
desc->method->name,
@@ -462,6 +467,9 @@
/* Reset the compiler resource pool */
dvmCompilerArenaReset();
+ /* Free the bit vector tracking null-checked registers */
+ dvmFreeBitVector(cUnit.registerScoreboard.nullCheckedRegs);
+
/*
* Things have gone smoothly - publish the starting address of
* translation's entry point.