From 67bc236a207852d652f6ddeab0a90efc1bd111bb Mon Sep 17 00:00:00 2001 From: buzbee Date: Tue, 11 Oct 2011 18:08:40 -0700 Subject: Register promotion fix Restructured the type inference mechanism, added lots of DCHECKS, bumped the default memory allocation size to reflect AOT compilation and tweaked the bit vector manipulation routines to be better at handling large sparse vectors (something the old trace JIT didn't encounter enough to care). With this CL, optimization is back on by default. Should also see a significant boost in compilation speed (~2x better for boot.oat). Change-Id: Ifd134ef337be173a1be756bb9198b24c5b4936b3 --- src/compiler/codegen/arm/ArchUtility.cc | 50 ++++++++++++++++++++++----------- 1 file changed, 34 insertions(+), 16 deletions(-) (limited to 'src/compiler/codegen/arm/ArchUtility.cc') diff --git a/src/compiler/codegen/arm/ArchUtility.cc b/src/compiler/codegen/arm/ArchUtility.cc index aef98faff5..c4d3b6d780 100644 --- a/src/compiler/codegen/arm/ArchUtility.cc +++ b/src/compiler/codegen/arm/ArchUtility.cc @@ -16,6 +16,7 @@ #include "../../CompilerInternals.h" #include "ArmLIR.h" +#include "../Ralloc.h" static const char* coreRegNames[16] = { "r0", @@ -391,6 +392,38 @@ void oatDumpLIRInsn(CompilationUnit* cUnit, LIR* arg, unsigned char* baseAddr) } } +void oatDumpPromotionMap(CompilationUnit *cUnit) +{ + const Method *method = cUnit->method; + for (int i = 0; i < method->NumRegisters(); i++) { + PromotionMap vRegMap = cUnit->promotionMap[i]; + char buf[100]; + if (vRegMap.fpLocation == kLocPhysReg) { + snprintf(buf, 100, " : s%d", vRegMap.fpReg & FP_REG_MASK); + } else { + buf[0] = 0; + } + char buf2[100]; + snprintf(buf2, 100, "V[%02d] -> %s%d%s", i, + vRegMap.coreLocation == kLocPhysReg ? + "r" : "SP+", vRegMap.coreLocation == kLocPhysReg ? + vRegMap.coreReg : oatSRegOffset(cUnit, i), buf); + LOG(INFO) << buf2; + } +} + +void oatDumpFullPromotionMap(CompilationUnit *cUnit) +{ + const Method *method = cUnit->method; + for (int i = 0; i < method->NumRegisters(); i++) { + PromotionMap vRegMap = cUnit->promotionMap[i]; + LOG(INFO) << i << " -> " << "CL:" << (int)vRegMap.coreLocation << + ", CR:" << (int)vRegMap.coreReg << ", FL:" << + (int)vRegMap.fpLocation << ", FR:" << (int)vRegMap.fpReg << + ", - " << (int)vRegMap.firstInPair; + } +} + /* Dump instructions and constant pool contents */ void oatCodegenDump(CompilationUnit* cUnit) { @@ -414,22 +447,7 @@ void oatCodegenDump(CompilationUnit* cUnit) " bytes, Dalvik size is " << insnsSize * 2; LOG(INFO) << "expansion factor: " << (float)cUnit->totalSize / (float)(insnsSize * 2); - for (int i = 0; i < method->NumRegisters(); i++) { - RegLocation loc = cUnit->regLocation[i]; - char buf[100]; - if (loc.fpLocation == kLocPhysReg) { - snprintf(buf, 100, " : s%d", loc.fpLowReg & FP_REG_MASK); - } else { - buf[0] = 0; - } - char buf2[100]; - snprintf(buf2, 100, "V[%02d] -> %s%d%s", i, - loc.location == kLocPhysReg ? - "r" : "SP+", loc.location == kLocPhysReg ? - loc.lowReg : loc.spOffset, buf); - LOG(INFO) << buf2; - - } + oatDumpPromotionMap(cUnit); for (lirInsn = cUnit->firstLIRInsn; lirInsn; lirInsn = lirInsn->next) { oatDumpLIRInsn(cUnit, lirInsn, 0); } -- cgit v1.2.3-59-g8ed1b