Re: [Gc] C optimizer hazards in practice
Hans Boehm <[email protected]> Sun, 13 Jul 2014 21:43:56 -0700
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <CAPUmR1a-8C9H_4xCe-5Bd2h9miYreiB-D10d7EikA4+ven6DiQ@mail.gmail.com> |
Are we talking about more than one kind of problem? I think the question was about a compiler, under the covers, maintaining the last pointer in a form no longer recognizable by a conservative garbage collector, possibly only temporarily. The case of this I remember from many years ago is that the preferred way to add a large constant offset to a pointer on POWER was to first add a multiple of 2^16, and then use a 16 bit signed displacement to access the referenced value. This often means that the pointer after the initial addition points to past the end of the object and is not recognizable by the GC. But such signed constant offsets are exceedingly rare, and a compiler can easily avoid this problem if it's aware of the issue. I could construct an example of this in contrived code. I vaguely recall one or two instances of people pointing out such problems in real code, but I don't recall the details. Compiler dead variable elimination is a problem only in the sense that cases like this don't matter if the compiler also keeps a copy of the original base variable around. Compiler dead variable elimination by itself can case finalizers on an object to run while a method on the object is still executing. But I think that's a different issue. Hans On Thu, Jul 10, 2014 at 5:25 AM, Ingo Albrecht <[email protected]> wrote: > On 07/10/2014 12:28 PM, Richard Brooksby wrote: > > > https://github.com/ivmai/bdwgc/blob/3ec2783588c8ba53a0b6a347d61d4e5c1b5dc80e/README.md > says: > > > >> Some C optimizers may lose the last undisguised pointer to a memory > object as a consequence of clever optimizations. This has almost never been > observed in practice. > > Does anyone have any stories to tell about when this *has* been > observed, or any links to accounts of this happening? > > I can't tell of a story where this has actually happened to me, quite > likely because the > GC-driven systems I have been working on did not disguise pointers. > > However, my compiler knowledge makes me certain that this can happen. > GCC and > other compilers will readily eliminate local variables whenever lifetime > analysis allows. > The biggest risk would be on high-register-pressure architectures such > as X86. > > I would like to ask back: does anyone here use an actual disguised > pointer scheme? > > _______________________________________________ > bdwgc mailing list > [email protected] > https://lists.opendylan.org/mailman/listinfo/bdwgc > _______________________________________________ bdwgc mailing list [email protected] https://lists.opendylan.org/mailman/listinfo/bdwgc