Re: Garbage collection, part two...

From: Erick Gallesio <>
Date: Sun, 16 Apr 2000 22:44:21 +0200 (CEST)

Felix Lee writes:
> another possible fix is to declare conv_res as volatile. It
> will still be gc protected if it's on the stack and not in a
> register, right?
> declaring it volatile forces the compiler to keep it on the
> stack, not in a register, so the value won't ever be
> eliminated by live-range analysis.

Thats a good idea, and I have should have thought to it. The only
problem that I see, is that, as far as I remember, the norm says that
the access should not be optimized (as often norms are at a level of
detail which are not very helpful). I don't know if it implies that it
cannot be placed in register (probably) or that the compiler must
prevent to deduce some result by itself. I remeber to have seen an
example such as
        int var = (int *) A_constant_hardware_address;
        for (i = 0; i < n; i++)
          *i = 0;

A clever compiler could replace this by
         int var = (int *) A_constant_hardware_address;
         *i = 0;
Since doing it n times seems not very useful. In this case, it is
clear that he compiler cannot place it in a register? But suppose that
the body of the loop use at several places *i. Is the compiler not
authorized to place its value in a register to avoid the indirection?

> rrrr. finding other occurrences of this type of problem is
> nontrivial.

Oh yes!!!

> it can happen whenever you construct a scheme
> object as a temporary holder for non-scheme objects.

Not very current but possible in effect.

                -- Erick
Received on Sun Apr 16 2000 - 23:19:29 CEST

This archive was generated by hypermail 2.3.0 : Mon Jul 21 2014 - 19:38:59 CEST