X3J3/96-076 Date: April 29, 1996 To: X3J3 From: Kurt W. Hirchert Subject: JOR Item 110 110 In-line procedures <KEYWORDS> PROCEDURE, IN-LINE <STATUS> Registered <TARGET> <SUBGROUP> <VERSION> 1 <REQUIREMENT> Provide a means for a programmer to specify that the desired implementation of that procedure is by in-line expansion of the code at the point of reference to the procedure rather than branch to and return from a single code image. <JUSTIFICATION> In almost any programming method involving significant data abstraction (including, but not limited to, object-oriented programming), there tend to be a number of procedures which bridge levels of abstraction, but which do little "real" work. In-line expansion of such procedures significantly reduces their cost. In addition, there tends to increased opportunities for optimization in the calling scoping unit. [The value of in-line expansion of statement functions is well known and an example of what this requirement would provide in a somewhat broader context.] <SUGGESTED IMPLEMENTATION> Allow a keyword such as INLINE on the procedure header. Since we cannot reasonably directly require in-line expansion, the semantics of this keyword are to prohibit obstacles to in-line expansion: o The INLINE keywords would be permitted on module procedures and internal procedures, but not external procedures or interface bodies. o A procedure could not be both INLINE and RECURSIVE. o An INLINE procedure could not be associated with a dummy procedure (nor with a pointer to a procedure, if we add those). We would have to leave it to market pressure to actually ensure that INLINE procedures are expanded in-line. <ESTIMATED IMPACT> The impact on the document should be well localized. Impact on existing processors will vary: A processor wishing to meet the literal requirements (without actually doing in-line expansion) could do so with a small amount of syntax checking. Typically, existing processors already do at least some in-line expansion (for statement functions) and some do in-line expansion of arbitrary procedures, but it seems likely that it will vary from processor whether the existing in-line expansion infrastructure is sufficient for doing the kind of expansion expected in this requirement. <SUBMITTED BY> Kurt W. Hirchert, hirchert@ncsa.uiuc.edu <HISTORY> <EVENT> 29 April 96: submitted </HISTORY> </FORTREQ> -- Kurt W. Hirchert hirchert@ncsa.uiuc.edu National Center for Supercomputing Applications