avr-libc-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-libc-dev] [RFC] Sleeping BOD API


From: Joerg Wunsch
Subject: Re: [avr-libc-dev] [RFC] Sleeping BOD API
Date: Sat, 7 Feb 2009 00:22:17 +0100
User-agent: Mutt/1.5.11

As Weddington, Eric wrote:

> I would say that that comparison is unfair. This is nothing so
> dangerous as self-modifying code. Just because both are unobvious,
> doesn't make them equivalent situations.

Well, the self-modifying code wasn't really dangerous either.  It's
only been unobvious (to the innocent observer -- it's been state of
the art by that time, to some degree).  The instructions were
carefully chosen, and the assembly code used labels to refer to them
(rather than manually counted byte offsets or such).

So it's not quite that unfair, self-modifying code is just no longer
"in fashion" (and quite hard to get at on a Harvard machine anyway :).

> The idea is that you want to make the compiler do as much as
> possible. If it doesn't matter where something should go (like a
> scratch register), then let the compiler pick it for you as it knows
> more about the state of the code.

But the compiler also does exactly that if you spend a syntactical
scratch register to the inline asm statement.  The generated code is
not really different; it's just more obvious to the innocent reader.
It's still the compiler who selects what register to pick, and the
compiler does that based on the situation around the actual call to
that inline asm statement.

I'm tired enough now, both by day time as well as the length of this
discussion. ;-)  If you feel your version is safe, go ahead, but I've
got the impression you weren't so confident about its safety, so that
that triggered your question in the first place.

-- 
cheers, J"org               .-.-.   --... ...--   -.. .  DL8DTL

http://www.sax.de/~joerg/                        NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]