Split external symbol prototypes (EF_) (Trac #11395)
ClosedPublic

Authored by trofi on Mar 5 2016, 5:34 PM.

Details

Summary

Before the patch both Cmm and C symbols were declared
with 'EF_' macro:

#define EF_(f)    extern StgFunPtr f()

but for Cmm symbols we know exact prototypes.

The patch splits there prototypes in to:

#define EFF_(f)   void f() /* See Note [External function prototypes] */
#define EF_(f)    StgFunPtr f(void)

Cmm functions are 'EF_' (External Functions),
C functions are 'EFF_' (External Foreign Functions).

While at it changed external C function prototype
to return 'void' to workaround ghc bug on m68k.
Described in detail in Trac Trac #11395.

This makes simple tests work on m68k-linux target!

Thanks to Michael Karcher for awesome analysis
happening in Trac Trac #11395.

Signed-off-by: Sergei Trofimovich <siarheit@google.com>

Test Plan

ran "hello world" on m68k successfully

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
trofi updated this revision to Diff 6839.Mar 5 2016, 5:34 PM
trofi retitled this revision from to Split external symbol prototypes (EF_) (Trac #11395).
trofi updated this object.
trofi edited the test plan for this revision. (Show Details)
trofi added a reviewer: simonmar.
trofi updated the Trac tickets for this revision.
trofi updated this revision to Diff 6840.Mar 5 2016, 5:47 PM
trofi edited edge metadata.

Fixed UNREG prof build: enterFunCCS and pushCostCentre are C functions

trofi updated this revision to Diff 6842.Mar 6 2016, 4:48 AM
trofi edited edge metadata.

Updated 'enterFunCCS' and 'pushCostCentre' to match '.hc'-generated calls.

Fixes UNREG-prof build flavour.

bgamari requested changes to this revision.Mar 7 2016, 7:34 AM
bgamari edited edge metadata.

Good catch; Patch looks sensible although I have one request inline.

includes/Stg.h
230–239

There should really be an explanation here of what "EFF" stands for.

This revision now requires changes to proceed.Mar 7 2016, 7:34 AM
trofi updated this revision to Diff 6847.Mar 7 2016, 3:23 PM
trofi edited edge metadata.

Added 'EF_' and 'EFF_' descriptions to Stg.h.

trofi marked an inline comment as done.Mar 7 2016, 3:24 PM
trofi added inline comments.
includes/Stg.h
230–240

Makes perfect sense! Added.

bgamari requested changes to this revision.Mar 7 2016, 3:50 PM
bgamari edited edge metadata.

Thanks for handling that. Just one last thing.

includes/Stg.h
230–240

Thanks!

includes/stg/MiscClosures.h
496

Hmmm, what is the reason for this change? I think a better comment here may be useful as well.

Sorry I didn't catch this during the first round of reviews.

This revision now requires changes to proceed.Mar 7 2016, 3:50 PM
trofi updated this revision to Diff 6850.Mar 7 2016, 4:42 PM
trofi edited edge metadata.
trofi marked an inline comment as done.

Extended comment around magically looking propotypes for 'enterFunCCS' and 'pushCostCentre'.

bgamari accepted this revision.Mar 7 2016, 4:43 PM
bgamari edited edge metadata.

Great! Thanks again @trofi!

This revision is now accepted and ready to land.Mar 7 2016, 4:43 PM
trofi marked an inline comment as done.Mar 7 2016, 4:44 PM
trofi added inline comments.
includes/stg/MiscClosures.h
496

Tried to clarify magic change.

This revision was automatically updated to reflect the committed changes.
trofi marked an inline comment as done.