Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!sunybcs!rutgers!aramis.rutgers.edu!paul.rutgers.edu!jac From: jac@paul.rutgers.edu (Jonathan A. Chandross) Newsgroups: comp.arch Subject: Re: GC triggering and stack limit checking by MMU hardware Keywords: GC, stack, heap, MMU Message-ID: Date: 20 Jul 90 23:20:26 GMT References: <1990Jul19.151524.22544@diku.dk> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 39 [ note editing of newsgroups line ] torbenm@diku.dk (Torben [gidius Mogensen) > Most implementations (that I know) of programming languages with > stacks or heaps, use some kind of explicit check to see when a stack > or heap is full. This is used to trigger events such as error > messages, garbage collection or allocation of more memory for a > fragmented stack. > [ using an mmu to do this deleted ] There is another way. What you do is generalize the trap mechanism. Traditionally, the trap has been viewed as an error condition -- access out of bounds, overflow, floating point exception, etc. Instead, treat the trap as a notification mechanism. Consider a scheme where some of the processor's registers have a bit of additional hardware associated with them. That hardware is just a comparator, a value to compare against, and an address to branch to if some user-specified trap condition is satisfied. Each cycle the register's value is compared with the comparand value. If the relation is satisfied control is transferred to the specified address. The address of the instruction which caused the trap is available in a register so you can resume processing. I describe how you can use such a mechanism for flow of control, drastically reducing loop overhead, and to implement a cache of the past n subroutine return addresses in: %A Jonathan A. Chandross %A H. V. Jagadish %A Abhaya Asthana %T The Trap as a Flow Control Mechanism %J Proceedings 21st Annual Workshop on Microprogramming (MICRO 21) %D 1988 Jonathan A. Chandross Internet: jac@paul.rutgers.edu UUCP: rutgers!paul.rutgers.edu!jac