Changeset 2959 in kBuild
- Timestamp:
- Sep 21, 2016 8:53:32 PM (8 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kWorker/kWorker.c
r2957 r2959 96 96 * Keep history of the last jobs. For debugging. */ 97 97 #define WITH_HISTORY 98 99 /** @def WITH_PCH_CACHING 100 * Enables read caching of precompiled header files. */ 101 #if K_ARCH_BITS >= 64 102 # define WITH_PCH_CACHING 103 #endif 98 104 99 105 … … 684 690 /** Set if we're running. */ 685 691 KBOOL fRunning; 692 /** Whether to disable caching of ".pch" files. */ 693 KBOOL fNoPchCaching; 686 694 687 695 /** The command line. */ … … 4965 4973 } 4966 4974 } 4967 #if 0 /* compiler does write+copy mapping, so forget it. */4975 #ifdef WITH_PCH_CACHING 4968 4976 /* Precompiled header: .pch */ 4969 4977 else if (wcFirst == 'p' || wcFirst == 'P') … … 4972 4980 { 4973 4981 if (wcThird == 'h' || wcThird == 'H') 4974 return K_TRUE;4982 return !g_Sandbox.fNoPchCaching; 4975 4983 } 4976 4984 } … … 5107 5115 { 5108 5116 if ( cbFile.QuadPart >= 0 5117 #ifdef WITH_PCH_CACHING 5109 5118 && ( cbFile.QuadPart < 16*1024*1024 5110 || ( cbFile.QuadPart < 64*1024*10245119 || ( cbFile.QuadPart < 96*1024*1024 5111 5120 && pFsObj->cchName > 4 5112 && kHlpStrICompAscii(&pFsObj->pszName[pFsObj->cchName - 4], ".pch") == 0) )) 5121 && !g_Sandbox.fNoPchCaching 5122 && kHlpStrICompAscii(&pFsObj->pszName[pFsObj->cchName - 4], ".pch") == 0) ) 5123 #endif 5124 ) 5113 5125 { 5114 5126 KU32 cbCache = (KU32)cbFile.QuadPart; … … 5715 5727 } 5716 5728 5717 KWFS_LOG(("ReadFile(%p )\n", hFile));5729 KWFS_LOG(("ReadFile(%p,%p,%#x,,)\n", hFile, pvBuffer, cbToRead)); 5718 5730 return ReadFile(hFile, pvBuffer, cbToRead, pcbActuallyRead, pOverlapped); 5719 5731 } … … 6300 6312 else 6301 6313 hMapping = NULL; 6302 KWFS_LOG(("CreateFileMappingW(%p, %u) -> %p [ temp]\n", hFile, fProtect, hMapping));6314 KWFS_LOG(("CreateFileMappingW(%p, %u) -> %p [cached]\n", hFile, fProtect, hMapping)); 6303 6315 return hMapping; 6304 6316 } 6305 kHlpAssertMsgFailed(("fProtect=%#x cb=%#x'%08x name=%p\n", 6306 fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName)); 6307 SetLastError(ERROR_ACCESS_DENIED); 6308 return INVALID_HANDLE_VALUE; 6309 6310 6317 6318 /* Do fallback (for .pch). */ 6319 kHlpAssertMsg(fProtect == PAGE_WRITECOPY, 6320 ("fProtect=%#x cb=%#x'%08x name=%p\n", 6321 fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName)); 6322 6323 hMapping = CreateFileMappingW(hFile, pSecAttrs, fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName); 6324 KWFS_LOG(("CreateFileMappingW(%p, %p, %#x, %#x, %#x, %p) -> %p [cached-fallback]\n", 6325 hFile, pSecAttrs, fProtect, dwMaximumSizeHigh, dwMaximumSizeLow, pwszName, hMapping)); 6326 return hMapping; 6311 6327 } 6312 6328 … … 8760 8776 static int kwSandboxInit(PKWSANDBOX pSandbox, PKWTOOL pTool, 8761 8777 KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, 8762 KU32 cEnvVars, const char **papszEnvVars )8778 KU32 cEnvVars, const char **papszEnvVars, KBOOL fNoPchCaching) 8763 8779 { 8764 8780 PPEB pPeb = kwSandboxGetProcessEnvironmentBlock(); … … 8788 8804 pSandbox->Combined.cFlushes = 0; 8789 8805 #endif 8806 pSandbox->fNoPchCaching = fNoPchCaching; 8790 8807 pSandbox->cArgs = cArgs; 8791 8808 pSandbox->papszArgs = (char **)papszArgs; … … 9200 9217 9201 9218 static int kwSandboxExec(PKWSANDBOX pSandbox, PKWTOOL pTool, KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, 9202 KU32 cEnvVars, const char **papszEnvVars )9219 KU32 cEnvVars, const char **papszEnvVars, KBOOL fNoPchCaching) 9203 9220 { 9204 9221 int rcExit = 42; … … 9208 9225 * Initialize the sandbox environment. 9209 9226 */ 9210 rc = kwSandboxInit(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars );9227 rc = kwSandboxInit(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars, fNoPchCaching); 9211 9228 if (rc == 0) 9212 9229 { … … 9342 9359 * @param cEnvVars The number of environment variables. 9343 9360 * @param papszEnvVars The environment vector. 9361 * @param fNoPchCaching Whether to disable precompiled header file 9362 * caching. Avoid trouble when creating them. 9344 9363 * @param cPostCmdArgs Number of post command arguments (includes cmd). 9345 9364 * @param papszPostCmdArgs The post command and its argument. … … 9347 9366 static int kSubmitHandleJobUnpacked(const char *pszExecutable, const char *pszCwd, 9348 9367 KU32 cArgs, const char **papszArgs, KBOOL fWatcomBrainDamange, 9349 KU32 cEnvVars, const char **papszEnvVars, 9368 KU32 cEnvVars, const char **papszEnvVars, KBOOL fNoPchCaching, 9350 9369 KU32 cPostCmdArgs, const char **papszPostCmdArgs) 9351 9370 { … … 9403 9422 { 9404 9423 KW_LOG(("Sandboxing tool %s\n", pTool->pszPath)); 9405 rcExit = kwSandboxExec(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, cEnvVars, papszEnvVars); 9424 rcExit = kwSandboxExec(&g_Sandbox, pTool, cArgs, papszArgs, fWatcomBrainDamange, 9425 cEnvVars, papszEnvVars, fNoPchCaching); 9406 9426 } 9407 9427 else … … 9537 9557 papszEnvVars[cEnvVars] = 0; 9538 9558 9539 /* Flags (currently just watcom argument brain dama nage). */9540 if (cbMsg >= sizeof(KU8) )9559 /* Flags (currently just watcom argument brain damage and no precompiled header caching). */ 9560 if (cbMsg >= sizeof(KU8) * 2) 9541 9561 { 9542 9562 KBOOL fWatcomBrainDamange = *pszMsg++; 9543 cbMsg--; 9563 KBOOL fNoPchCaching = *pszMsg++; 9564 cbMsg -= 2; 9544 9565 9545 9566 /* Post command argument count (can be zero). */ … … 9577 9598 rcExit = kSubmitHandleJobUnpacked(pszExecutable, pszCwd, 9578 9599 cArgs, papszArgs, fWatcomBrainDamange, 9579 cEnvVars, papszEnvVars, 9600 cEnvVars, papszEnvVars, fNoPchCaching, 9580 9601 cPostCmdArgs, apszPostCmdArgs); 9581 9602 } … … 9718 9739 KU32 cEnvVars; 9719 9740 KBOOL fWatcomBrainDamange = K_FALSE; 9741 KBOOL fNoPchCaching = K_FALSE; 9720 9742 9721 9743 /* … … 9753 9775 } 9754 9776 9777 /* Optional watcom flag directory change. */ 9778 if ( i < argc 9779 && strcmp(argv[i], "--no-pch-caching") == 0) 9780 { 9781 fNoPchCaching = K_TRUE; 9782 i++; 9783 } 9784 9755 9785 /* Trigger breakpoint */ 9756 9786 if ( i < argc … … 9787 9817 rcExit = kSubmitHandleJobUnpacked(argv[i], pszCwd, 9788 9818 argc - i, &argv[i], fWatcomBrainDamange, 9789 cEnvVars, environ, 9819 cEnvVars, environ, fNoPchCaching, 9790 9820 0, NULL); 9791 9821 KW_LOG(("rcExit=%d\n", rcExit)); -
trunk/src/kmk/kmkbuiltin/kSubmit.c
r2918 r2959 574 574 * @param pszCwd The current directory. 575 575 * @param fWatcomBrainDamage The wcc/wcc386 workaround. 576 * @param fNoPchCaching Whether to disable precompiled header caching. 576 577 * @param papszPostCmdArgs The post command and it's arguments. 577 578 * @param cPostCmdArgs Number of post command argument, including the … … 580 581 */ 581 582 static void *kSubmitComposeJobMessage(const char *pszExecutable, char **papszArgs, char **papszEnvVars, 582 const char *pszCwd, int fWatcomBrainDamage, 583 const char *pszCwd, int fWatcomBrainDamage, int fNoPchCaching, 583 584 char **papszPostCmdArgs, uint32_t cPostCmdArgs, uint32_t *pcbMsg) 584 585 { … … 615 616 cEnvVars = i; 616 617 617 cbMsg += 1; 618 cbMsg += 1; /* fWatcomBrainDamage */ 619 cbMsg += 1; /* fNoPchCaching */ 618 620 619 621 cbMsg += sizeof(cPostCmdArgs); … … 667 669 /* flags */ 668 670 *pbCursor++ = fWatcomBrainDamage != 0; 671 *pbCursor++ = fNoPchCaching != 0; 669 672 670 673 /* post command */ … … 1166 1169 fprintf(pOut, 1167 1170 "usage: %s [-Z|--zap-env] [-E|--set <var=val>] [-U|--unset <var=val>]\n" 1168 " [-C|--chdir <dir>] [--wcc-brain-damage] \n"1171 " [-C|--chdir <dir>] [--wcc-brain-damage] [--no-pch-caching]\n" 1169 1172 " [-3|--32-bit] [-6|--64-bit] [-v]\n" 1170 1173 " [-P|--post-cmd <cmd> [args]] -- <program> [args]\n" … … 1189 1192 " Works around wcc and wcc386 (Open Watcom) not following normal\n" 1190 1193 " quoting conventions on Windows, OS/2, and DOS.\n" 1194 " --no-pch-caching\n" 1195 " Do not cache precompiled header files because they're being created.\n" 1191 1196 " -v,--verbose\n" 1192 1197 " More verbose execution.\n" … … 1219 1224 unsigned cBitsWorker = g_cArchBits; 1220 1225 int fWatcomBrainDamage = 0; 1226 int fNoPchCaching = 0; 1221 1227 int cVerbosity = 0; 1222 1228 size_t const cbCwdBuf = GET_PATH_MAX; … … 1274 1280 { 1275 1281 fWatcomBrainDamage = 1; 1282 continue; 1283 } 1284 1285 if (strcmp(pszArg, "no-pch-caching") == 0) 1286 { 1287 fNoPchCaching = 1; 1276 1288 continue; 1277 1289 } … … 1413 1425 uint32_t cbMsg; 1414 1426 void *pvMsg = kSubmitComposeJobMessage(pszExecutable, &argv[iArg], papszEnv, szCwd, 1415 fWatcomBrainDamage, &argv[iPostCmd], cPostCmdArgs, &cbMsg); 1427 fWatcomBrainDamage, fNoPchCaching, 1428 &argv[iPostCmd], cPostCmdArgs, &cbMsg); 1416 1429 PWORKERINSTANCE pWorker = kSubmitSelectWorkSpawnNewIfNecessary(cBitsWorker, cVerbosity); 1417 1430 if (pWorker)
Note:
See TracChangeset
for help on using the changeset viewer.