
When I introduced them in the first place they were used for positive offsets within StackAreas and heap objects. Both are organised with the zeroth byte of the stack area or heap object being at the lowest address.
It's true that a positive offset from the beginning of a block of contiguous freshly-allocated heap objects will turn into a negative displacement from the actual, physical heap pointer. If ByteOff is used for both purpose then yes there will be negative ones.
More than that I cannot say. They may well be being used for other purposes by now.
One thought is that the profiling word appears just *before* the start of a heap object, so that might need a negative offset, but it seems like a rather special case.
Simon
| -----Original Message-----
| From: Simon Marlow [mailto:marlowsd@gmail.com]
| Sent: 07 August 2014 15:26
| To: Simon Peyton Jones; Johan Tibell
| Cc: ghc-devs@haskell.org
| Subject: Re: Improving the Int/Word story inside GHC
|
| Hmm, surely these are used for negative offsets a lot? All Hp-relative
| indices are negative (but virtual Hp offsets are positive), and Sp-
| relative indices can be both negative and positive.
|
| On 07/08/2014 12:49, Simon Peyton Jones wrote:
| > I’m all for it!
| >
| > I believe that ByteOff/WordOff are always 0 or positive. At least,
| > they were when I introduced them!
| >
| > SImon
| >
| > *From:*ghc-devs [mailto:ghc-devs-bounces@haskell.org] *On Behalf Of
| > *Johan Tibell
| > *Sent:* 07 August 2014 12:21
| > *To:* Simon Marlow
| > *Cc:* ghc-devs@haskell.org
| > *Subject:* Re: Improving the Int/Word story inside GHC
| >
| > Simon M, is the intention of ByteOff and WordOff that they should be
| > able to represent negative quantities as well? If so we might need to
| > split it into ByteOff (still an Int) and ByteIndex (a Word) to have a
| > type for indexing into arrays.
| >
| > On Thu, Aug 7, 2014 at 1:16 PM, Edward Z. Yang