fixing an issue for single thread mode where the IOSystem is starved and loading goes into an infinite loop, this change may be pushing other issues under the rug, but for now checking it in as it has a limited fallout, if any.
#codereview Robert.Manuszewski@epicgames.com
[CL 2547766 by Ankit Khare in Main branch]
These changes allow UE4 to compile and run (in Debug) on Clang 3.7 alpha (r231657 only!)
- Disabled editor source file discovery (crashes with Clang currently)
- Disabled FThreadIdleStats in UnrealHeaderTool with Clang on Windows (causes link errors due to inlining bugs with Clang and DLL imports)
- Use MSVC linker by default, even when compiling with Clang (can be tweaked with bAllowClangLinker)
- Enabled shadow variable warnings on Windows with Clang
- Limited max size of reflection code source files (Clang on Windows crashes with huge source files)
- Fixed UE4 deprecation warnings not showing up when using Clang on Windows
- Make sure initialization list order only triggers a warning on Clang for Windows
Other changes:
- Fixed issues with pushed pragmas not getting popped (PRAGMA_ENABLE_DEPRECATION_WARNINGS)
- Removed EMIT_DEPRECATED_WARNING_MESSAGE, wasn't used
- Fixed various third party library includes not being treated as system headers (prevents compiler warnings)
To test Clang on Windows (beta!!):
- Get latest UE4 main branch (4.9)
- Install LLVM+Clang for Windows version r231657. It's a quick install, you don't need to compile anything yourself.
- Open UEBuildWindows.cs, and change bCompileWithClang to true. Be careful not to check that in. We'll probably make this config-driven later, after the Clang toolchain gets more mature.
- Switch to Debug Editor configuration. (See below for more info.)
- Rebuild the game or engine
Notes:
- You must use Clang r231657 (3.7.0 alpha). There are no other releases that I've found that are able to compile UE4 successfully. Most of the newer releases crash during compiling, and older releases aren't able to digest Windows header files well enough.
- Compiling in Development currently will not work due to bugs with Clangs handling of inlining and DLL exports. Monolithic builds should work, though.
- Occasionally you may see runtime crashes (stack overflows or access violations) when running UE4 compiled with Clang on Windows. These may very well be bugs in Clang (remember, we're using an alpha release of Clang 3.7.0.) Unfortunately without better debugger support, it can be difficult to workaround these
- When debugging, you will only have functions and line numbers, no variables or parameters. Clang only has preliminary support for Microsoft's PDB format currently.
XGE is fully supported with Clang on Windows. Best case rebuild times I've seen are 3.5 minutes in Debug.
- Shared PCHs aren't supported yet (similar to on Mac and Linux), so iterative compile times may be slower compared to Visual C++. However the Clang compiler is actually quite fast for rebuilds, probably because of missing debug info though.
- There may be some compiler warnings that are different between Mac/Linux and Windows. We haven't done a line-by-line comparison yet.
- Build products and executables for Clang and VC++ overlap on disk. So you have to rebuild to switch back and forth. Sorry.
- Clang on Windows has a few bugs that we've had to work around. You might see some strange things from time to time. Every new release of Clang has different behavior on Windows.
- We still use the VC++ Linker, even when compiling using Clang. The new Clang linker (lld.exe) can be enabled with bAllowClangLinker but it will crash when linking some modules. It also doesn't produce usable debug symbols by Visual Studio (yet).
#codereview mikolaj.sieluzycki
[CL 2532260 by Mike Fricker in Main branch]
- Removed lambdas and TFunctions from FArchiveAsync (this was the culprit of the regression)
- Added THREADSAFE_UOBJECTS to easily disable UObject multithreading safety and potential overhead (not that it even exists)
- Moved a few functions so that they're not called too often (they come up in profiles)
UE-14282
#lockdown Zachary.EdgertonJones
[CL 2522599 by Robert Manuszewski in Main branch]
#UE4 Wrapped expensive stat gathering in #if LOOKING_FOR_PERF_ISSUES and added a yield when flushing async loading in a multithreaded environment
--------
Integrated using branch Ue4-To-UE4-Fortnite-Simple (reversed) of change#2519624 by Bob.Tellez on 2015/04/21 14:14:05.
[CL 2519625 by Bob Tellez in Main branch]
#UE4 Reducing TickAsyncLoadingGameThread stat spam by opening the stat section at callsites.
--------
Integrated using branch Ue4-To-UE4-Fortnite-Simple (reversed) of change#2517702 by Bob.Tellez on 2015/04/20 11:44:04.
[CL 2517706 by Bob Tellez in Main branch]
- changed an assert to a warning when calling LoadObject in PostLoad
- added an opt-out ability for IsTimeLimitExceeded warning
- added descriptions of the current work performed during async loading for IsTimeLimitExceeded warning
- made sure we don't check IsTimeLimitExceeded when we already know we timed out.
[CL 2515757 by Robert Manuszewski in Main branch]
#UE4 Fix to reduce calls to Seconds() to improve performance on VMs. UE-13843
--------
Integrated using branch Ue4-To-UE4-Fortnite-Simple (reversed) of change#2515314 by Bob.Tellez on 2015/04/16 21:33:22.
[CL 2515315 by Bob Tellez in Main branch]
- FUnresolvedStructTracker
- FUniqueObjectGuid
- FLinkerManager
- FStringAssetReference
- FUObjectAnnotationDense
[CL 2507007 by Robert Manuszewski in Main branch]
- removed counters so that async loading stats group can be verbose again
- added a new async loading stats group for game-thread-only stats tracking
- made IsTimeLimitExceeded more aggresive with warnings when the limit is exceeded (reduced the warning threshold from 2.5 to 1.5 * limit)
- made LinkerLoad stats verbose again
- IO blocking will now be reported if it happens on game thread only
[CL 2506386 by Robert Manuszewski in Main branch]