Main Page   Modules   Compound List   File List   Compound Members   File Members  

gc.h File Reference

Jaune - Ahead of time Java compiler for small systems. More...

#include "clib.h"

Go to the source code of this file.

Defines

#define JAUNE_GC_H   1
#define Alloc(_a)   __Alloc(_a)

Functions

void InitHeap (void *pBase, UINT uSize)
 Initialise the heap to use the given memory block. More...

void * __Alloc (UINT uSize)
 Attempt to allocate a block of memory out of the heap, returning NULL if there is insufficent space. More...

void * GrowAlloc (void *p, UINT uNewSize)
 Grows the previousally allocated buffer, copying if the block can't be grown in place. More...

void Free (void *p)
 Frees a previousally allocated block. More...

UINT GetAvailableHeap (void)
 Returns a rough estimate of the available heap space. More...

UINT RunGarbageCollectorInt (void **pStack, UINT nInStack, void **pStatic, UINT nInStatic)
 Runs the garbage collector using the given data as the root set. More...

UINT RunGarbageCollector (void)
void SetupGarbageCollector (UINT16 *pTopOfStack, void **pStatics, UINT nInStatic)
void DumpHeapState (void)
 Dumps the heap state to stdout.


Detailed Description

Jaune - Ahead of time Java compiler for small systems.

Author:
Copyright Michael Hope 2002 <michaelh@juju.net.nz> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.
Id:
gc.h,v 1.1.1.1 2002/04/23 03:42:57 michaelh Exp


Function Documentation

void* __Alloc UINT    uSize
 

Attempt to allocate a block of memory out of the heap, returning NULL if there is insufficent space.

Zeros the returned block.

void Free void *    p
 

Frees a previousally allocated block.

Will fail if the passed in pointer is invalid.

UINT GetAvailableHeap void   
 

Returns a rough estimate of the available heap space.

Returns the sum of all free space, which may not be contigious and allocatable.

void* GrowAlloc void *    p,
UINT    uNewSize
 

Grows the previousally allocated buffer, copying if the block can't be grown in place.

Zeros the new area.

Parameters:
p  Base of the current block. If null, equvalient to Alloc()

void InitHeap void *    pBase,
UINT    uSize
 

Initialise the heap to use the given memory block.

Completely resets the heap. Note that the total free space will be less than that fed in due to the headers.

UINT RunGarbageCollectorInt void **    pStack,
UINT    nInStack,
void **    pStatic,
UINT    nInStatic
 

Runs the garbage collector using the given data as the root set.

Returns the number of blocks that were returned to the free pool. The root set is made up of the stack and the static data. The system assumes that both the static data and stack are pointer alligned. For example, on the z80 you cannot store a byte as a byte on the stack, as this will skew the remainder of the stack.

Parameters:
pStack  Pointer to the bottom of the stack.
nInStack  The number of pointers in the stack. Not the number of bytes.
pStatic  Pointer to the start of the static data area.
nInStatic  The number of pointers in the static data area.


Generated on Sat May 11 15:15:41 2002 for JauneRuntimeclib by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002