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

tim@wfn-shop.Princeton.EDU
13 May 1997 22:46:10 -0400

          From comp.compilers

Related articles
[3 earlier articles]
Re: how to generate code for (a,b):=(b,a) bart@time.cirl.uoregon.edu (1997-05-08)
Re: how to generate code for (a,b):=(b,a) Robert.Harley@inria.fr (1997-05-08)
Re: how to generate code for (a,b):=(b,a) dlmoore@ix.netcom.com (David L Moore) (1997-05-08)
Re: how to generate code for (a,b):=(b,a) preston@cs.rice.edu (1997-05-08)
Re: how to generate code for (a,b):=(b,a) cliffc@risc.sps.mot.com (Cliff Click) (1997-05-12)
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)
[8 later articles]
| List of all articles for this month |
From: tim@wfn-shop.Princeton.EDU
Newsgroups: comp.compilers
Date: 13 May 1997 22:46:10 -0400
Organization: Chemistry Department, Princeton University
References: 97-05-058 97-05-129 97-05-148
Keywords: code

>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


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;
only in the middle to wierd split pointers appear. I don't see any
reason why Boehm's GC would have a problem with this construct.


--
Tim Hollebeek |
Electron Psychologist |
Princeton University | email: tim@wfn-shop.princeton.edu
----------------------| http://wfn-shop.princeton.edu/~tim (NEW! IMPROVED!)
--


Post a followup to this message

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