Testing GDC (GCC 7.1) on Runtime-less ARM Cortex-M

Mike via D.gnu d.gnu at puremagic.com
Sun Jun 25 03:18:04 PDT 2017


This is just an experience report for those who might be 
interested.

Given this pull request 
(https://github.com/D-Programming-GDC/GDC/pull/456) I thought I'd 
try testing a more recent GDC with my STM32 demo 
(https://github.com/JinShil/stm32f42_discovery_demo) and see what 
the state of things is.  Here are my results.

TypeInfo Stubs
===============
I was able to reduce object.d down to the following:

-- object.d --
module object;

alias size_t    = typeof(int.sizeof);
alias ptrdiff_t = typeof(cast(void*)0 - cast(void*)0);

alias string = immutable(char)[];

class Object
{ }

class TypeInfo
{ }

class TypeInfo_Const : TypeInfo
{
     size_t getHash(in void *p) const nothrow { return 0; }
}
----------------------

I wasn't able to completely omit TypeInfo because for some reason 
the compiler is still looking for `getHash` in `TypeInfo_Const`.

-- output from gdc --
object.d:1:1: error: class object.TypeInfo_Const is forward 
referenced when looking for 'getHash'
  module object;
  ^
cc1d: error: no property 'getHash' for type 
'object.TypeInfo_Const'
-----------------------

But, most of the `TypeInfo` stubs are no longer required.

TypeInfo Bloat
===============
Unfortunately the TypeInfo bloat documented here 
(https://issues.dlang.org/show_bug.cgi?id=14758) is still there.  
I suppose that's to be expected as it appears the aforementioned 
pull request only removed the need to write `TypeInfo` stubs.

Binary size for the STM32 demo is about 600kB when it should be 
more like 6kB.

Compile Speed
=============
It takes about 1 minute 30 seconds to build and link the STM32 
demo resulting in a 6kB binary.  That's pretty bad, but I suspect 
that's a DMD CTFE problem.

Mike


More information about the D.gnu mailing list