1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
|
/*-----------------------------------------------------------------*-C-*---
* File: handc/runtime/stakcach.h
*
* Copyright (C)1997 Donovan Kolbly <d.kolbly@rscheme.org>
* as part of the RScheme project, licensed for free use.
* See <http://www.rscheme.org/> for the latest information.
*
* File version: 1.5
* File mod date: 1997.11.29 23:10:49
* System build: v0.7.2, 97.12.21
*
* Purpose: cached continuation stack implementation
*------------------------------------------------------------------------*/
#ifndef _H_STAKCACH
#define _H_STAKCACH
#include <rscheme/runtime.h>
#include <rscheme/vinsns.h>
#include <rscheme/smemory.h>
#include <rscheme/gcserver.h>
#define CACHE_INTERIOR_SIZE (1000)
#define CACHE_SIZE (CACHE_INTERIOR_SIZE+IMPL_ARG_LIMIT)
extern obj the_stack_cache[CACHE_SIZE];
#define CACHE_POSN(i) (((UINT_32)(&the_stack_cache[i])) + POINTER_TAG)
#define MAX_FRAME_SIZE (IMPL_ARG_LIMIT+CONT_FIXED)
#define cache_upper_limit CACHE_POSN(CACHE_SIZE)
#define cache_lower_limit CACHE_POSN(0)
#define cache_lower_margin CACHE_POSN(MAX_FRAME_SIZE)
CIH_DECL UINT_32 alloc_cache_frame( unsigned num_slots );
CIH_DECL obj *push_cont( jump_addr label, unsigned reg_space );
CIH_DECL void cache_iterator_reset( void );
CIH_DECL void *cache_iterator_next( void );
CIH_DECL rs_bool in_stack_cache( obj value );
void flush_stack_cache( void );
void init_stack_cache( void );
unsigned restore_arb( void ); /* restore run-time dep't # regs */
#ifdef INLINES
#include <rscheme/stakcach.ci>
#endif /* INLINES */
/*
* Note that filling in the partial continuation,
* doesn't require a write barrier because we are only
* filling in the slots of a freshly created partial-continuation
* which is for-sure in the stack cache
*/
#define SET_PARTCONT_REG(reg,value) frame[reg] = value
#define PUSH_PARTCONT_ADDR(addr,space) obj *frame = push_cont(addr,space)
#define PARTCONT_REF(i) (((obj *)(VAL(continuation_reg)-POINTER_TAG))[i])
#endif /* _H_STAKCACH */
|