-
Enhancement
-
Resolution: Won't Fix
-
P4
-
9
Right now there are two kinds of asserts in the native code. "Asserts", which are enabled in debug builds and not even compiled in production builds, and "Guarantees" which are enabled in both product and debug builds
Asserts are a great way to find issues, but in cases where the problem only happen in production, running with a fastdebug build may not be possible. On the other hand, asserts have a performance impact so enabling all asserts in production is of course not an option
Therefore, I want to suggest a third kind: Asserts/Guarantees that are enabled by default in debug builds, and that are not enabled but can be turned on with a flag in production builds.
I suggest a flag with modules and levels, similar to the verbose flags. An example could be
-Xverify:gc,codegen=full
The levels would allow us to only enable lower impact asserts in environments where performance is critical, and all asserts if more performance impact is acceptable
Once we have this "infrastructure", we can convert some asserts that are debug-only today into guarantees that can be turned on with this flag
Open questions:
* Flag name
- I suggest -Xverify:module,module=level
* Module names
- Can be added as new areas gets asserts converted
* Level names
- Low, medium (default), all?
* API, what are these guarantees called in the code
- guarantee_module(module, level, condition, message)?
Of course, some asserts can't even be turned into these kinds of guarantees as just looking to see if the assert is enabled would be too expensive.
Asserts are a great way to find issues, but in cases where the problem only happen in production, running with a fastdebug build may not be possible. On the other hand, asserts have a performance impact so enabling all asserts in production is of course not an option
Therefore, I want to suggest a third kind: Asserts/Guarantees that are enabled by default in debug builds, and that are not enabled but can be turned on with a flag in production builds.
I suggest a flag with modules and levels, similar to the verbose flags. An example could be
-Xverify:gc,codegen=full
The levels would allow us to only enable lower impact asserts in environments where performance is critical, and all asserts if more performance impact is acceptable
Once we have this "infrastructure", we can convert some asserts that are debug-only today into guarantees that can be turned on with this flag
Open questions:
* Flag name
- I suggest -Xverify:module,module=level
* Module names
- Can be added as new areas gets asserts converted
* Level names
- Low, medium (default), all?
* API, what are these guarantees called in the code
- guarantee_module(module, level, condition, message)?
Of course, some asserts can't even be turned into these kinds of guarantees as just looking to see if the assert is enabled would be too expensive.