VirtualBox

Changeset 2619 in kBuild for trunk/src/kObjCache/kObjCache.c


Ignore:
Timestamp:
Aug 2, 2012 3:48:51 AM (12 years ago)
Author:
bird
Message:

kObjCache: Added an -O2 level for dropping double line statements when changing file. This allows skipping the more expensive preprocessor output comparsion.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kObjCache/kObjCache.c

    r2618 r2619  
    13541354
    13551355
    1356 
    13571356static size_t kOCCppRdOptFlush(PKOCCPPRD pCppRd, size_t offSrcCur, int fLineDirNext)
    13581357{
     
    14771476{
    14781477    size_t const offSrcLine = pCppRd->offSrcCur;
    1479     size_t const cchSrcLine = pszEol - pCppRd->pszBuf - pCppRd->offSrcCur;
     1478    size_t const cchSrcLine = pszEol - pCppRd->pszBuf - (pCppRd->fOptimize & 2 ? pCppRd->offSrcUnoptimized : pCppRd->offSrcCur);
    14801479    size_t const cbLeftAssert = *pcbLeft;
    14811480    char *pszNewFile;
     
    15211520                 */
    15221521                size_t cchLineDir;
    1523                 kOCCppRdOptFlush(pCppRd, offSrcLine, 1);
     1522                if (!(pCppRd->fOptimize & 2))
     1523                    kOCCppRdOptFlush(pCppRd, offSrcLine, 1);
    15241524
    15251525                cchLineDir = kOCCppRdOptFmtLine(pCppRd, uNewLineNo, NULL, 0) - 1; /* sans \n */
     
    15371537
    15381538            kOCCppRdOptSetFile(pCppRd, pszNewFile, cchNewFile); /* save to do this early */
    1539             kOCCppRdOptFlush(pCppRd, offSrcLine, 1);
     1539            if (!(pCppRd->fOptimize & 2))
     1540                kOCCppRdOptFlush(pCppRd, offSrcLine, 1);
    15401541
    15411542            cchLineDir = kOCCppRdOptFmtLine(pCppRd, uNewLineNo, pCppRd->pszFileNmBuf, cchNewFile) - 1; /* sans \n */
     
    38373838    if (!kOCSumHasEqualInChain(&pEntry->Old.SumHead, &pEntry->New.SumHead))
    38383839    {
    3839         InfoMsg(2, "no checksum match - comparing output\n");
    3840         if (!kOCEntryCompareOldAndNewOutput(pEntry))
     3840        if (pEntry->fOptimizeCpp & 2)
     3841        {
     3842            InfoMsg(2, "no checksum match - no need to compare output, -O2.\n");
    38413843            pEntry->fNeedCompiling = 1;
     3844        }
    38423845        else
    3843             kOCSumAddChain(&pEntry->New.SumHead, &pEntry->Old.SumHead);
     3846        {
     3847            InfoMsg(2, "no checksum match - comparing output\n");
     3848            if (!kOCEntryCompareOldAndNewOutput(pEntry))
     3849                pEntry->fNeedCompiling = 1;
     3850            else
     3851                kOCSumAddChain(&pEntry->New.SumHead, &pEntry->Old.SumHead);
     3852        }
    38443853    }
    38453854}
     
    50185027        else if (!strcmp(argv[i], "-O1") || !strcmp(argv[i], "--optimize-1"))
    50195028            fOptimizePreprocessorOutput = 1;
     5029        else if (!strcmp(argv[i], "-O2") || !strcmp(argv[i], "--optimize-2"))
     5030            fOptimizePreprocessorOutput = 1 | 2;
    50205031        else if (!strcmp(argv[i], "-p") || !strcmp(argv[i], "--passthru"))
    50215032            fRedirPreCompStdOut = fRedirCompileStdIn = 1;
     
    51595170    if (fOptimizePreprocessorOutput)
    51605171    {
    5161         InfoMsg(1, "g_cbMemMoved=%#x (%d)\n", g_cbMemMoved, g_cbMemMoved);
    5162         InfoMsg(1, "g_cMemMoves=%#x (%d)\n", g_cMemMoves, g_cMemMoves);
     5172        InfoMsg(3, "g_cbMemMoved=%#x (%d)\n", g_cbMemMoved, g_cbMemMoved);
     5173        InfoMsg(3, "g_cMemMoves=%#x (%d)\n", g_cMemMoves, g_cMemMoves);
    51635174    }
    51645175
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette