From: Ian R. <rog...@gm...> - 2008-06-30 21:31:52
|
Rhodes Brown wrote: > I too have encountered problems trying to add to VM_MiscHeader. I > don't have all the answers, but here is what I have learned... > > I don't need all the info provided in the GCTrace configuration, nor > do I want a GC trace. For my purposes, all I want is a simple unique > ID for each object. I tried following the instructions in > VM_MiscHeader and VM_MiscHeaderConstants, but adding a simple (int) > counter to the header was causing bizarre crashes--even if I never > actually read the ID! I assumed that I must have missed something, so > I started poking through the files under org/jikesrvm/objectmodel to > see if there was something else I needed to tweak. During my > exploration I discovered the mystery that is > VM_JavaHeader.getObjectFromStartAddress(). I am at a loss to explain > why this method does what it does--it seems to be somewhat of a kludge > that evolved from a change made in rev 10384. Apparently, it is > looking for a word with the low bit on as a landmark from which to > begin GC scanning. Since my extra field in the MiscHeader was often > odd, this was causing the GC scan to begin at the wrong offset which > would inevitably lead to a GC crash. So, I just set my counter to only > use even values. Problem (apparently) solved. > > Obviously, this isn't a general solution. Someone with a better > understanding of the GC system ought to look at this, possibly in > conjunction with the revision to the object model (for 2.9.4) that Ian > mentioned earlier. Personally, I would like to see something along the > lines of what was done with VM_TIB, VM_CodeArray, etc. That is to say, > a stronger object-like abstraction over instances (VM_ObjectInstance? > An enhanced ObjectReference?) that is compiled away--something that > can be tracked a little easier than direct memory accesses. > > Cheers, > > Rhodes Brown > PhD Candidate in Computer Science > University of Victoria > > Hi Rhodes, I have independently had the same issue as you with the misc header. I have a patch that does the object model as you say and adds support for a bidirectional object model. I will try to commit it at least to a branch by the end of the week. Regards, Ian |