gcl-devel
[Top][All Lists]
Advanced

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

Re: [Gcl-devel] Re: [Maxima] Re: Lisp vs. Java vs. C++ speed comparison


From: Paul F. Dietz
Subject: Re: [Gcl-devel] Re: [Maxima] Re: Lisp vs. Java vs. C++ speed comparison time? [LONG]
Date: Mon, 12 Jul 2004 18:43:55 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040514

Camm Maguire wrote:

I suppose the canonical way to do this is to make use of the two least
significant bits in the pointer value on 32bit machines to hold the
type information, but this seems quite expensive as each pointer
indirection must be accompanied by a pointer truncation.

The usual way to do this is to lop off the tag bits using offset
addressing modes (add -1 or 3 to the register before loading the word,
for example; this can be done as part of the load instruction on most
architectures.)

In C, you'd say something like this, I suppose:

   *(long *)(((char *) p) + offset)

and hope this bit of nonstandardization was properly interpreted.
As a bonus, if p were not of the right type, and if the machine
trapped on 32 bit word loads that were not 4 byte aligned, then
this would trap argument type errors even compiled at safety 0.

        Paul






reply via email to

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