Project

General

Profile

Feature #1728

better analysis of function parameters to avoid emitting unnecessary code in business logic

Added by Eric Faulhaber over 11 years ago. Updated over 7 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
32.00 h
billable:
No
vendor_id:
GCD
version_reported:
version_resolved:

History

#1 Updated by Eric Faulhaber over 11 years ago

Avoid emitting unnecessary, top-level instance variables for function parameters, which are later hidden by block-level, local variables of the same name. Avoid initializing the top-level variables in the init() method of the inner subclass of Block which is emitted inside the method which represents the converted function, so long as those top-level instance variables are never needed. There is some scenario where these are needed (not sure what that is at the time of writing), but in other cases, they are declared and initialized, but never subsequently read.

The testcase uast/query-test-for-scrolling.p, for instance, has a function updateRecords(input valOld as int, input valNew as int). The valOld parameter generates both an instance variable in the top-level class QueryTestForScrolling, as well as an instance variable in the anonymous inner subclass of Block within the updateRecords() method. In the init() method of that inner class, QueryTestForScrolling.this.valOld is initialized to the value of the anonymous inner class' valOld variable, but then the top-level valOld is never accessed. Both the top-level class' valOld instance variable, and the initialization of it in the inner class' init() method (and in fact the entire init() method, since this is all that is done there) could be eliminated as a code cleanup optimization.

#2 Updated by Greg Shah over 11 years ago

  • Target version set to Code Improvements

#3 Updated by Greg Shah over 7 years ago

  • Target version deleted (Code Improvements)

Also available in: Atom PDF