ARM bare-metal programming in D (cont) - volatile

Russel Winder russel at winder.org.uk
Thu Oct 24 07:53:09 PDT 2013


On Thu, 2013-10-24 at 08:19 +0200, Mike wrote:
[…]
> >
> >     int peek(int* p);
> >     void poke(int* p, int value);
> >
> > Implement them in the obvious way, and compile them separately 
> > so the optimizer will not try to inline/optimize them.
> 
> Thanks for the answer, Walter. I think this would be acceptable 
> in many (most?) cases, but not where high performance is needed  
> I think these functions add too much overhead if they are not 
> inlined and in a critical path (bit-banging IO, for example).  
> Afterall, a read/write to a volatile address is a single atomic 
> instruction, if done properly.
> 
> Is there a way to tell D to remove the function overhead, for 
> example, like a "naked" attribute, yet still retain the 
> "volatile" behavior?

Also this (peek and poke) is not a viable approach if you wanted to
write an operating system in D.

I think it should be an aim to have the replacement for Windows, OS X,
Linux, etc. written in D instead of C/C++.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Digitalmars-d mailing list