Skip to content

Add keyword to support inlining across modules #229

Open
@dalon-work

Description

@dalon-work

The idea is pretty simple: Allow marking public module functions/subroutines with a keyword such as 'inline' or 'export'. This requires the compiler to place the implementation, and not just the interface of the subroutine in the binary module file. Modules that use this 'inlined' module will be able to see the implementation of the subroutine and potentially inline it. The decision to inline or not is left up to the compiler.

This would replace many uses of #include for performance reasons, and would have the greatest benefits for small functions where the function call overhead is comparable to the actual work of the function.

This would give us the benefits of modules, while still allowing an important optimization that fortran currently misses, and removing a preprocessor peril.

You could argue that Link-Time Optimization has already made this idea obsolete, but I'm not convinced LTO has become ubiquitous?

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Clause 14Standard Clause 14: Program units

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions