Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!usc!elroy.jpl.nasa.gov!decwrl!world!iecc!compilers-sender From: crowl@cs.rochester.edu (Lawrence Crowl) Newsgroups: comp.compilers Subject: Re: Portable Fast Direct Threaded Code Keywords: interpreter, design Message-ID: <1991Mar31.180635.5944@cs.rochester.edu> Date: 31 Mar 91 18:06:35 GMT References: <3035@redstar.cs.qmw.ac.uk> Sender: compilers-sender@iecc.cambridge.ma.us Reply-To: crowl@cs.rochester.edu (Lawrence Crowl) Organization: Computer Science Department University of Rochester Lines: 34 Approved: compilers@iecc.cambridge.ma.us In article <3035@redstar.cs.qmw.ac.uk> Eliot Miranda writes: >The threaded code machine will make calls on support routines, e.g. graphics, >garbage collector etc. Any group of routines that don't access the global >registers and don't directly or indirectly call routines that need to access >the global registers can be optimized. These routines should be compiled >without declaring the global registers. These routines will then use as many >registers as the compiler will give them and will save & restore any >registers they use, preserving the values of the global register variables. This scheme assumes that procedure calls use a "callee saves" register convention, and does not work if you allocate the global register variables out of the "caller saves" set of registers. The problem is that the caller does not save the register (because it is global) and the callee writes over the register (because the caller saved it). In this situation, the programmer must insert explicit saves and restores of the global register variables. The obvious solution to this problem is to allocate all global register variables out of the "callee saves" set of registers. However, the Alliant has _no_ callee saves registers. Library routines on the Alliant will trash every register you have. In addition, implicit library calls to routines like bcopy will also trash your registers. (I learned this the hard way.) The lesson is that calling library routines with global register variables in caller saves registers requires special handling. It is not automagic. -- Lawrence Crowl 716-275-9499 University of Rochester crowl@cs.rochester.edu Computer Science Department ...!rutgers!rochester!crowl Rochester, New York, 14627-0226 -- Send compilers articles to compilers@iecc.cambridge.ma.us or {ima | spdcc | world}!iecc!compilers. Meta-mail to compilers-request.