Re: [Gc] C optimizer hazards in practice
"Richard A. O'Keefe" <ok-JtFlkrn/[email protected]> Wed, 16 Jul 2014 15:02:16 +1200
| Newsgroups | gmane.comp.programming.garbage-collection.boehmgc |
|---|---|
| Message-ID | <[email protected]> |
On 16/07/2014, at 3:02 AM, Ingo Albrecht wrote: > On 07/14/2014 06:43 AM, Hans Boehm wrote: >> Are we talking about more than one kind of problem? > > Yes, although I took a tangent when asking if anyone is using a > disguised pointer scheme, > because that would make it somewhat more likely to run into these kinds > of problems. There are actually two senses in which a pointer may be "disguised". (1) The TYPE of the pointer may be disguised. (2) The VALUE of the pointer may disguised. My reading of the MPS report is that case (1) applied. In the C code, pointers were being passed around as suitably sized integers, then being converted at the point of use. The Microsoft compiler applied optimisations to the integer value that were perfectly valid as integer optimisations. This meant that (2) was being injected by the compiler itself. My Smalltalk system has types Word (= uintptr_t) SWord (= intptr_t) Ptr = Word* and everything gets passed around as a Word. This is definitely case (1). I'm not doing anything weird to the bits (except for adding 1), but I *am* effectively lying to the compiler about the type. I'm wondering whether I ought to replace Word by Ptr.