emacs-pretest-bug
[Top][All Lists]
Advanced

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

Re: Heap corruption?


From: Kim F. Storm
Subject: Re: Heap corruption?
Date: 20 Aug 2003 18:01:43 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

address@hidden (Gerd Moellmann) writes:

> > What is "Lisp-addessable memory", and what's special about it on
> > FreeBSD?
> 
> Think tag bits: an address that has a bit set that is also a tag bit
> cannot be used for Lisp objects.  On FreeBSD, a process virtual memory
> layout is such that Emacs can use ca. 90 Mb for Lisp objects.  After
> that, addresses get too large for encoding in a Lisp_Object.

I wonder how any simple masking scheme can ever be guaranteed to work
on all systems ... and obviously it has hit this limitation on FreeBSD.

Wouldn't it be better -- at least as a compile-time option -- to implement
a scheme where a lisp object is referenced as a relative (BLOCK#, OFFSET) 
address where BLOCK# is the number of a block allocated with malloc and
OFFSET is the offset into that block.  

Then you can malloc/realloc a table which maps BLOCK# -> phys address,
and the macros which cvt a Lisp_Object L to a reference should do

  (block2addr[(L>>BLOCKNO_SHIFT) & BLOCKNO_MASK] + (L&OFFSET_MASK))

or if offsets are known to be on an 8 byte boundary, this will do even better:

  (block2addr[(L>>BLOCKNO_SHIFT) & BLOCKNO_MASK] + ((L&OFFSET_MASK)<<3))

-- 
Kim F. Storm  http://www.cua.dk





reply via email to

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