Dalvik:dvmCompilerAssembleLIR

这是在frontend.cpp(vm\compiler)里面的情况:

/* Convert LIR into machine code. Loop for recoverable retries */
    do {
        dvmCompilerAssembleLIR(&cUnit, info);
        cUnit.assemblerRetries++;
        if (cUnit.printMe && cUnit.assemblerStatus != kSuccess)
            ALOGD("Assembler abort #%d on %d",cUnit.assemblerRetries,
                  cUnit.assemblerStatus);
    } while (cUnit.assemblerStatus == kRetryAll);

这个函数主要的负责内容,则是将LIR转化为MC了,这部分的工作是很死板的工作,就是对应着ARM的汇编规范,翻译,查表,回填,整理之类的。

观察其道代码,LIR2MC的层次,几乎没有做优化的策略和考虑。如果要做optimization,可能这会是一个入手点。

assemble.cpp(vm\compiler\codegen\arm)

/*
 * Go over each instruction in the list and calculate the offset from the top
 * before sending them off to the assembler. If out-of-range branch distance is
 * seen rearrange the instructions a bit to correct it.
 */
void dvmCompilerAssembleLIR(CompilationUnit *cUnit, JitTranslationInfo *info)

你可能感兴趣的:(compiler,dalvik,LIR)