From: | wilson@cs.utexas.edu (Paul Wilson) |
Newsgroups: | comp.compilers |
Date: | 12 May 1997 00:24:44 -0400 |
Organization: | CS Dept, University of Texas at Austin |
References: | 97-05-058 97-05-129 |
Keywords: | optimize, code, GC |
David L Moore <dlmoore@ix.netcom.com> wrote:
>Anton Ertl wrote:
>
>[Exchange contents of several registers quickly]
>
>When you don't have any free registers, it should be possible to achieve
>the same result with a series of xors instead of moves. For example, two
>registers can be exchanged with the sequence:
> xor a,b
> xor b,a
> xor a,b
This is very likely to confuse a conservative garbage collector if
these are pointer variables. I'd hope that compiler writers wouldn't
use such optimizations casually, especially if they're not clearly
better than the alternatives.
Hans Boehm et al. have gone to a lot of trouble to make it practical
to garbage collect languages that weren't designed for GC. (Please
provide a flag to turn off pointer-mangling optimizations. A
conservative GC can handle common forms of pointer arithmetic, but if
you split a pointer into two pieces, or xor it so that it doesn't
point anywhere near the actual object, horrible bugs can happen. (In
either case, if the original pointer is somewhere on the stack or in
registers, it's okay, but if the only pointer to a live object is
mangled beyond recognition, conservative GC's will fail.)
--
| Paul R. Wilson, Comp. Sci. Dept., U of Texas @ Austin (wilson@cs.utexas.edu)
| Papers on memory allocators, garbage collection, memory hierarchies,
| persistence and Scheme interpreters and compilers available via ftp from
| ftp.cs.utexas.edu, in pub/garbage (or http://www.cs.utexas.edu/users/wilson/)
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.