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

Rodney M. Bates rodney_bates at lcwb.coop
Mon Aug 28 21:25:27 CEST 2017

On 08/27/2017 07:59 PM, Jay K wrote:
> 1. Thank you-- the C backend is under-understood & under appreciated.

You're welcome.

> 2. This should be easy -- Modula-3
> object methods are presumably like C++ virtual member functions.
> There are some challenges to interop. One would want cm3
> to generate headers & maybe glue code-- stuff around GC.

I think of two things.

1. Dispatching method calls.  There is the C++ vtable mechanism that I
    have never looked at.  It seems to be a runtime description of types,
    and it is unclear whether it is purely implementation, or whether
    the language itself must have some knowledge.  I can hardly imagine
    that our runtime dispatching mechanism is binary compatible.  Fortunately,
    we have only one.  I'm not sure if that is true of the many C++ compilers.

2. Runtime type checks, NARROW, ISTYPE, TYPECASE, and their C++ equivalents.
    These would have to use the same runtime depiction of types too.  This
    would greatly improve the safely of bindings, which now must lose this
    information entirely.

Other things don't seem as daunting.

> - Jay
> ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
> *From:* Rodney M. Bates <rodney_bates at lcwb.coop>
> *Sent:* Sunday, August 27, 2017 9:33:41 AM
> *To:* m3devel; Jay
> *Subject:* Re: [M3commit] [modula3/cm3] 90b335: Fix special-case passing of static link parameter.
> 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-- 
Rodney Bates
rodney.m.bates at acm.org

More information about the M3devel mailing list