From 716f120d7f33ca18a5dcbef811399df0cbefe5d0 Mon Sep 17 00:00:00 2001 From: Bill Buzbee Date: Thu, 23 Jul 2009 13:22:09 -0700 Subject: First phase of restructuring to support THUMB2 & ARM traces Store some useful info about traces in JitTable entry; some general cleanup --- vm/compiler/Frontend.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'vm/compiler/Frontend.c') diff --git a/vm/compiler/Frontend.c b/vm/compiler/Frontend.c index 77548d94b..c71797557 100644 --- a/vm/compiler/Frontend.c +++ b/vm/compiler/Frontend.c @@ -239,7 +239,8 @@ static CompilerMethodStats *analyzeMethodBody(const Method *method) * first and they will be passed to the codegen routines to convert Dalvik * bytecode into machine code. */ -void *dvmCompileTrace(JitTraceDescription *desc, int numMaxInsts) +bool dvmCompileTrace(JitTraceDescription *desc, int numMaxInsts, + JitTranslationInfo *info) { const DexCode *dexCode = dvmGetMethodCode(desc->method); const JitTraceRun* currRun = &desc->trace[0]; @@ -523,11 +524,14 @@ void *dvmCompileTrace(JitTraceDescription *desc, int numMaxInsts) dvmCompilerDumpCompilationUnit(&cUnit); } + /* Set the instruction set to use (NOTE: later components may change it) */ + cUnit.instructionSet = dvmCompilerInstructionSet(&cUnit); + /* Convert MIR to LIR, etc. */ dvmCompilerMIR2LIR(&cUnit); /* Convert LIR into machine code. */ - dvmCompilerAssembleLIR(&cUnit); + dvmCompilerAssembleLIR(&cUnit, info); if (cUnit.printMe) { if (cUnit.halveInstCount) { @@ -546,17 +550,14 @@ void *dvmCompileTrace(JitTraceDescription *desc, int numMaxInsts) /* 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. - */ if (!cUnit.halveInstCount) { + /* Success */ methodStats->nativeSize += cUnit.totalSize; - return cUnit.baseAddr + cUnit.headerSize; + return info->codeAddress != NULL; /* Halve the instruction count and retry again */ } else { - return dvmCompileTrace(desc, cUnit.numInsts / 2); + return dvmCompileTrace(desc, cUnit.numInsts / 2, info); } } @@ -567,7 +568,7 @@ void *dvmCompileTrace(JitTraceDescription *desc, int numMaxInsts) * TODO: implementation will be revisited when the trace builder can provide * whole-method traces. */ -void *dvmCompileMethod(const Method *method) +bool dvmCompileMethod(const Method *method, JitTranslationInfo *info) { const DexCode *dexCode = dvmGetMethodCode(method); const u2 *codePtr = dexCode->insns; @@ -732,13 +733,16 @@ void *dvmCompileMethod(const Method *method) } } + /* Set the instruction set to use (NOTE: later components may change it) */ + cUnit.instructionSet = dvmCompilerInstructionSet(&cUnit); + dvmCompilerMIR2LIR(&cUnit); - dvmCompilerAssembleLIR(&cUnit); + dvmCompilerAssembleLIR(&cUnit, info); dvmCompilerDumpCompilationUnit(&cUnit); dvmCompilerArenaReset(); - return cUnit.baseAddr + cUnit.headerSize; + return info->codeAddress != NULL; } -- cgit v1.2.3