ASSERT_WITH_SECURITY_IMPLICATION -> SECURITY_DCHECK
Some security asserts are too slow. For example having an extra virtual call inside every type cast function. The security asserts are used by clusterfuzz and friends.
Please replace the following macros in your code, except wtf/Vector.h and wtf/HashTable.h.ASSERT -> DCHECK or DCHECK_EQ/NE/LE/LT/GE/GTRELEASE_ASSERT -> CHECK or CHECK_EQ/NE/LE/LT/GE/GTENABLE(ASSERT) -> DCHECK_IS_ON()ASSERT_NO_REACHED() -> NOTREACHED()ASSERT_UNUSED -> DCHECK* and ALLOW_UNUSED_LOCAL() if necessary.ASSERT_WITH_SECURITY_IMPLICATION -> SECURITY_DCHECKAlso, please remove WTF_LOG usage, use VLOG() or DVLOG instead.
It looks we have to guard DCHECK(EXP) by "DCHECK_IS_ON()" if EXP uses what does not *exist* in a release build.e.g.Before:ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden());After:#if DCHECK_IS_ON()DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden());#endifWithout the guard, the compile fails in a release build. Is this an intentional behavior?
On Tue, Apr 5, 2016 at 6:34 AM, Hayato Ito <hay...@chromium.org> wrote:It looks we have to guard DCHECK(EXP) by "DCHECK_IS_ON()" if EXP uses what does not *exist* in a release build.e.g.Before:ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden());After:#if DCHECK_IS_ON()DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden());#endifWithout the guard, the compile fails in a release build. Is this an intentional behavior?DCHECK uses the things passed to it even if they are disabled, to avoid warnings about unused variables.
Please replace the following macros in your code, except wtf/Vector.h and wtf/HashTable.h.ASSERT -> DCHECK or DCHECK_EQ/NE/LE/LT/GE/GTRELEASE_ASSERT -> CHECK or CHECK_EQ/NE/LE/LT/GE/GT
Do you have any update about the performance regression caused by the RELEASE_ASSERT => CHECK replacement?(Since people started using CHECK/DCHECK macros, it would be better if we could fix the regression sooner.)
Do you have any update about the performance regression caused by the RELEASE_ASSERT => CHECK replacement?
This is not ready yet, it needs to be as fast as wtf was for Release builds that are not official builds. Very few people build official builds and few documents even tell you to do it. We can't switch to base things that are slower except in official builds.
This is not ready yet, it needs to be as fast as wtf was for Release builds that are not official builds. Very few people build official builds and few documents even tell you to do it. We can't switch to base things that are slower except in official builds.
On Wed, May 4, 2016 at 1:19 PM, Elliott Sprehn <esp...@chromium.org> wrote:This is not ready yet, it needs to be as fast as wtf was for Release builds that are not official builds. Very few people build official builds and few documents even tell you to do it. We can't switch to base things that are slower except in official builds.
Non-official release builds are not meant to have the same level of performance. Perf bots and anyone doing perf analysis should be using an official build. To do so, add this to your GN args:is_official_build = true
is_chrome_branded = trueYou can find these on the instructions to set up your build: https://www.chromium.org/developers/gn-build-configuration Is there some other documentation you'd like us to fix?This sounds orthogonal to using CHECK vs RELEASE_ASSERT. If anyone has been doing performance measurements in a non-official build until now unfortunately their numbers aren't very accurate. We use different compiler settings for non-official builds as well. Perhaps we should send a PSA of sorts of people are not generally aware they need to build official when doing perf measurements?
On Wed, May 4, 2016 at 1:19 PM, Elliott Sprehn <esp...@chromium.org> wrote:This is not ready yet, it needs to be as fast as wtf was for Release builds that are not official builds. Very few people build official builds and few documents even tell you to do it. We can't switch to base things that are slower except in official builds.
Non-official release builds are not meant to have the same level of performance. Perf bots and anyone doing perf analysis should be using an official build. To do so, add this to your GN args:is_official_build = true
is_chrome_branded = trueYou can find these on the instructions to set up your build: https://www.chromium.org/developers/gn-build-configuration Is there some other documentation you'd like us to fix?This sounds orthogonal to using CHECK vs RELEASE_ASSERT. If anyone has been doing performance measurements in a non-official build until now unfortunately their numbers aren't very accurate. We use different compiler settings for non-official builds as well. Perhaps we should send a PSA of sorts of people are not generally aware they need to build official when doing perf measurements?
On Wed, May 4, 2016 at 1:29 PM, Dana Jansens <dan...@chromium.org> wrote:
...
Yes, exactly. It doesn't make sense to say that Release must have X level of performance because that's not what Release is for. This is unfortunately confusing.There are three optimization levels, Debug, Release, and Official. Many people confuse "official" and "Chrome-branded." The fact that Official is a separate flag I suspect is an artifact of how the Visual Studio build used to be set up. Don't even ask what happens if you set the official flag on a debug build.If it was up to me, we would only have two. But some people like the status quo because they want a compromise between fast-to-execute and fast-to-build. It could be that such people might be happy with a flag to toggle link-time-code-generation (the most significant difference between these builds).And in fact if you ask what Release is, the only definition is really "most optimizations except the really slow ones." Doing benchmarks on such a build is likely to be a waste of time.
Isn't that what we already have? The flag is named buildtype=Dev/Official or is_official_build=false/true.
There were desktop regressions too (see https://bugs.chromium.org/p/chromium/issues/detail?id=599867#c19 and https://bugs.chromium.org/p/chromium/issues/detail?id=599867#c21), I didn't have time to investigate them and I think they still exist.
On Tue, May 10, 2016 at 8:20 AM, Ivan Kotenkov <kote...@yandex-team.ru> wrote:There were desktop regressions too (see https://bugs.chromium.org/p/chromium/issues/detail?id=599867#c19 and https://bugs.chromium.org/p/chromium/issues/detail?id=599867#c21), I didn't have time to investigate them and I think they still exist.Oh I think I confused this with the bug around TLS storage. I do see things get better on windows for that test with the revert, so there must be some codegen difference between CHECK and RELEASE_ASSERT still on official builds.
Does it differ further down? The compiler can probably figure out that IMMEDIATE_CRASH() won't return, but it can't figure this out for BreakDebugger (which can return, if you run chrome under a debugger on Windows). Maybe the knowledge that IMMEDIATE_CRASH() doesn't return helps make optimization decisions. If so, we could change CHECK to not call BreakDebugger().
The performance issue should have been fixed in https://codereview.chromium.org/1937613002
but that was reverted a bit after in https://codereview.chromium.org/2046593002because it broke arm64 breakpad crash detection.It seems like breakpad needs an update. I'm not sure on what timescale that might happen or even if anybody is looking at it. From the revert commit message it doesn't seem very difficult to fix breakpad (just need to handle another signal). Conceivably we could condition the behavior on CPU architecture but that seems like an unfortunate variance best avoided if possible.
The performance issue should have been fixed in https://codereview.chromium.org/1937613002but that was reverted a bit after in https://codereview.chromium.org/2046593002because it broke arm64 breakpad crash detection.It seems like breakpad needs an update. I'm not sure on what timescale that might happen or even if anybody is looking at it.
Yup my plan is to re-land Nico's https://codereview.chromium.org/1982123002/ once the breakpad change sticks and hits dev channel.>It seems like breakpad needs an update. I'm not sure on what timescale that might happen or even if anybody is looking at it. From the revert commit message it doesn't seem very difficult to fix breakpad (just need to handle another signal).Yeah the breakpad change itself it's a one line. It's just that every time we changed a small bit in the signal handling logic we unveiled crazy things happening in the wild *So it's just a matter to figure out if somebody out there is doing something unexpected with SIGTRAP.How urgent is this? My point of waiting for dev channel is to test the two things separately, so if we unexpectedly start losing crash reports on some platforms we at least know that's just due to something else interfering with SIGTRAP and not because of SIGTRAP + us relying on trap for CHECKs.The other option is to do both (breakpad change and the unrevert) now. But if something goes wrong we'll have to revert both and restart from scratch and won't know what caused what.
On Tue, Jun 14, 2016 at 4:24 PM, Primiano Tucci <prim...@chromium.org> wrote:Yup my plan is to re-land Nico's https://codereview.chromium.org/1982123002/ once the breakpad change sticks and hits dev channel.>It seems like breakpad needs an update. I'm not sure on what timescale that might happen or even if anybody is looking at it. From the revert commit message it doesn't seem very difficult to fix breakpad (just need to handle another signal).Yeah the breakpad change itself it's a one line. It's just that every time we changed a small bit in the signal handling logic we unveiled crazy things happening in the wild *So it's just a matter to figure out if somebody out there is doing something unexpected with SIGTRAP.How urgent is this? My point of waiting for dev channel is to test the two things separately, so if we unexpectedly start losing crash reports on some platforms we at least know that's just due to something else interfering with SIGTRAP and not because of SIGTRAP + us relying on trap for CHECKs.The other option is to do both (breakpad change and the unrevert) now. But if something goes wrong we'll have to revert both and restart from scratch and won't know what caused what.I think it's fine to not rush this. Things are moving forward, which I think is probably all haraken wanted to know.
The performance issue should have been fixed in https://codereview.chromium.org/1937613002
but that was reverted a bit after in https://codereview.chromium.org/2046593002because it broke arm64 breakpad crash detection.
Just to be sure, these testes are running in official builds, right? Non-official builds will still have the backtrace/log message printing added which will prevent register optimization across the assertion (in addition to making the code slightly larger which is probably a lesser effect).
class LM {
public:
LM();
~LM();
};
int func1() {
true ? (void) 0 : LM();
return 15;
}
00000000: 55 push ebp
00000001: 8B EC mov ebp,esp
00000003: 51 push ecx
00000004: 83 65 FC 00 and dword ptr [ebp-4],0
00000008: 6A 0F push 0Fh
0000000A: 58 pop eax
0000000B: 8B E5 mov esp,ebp
0000000D: 5D pop ebp
0000000E: C3 ret
The same is true of assigning to a NULL pointer, though, so that
doesn't seem like a strong argument.
On Wed, Feb 1, 2017 at 7:53 AM Scott Hess <sh...@chromium.org> wrote:The same is true of assigning to a NULL pointer, though, so that
doesn't seem like a strong argument.But assigning a null pointer doesn't involve setting up a call frame. IIRC the problem there was coming from setting up a full call frame to call BreakDebugger, because is not no-return (otherwise a jmp would have been roughly as expensive as dereferencing a ptr).Anyways, since this problem came up, I will give it a go to see if the strategy of https://codereview.chromium.org/2502953003/ can be used also with MSVC. (TL;DR emitting the asm instructions that cause a trap without calling a function).It really boils down to:- does MSVC support statement expressions (or something similar)
- will that cause any side-effect (in terms of binary / perf) I am not thinking about?
On Wed, Feb 1, 2017 at 10:00 AM, Primiano Tucci <prim...@google.com> wrote:On Wed, Feb 1, 2017 at 7:53 AM Scott Hess <sh...@chromium.org> wrote:The same is true of assigning to a NULL pointer, though, so that
doesn't seem like a strong argument.But assigning a null pointer doesn't involve setting up a call frame. IIRC the problem there was coming from setting up a full call frame to call BreakDebugger, because is not no-return (otherwise a jmp would have been roughly as expensive as dereferencing a ptr).Anyways, since this problem came up, I will give it a go to see if the strategy of https://codereview.chromium.org/2502953003/ can be used also with MSVC. (TL;DR emitting the asm instructions that cause a trap without calling a function).It really boils down to:- does MSVC support statement expressions (or something similar)No, has to be do {} while(0) or similar.- will that cause any side-effect (in terms of binary / perf) I am not thinking about?Is it BreakDebugger() that's the problem, or __debugbreak()?
I would try the latter first, as it should be "pretty equivalent" to __asm { int 3 }.