fetchClassOf & commonSend?

Scott A Crosby crosby at qwes.math.cmu.edu
Sat Dec 15 19:24:20 UTC 2001


On Sat, 15 Dec 2001, Tim Rowledge wrote:

> Scott A Crosby wrote:
> >
> > Interesting... Got a URL describing how VW works? I might be able to
> > borrow a lot of tricks from them.

> VW is a proprietary system; I know of no legally available document
> giving all the details. Take care with borrowing tricks from a

Drat. Anyone else know of any?

> >
> > I can see how knowing that the primitive's execution time is would be
> > useful if for some reason you don't want or can't keep some sort of
> > ITIMER-like tick-counter. Otherwise, ITIMER-like counting is cheap, a
> > memory load, a test, and a (predictable) branch.

> Like I said. Cross-platform. Not all platforms have the same
> characteristics as linux on an x86. Hell, not all linux/x86 systems have
> the same characteristics!
>
> If using a timer is good on some platforms and poor on others, and if
> the simple and elegant heuristic Andreas put forward should for some
> reason be bad for some platforms, then we need to abstract the
> "execution time of primitives" problem to a higher level and handle the
> details to suit each platform.

I don't understand what you're saying in this paragraph. The system timers
are by nature platform specific, with platform-specific costs. The squeak
timers are implemented by code that runs on top of the system timers, and
can use the underlying system timers in whatever fashion it wishes.

I look at Andreas solution as being hard to maintain, in that there
will be special cases of what named primitives are invoked too frequently
that reading the clock shouldn't be done, or what numbered primitives
might run too long that you should read the clock.

I believe a few of these exceptions have already been enumerated on the
list.  I certainly don't want to have to go through every primitive to
decide if it needs an exception. Or, require future primitive writers
decide if they need an exception.

Ergo, my suggestion to use something general, inspired by the ITIMER
technique.

Requirments for the ITIMER technique:
   You can get the system to deincrement some variable every 10ms or so.

This can be implemented in any one of several ways:
 1. set up some sort of system alarm, signal, or interrupt (SIGALARM) that
deincrements a counter every 10ms as appropriate.
 2. Hope there's a low-res system timer thats cheap to access, and
deincrement the counter if 10 has passed as measured by that timer.
 3. Access an expensive high-res system timer, and decrement it if 10ms
have passed as measured by that timer.

So, can we get #1 on all of the platforms we're interested in? If so, then
Andreas solution probably isn't necessary. If we can get #2 on the
remaining platforms, then things rest on the definiton of 'cheap to
access'.

Or, have a flag, settable from within squeak, that we can turn on when we
don't care so much about realtime behaivor and disables all time-checking
on primitives.



Scott






More information about the Squeak-dev mailing list