PR# 13792 RTIV2 and RTVI2 macros should not be emitted for finalized code if no invariants checked
Problem Report Summary
Submitter: prestoat2000
Category: Compiler
Priority: Medium
Date: 2007/12/19
Class: Feature Request
Severity: Serious
Number: 13792
Release: 6.1.71477
Confidential: No
Status: Analyzed
Responsible:
Environment: Mozilla/5.0 (X11; U; SunOS sun4u; en-US; rv:1.8.0.7) Gecko/20060915 Firefox/1.5.0.7
Solaris 9 on SPARC
Synopsis: RTIV2 and RTVI2 macros should not be emitted for finalized code if no invariants checked
Description
When finalizing an application and keeping assertions, a small optimization would be nice. For the very common case where none of the classes requests monitoring of class invariants, the RTIV2 and RTVI2 macros should not be emitted. If even one class requests invariant monitoring, then it would be OK to emit these macros everywhere, if it is too tricky to figure out which classes may need them.
To Reproduce
Problem Report Interactions
It would be nice if you could also eliminate other assertions if they aren't checked for any classes. The biggest win for us would be if code to check postconditions, invariants and check assertions was not emitted in finalized mode if no class requests this level of checking. I think it would make our executable significantly smaller. We run in production with preconditions on for some of our more critical applications. Even better if you could eliminate generation of assertions selectively in finalized mode, but for most cases skipping generation of a particular type of assertion such as postcondition if no class requests postcondition monitoring would be good enough.