[comp.lang.scheme.c] Large heap

ruf@dolores.Stanford.EDU (Erik Ruf) (05/09/90)

I'm running CScheme 7(beta) on HP9000/350's, using the compiled
runtime system and the Liar compiler.  My problem is that, by default,
the system uses only 24 address bits, limiting me to a 16MB heap (i.e.
1 mega-cons) which is (unfortunately) too small for my current
application (yes, I know that's a lot of memory, but it's true).

I need a larger address space.  What do I need to change to make this
happen?  It seems that I can recompile without setting the
Heap_In_Low_Memory flag, which will move the tags out of the address,
and give me a 32-bit address.  I have two questions about this method:

1. Will it work?  (i.e. is setting "hp9k300" compatible with not
setting "Heap_In_Low_Memory", or are there other dependencies that
will break it?).

2. If it does work, will the compiled runtime and the Liar compiler
continue to work, or are they dependent on the address encoding?  Is
there any way for me to get a larger address space without being
forced back into interpreted code?

Also, will using "bchscheme" help me at all?  It would free up the
spare heap's worth of memory, but wouldn't the spare address bit I
gain by this simply be used up for pointing into the disk storage?

Any advice from the CScheme implementors or other hackers of the
CScheme internals would be appreciated.

-- Erik

cph@ZURICH.AI.MIT.EDU (Chris Hanson) (05/09/90)

   Date: 9 May 90 07:21:46 GMT
   From: eos!shelby!cis!ruf@ames.arpa  (Erik Ruf)

   I'm running CScheme 7(beta) on HP9000/350's, using the compiled
   runtime system and the Liar compiler.  My problem is that, by default,
   the system uses only 24 address bits, limiting me to a 16MB heap (i.e.
   1 mega-cons) which is (unfortunately) too small for my current
   application (yes, I know that's a lot of memory, but it's true).

   I need a larger address space.  What do I need to change to make this
   happen?  It seems that I can recompile without setting the
   Heap_In_Low_Memory flag, which will move the tags out of the address,
   and give me a 32-bit address.  I have two questions about this method:

Disabling `Heap_In_Low_Memory' does not change the number of address
bits, it only changes how they are interpreted -- and at a significant
performance penalty.  When this flag is not set, Scheme assumes that
the address part of an object is a byte offset from a base address
that is initialized when Scheme is started.  Every memory reference
thus has extra instructions to add this base address to the byte
offset.

In your case, the savings will be minimal: the only additional space
gained is that occupied by the C code and its static data.

   1. Will it work?  (i.e. is setting "hp9k300" compatible with not
   setting "Heap_In_Low_Memory", or are there other dependencies that
   will break it?).

It should work, but I wouldn't suggest it.

   2. If it does work, will the compiled runtime and the Liar compiler
   continue to work, or are they dependent on the address encoding?  Is
   there any way for me to get a larger address space without being
   forced back into interpreted code?

The compiled code won't work unless `Heap_In_Low_Memory' is set.

   Also, will using "bchscheme" help me at all?  It would free up the
   spare heap's worth of memory, but wouldn't the spare address bit I
   gain by this simply be used up for pointing into the disk storage?

Using `bchscheme' does give you extra space -- the disk storage is not
part of your address space.  However, you won't get an extra address
bit -- you only double the amount of heap space available -- because
the space used to hold Scheme code and C code is not part of the heap.

The next distribution of Scheme (don't ask when) has a 26-bit address
space, which should alleviate your problem.