Re: how to generate code for (a,b):=(b,a)

wilson@cs.utexas.edu (Paul Wilson)
17 May 1997 00:08:17 -0400

          From comp.compilers

Related articles
[8 earlier articles]
Re: how to generate code for (a,b):=(b,a) wilson@cs.utexas.edu (1997-05-12)
Re: how to generate code for (a,b):=(b,a) tim@wfn-shop.Princeton.EDU (1997-05-13)
Re: how to generate code for (a,b):=(b,a) cdg@nullstone.com (Christopher Glaeser) (1997-05-13)
Re: how to generate code for (a,b):=(b,a) genew@vip.net (1997-05-13)
Re: how to generate code for (a,b):=(b,a) bobduff@world.std.com (1997-05-13)
Re: how to generate code for (a,b):=(b,a) will@ccs.neu.edu (William D Clinger) (1997-05-17)
Re: how to generate code for (a,b):=(b,a) wilson@cs.utexas.edu (1997-05-17)
Re: how to generate code for (a,b):=(b,a) boehm@mti.mti.sgi.com (Hans-Juergen Boehm) (1997-05-17)
Re: how to generate code for (a,b):=(b,a) boehm@mti.mti.sgi.com (Hans-Juergen Boehm) (1997-05-17)
Re: how to generate code for (a,b):=(b,a) Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-05-22)
Re: how to generate code for (a,b):=(b,a) Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-05-22)
Re: how to generate code for (a,b):=(b,a) boehm@mti.mti.sgi.com (Hans-Juergen Boehm) (1997-05-25)
Re: how to generate code for (a,b):=(b,a) Dave@occl-cam.demon.co.uk (Dave Lloyd) (1997-05-27)
[3 later articles]
| List of all articles for this month |

From: wilson@cs.utexas.edu (Paul Wilson)
Newsgroups: comp.compilers
Date: 17 May 1997 00:08:17 -0400
Organization: CS Dept, University of Texas at Austin
References: 97-05-058 97-05-129 97-05-148 97-05-164
Keywords: code, optimize, GC

>wilson@cs.utexas.edu writes:
>> 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.
>
>That's not a problem in this case unless the GC is running as a
>preemptive thread and can get control in the middle of the xors though
>right? Before and after the sequence, a and b contain valid pointers;


It's worse than that. It's true that this typically only happens in
the presence of threads---I should have said that---but the GC doesn't
have to be a thread unto itself for this to happen. If the GC is
invoked by whatever thread forces a GC, other threads may be suspended
in an unsafe state where their pointers are not all identifiable.


Boehm's GC is designed to work with some thread packages, with some
thread-package-specific code to glue it into the system. If the C/C++
compiler starts mangling pointers, it severely restricts the ability
to use threading.
--
| 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/)
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.