ICE due to unsupported target

Timo Sintonen t.sintonen at luukku.com
Sat Mar 8 02:33:29 PST 2014


On Saturday, 8 March 2014 at 09:12:49 UTC, Mike wrote:
> On Saturday, 8 March 2014 at 08:09:29 UTC, Timo Sintonen wrote:
>>
>> Why do you need synchronized? Are you building some kind of 
>> multithreading library?
>
> I don't need it yet.  I'm just exploring features of D and 
> trying to learn how to implement them.  The real problem isn't 
> that I can't use synchronized, but rather that the compiler is 
> not aware of my target.  I haven't searched through GDC's 
> source code yet, but I suspect there will be more problems in 
> the near future if the compiler is not taught about this target.
>
> Mike

Synchronized block tells to the thread scheduler to lock this 
piece of code for this thread. No other thread may enter this 
block while this thread is in it.
The compiler generates a library call that does the work. The 
thread scheduler is operating system dependent and not related to 
hardware.

Anyway, this is valid code and should pass. I have to remove all 
synchronized words when compiling the runtime. "Nothreads" 
directive might be useful, in this case it should just ignore the 
synchronized word.

When there is something os dependent, there should always be a 
nosystem block or default case which has reasonable default 
values or just empty variables/functions if they are not used. In 
D there is version(NoSystem).

In gcc build we know the host we are building and the target we 
are building for. There is only one operating system that the 
generated compiler supports. (or none like in arm-none-eabi) I 
think all operating system related in the compiler should be in 
compile time directives and have no runtime code for that. When 
we get the --with-cpu- etc statements work, we may tune the 
compiler even more.


More information about the D.gnu mailing list