[M3devel] [M3commit] [modula3/cm3] 90b335: Fix special-case passing of static link parameter.

Rodney M. Bates rodney_bates at lcwb.coop
Sun Aug 27 18:33:41 CEST 2017

I really would not have expected gcc and C backends to interoperate in this way, while
still working with a range of standard C compilers.  In fact, I am gratifyingly surprised
gcc and llvm backends do.  But this does not detract from the C backend's major goal
of simplifying porting and bootstrapping on new machines and architectures.

What I would be really love to have is inter-language binary compatibility between Modula3
and C++ dispatching method calls, at least in the absence of multiple inheritance.  But
that would probably be quite difficult and entail changes in Modula3's current runtime
model--a big and disruptive job.

On 08/24/2017 06:27 PM, Jay K wrote:
> Fyi the C backend completely works here, but everything must be compiled with the same backend, and gcc and C backend do not interoperate -- they pass the static link differently.
> - Jay
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* M3commit <m3commit-bounces at elegosoft.com> on behalf of GitHub <noreply at github.com>
> *Sent:* Thursday, August 24, 2017 3:32:53 PM
> *To:* m3commit at elegosoft.com
> *Subject:* [M3commit] [modula3/cm3] 90b335: Fix special-case passing of static link parameter.
>   Branch: refs/heads/master
>   Home:   https://github.com/modula3/cm3
>   Commit: 90b335e7ae53393d9dfc78f690e39a7cad49e086
>       https://github.com/modula3/cm3/commit/90b335e7ae53393d9dfc78f690e39a7cad49e086
>   Author: Rodney Bates <rodney.m.bates at acm.org>
>   Date:   2017-08-24 (Thu, 24 Aug 2017)
>   Changed paths:
>     M m3-sys/llvm3.6.1/src/M3CG_LLVM.m3
>   Log Message:
>   -----------
>   Fix special-case passing of static link parameter.
> Add the llvm 'nest' attribute to the static link parameter, both
> for direct and indirect calls.  This causes llvm to pass this
> parameter in the way the target ABI specifies for a static link.
> Without this, everything was almost working except for execution
> of a finally block when an exception propagated through it.  This
> would probably have worked too, if the runtime were also compiled
> with the llvm backend.  But RTExFrame passes a static link to user
> code, and, if compiled by different back ends, these were using
> different parameter conventions.
> With this change, all test cases that pass using the gcc back end
> also pass using the llvm backend, plus one more (p140).  Also, llvm
> incorrectly shows a failure on p004.  This is only a reordering
> of warning messages produced by the front end, which is asked to
> unnest nested procedures in different order by these two back ends.
> This is with mixing m3cc-compiled runtime and llvm-compiled test
> cases, which bodes well for interoperability of these back ends.
> _______________________________________________
> M3commit mailing list
> M3commit at elegosoft.com
> https://m3lists.elegosoft.com/mailman/listinfo/m3commit

Rodney Bates
rodney.m.bates at acm.org

More information about the M3devel mailing list