/* Sun-$Revision: 23.3 $ */ /* Copyright 1992-9 Sun Microsystems, Inc. and Stanford University. See the LICENSE file for license information. */ # pragma interface // The object table is used for pointer forwarding during a full GC. struct oTableObj { void* operator new(size_t size); }; struct oTableEntry { // instance variables memOop obj; markOop mark; }; // Make sure oTableBuffer can be allocated in a minimal resource chunk const int32 object_table_size = min_resource_chunk_size / sizeof(oTableEntry) - 1; struct oTableBuffer: oTableObj { oTableBuffer* next; oTableEntry entries[object_table_size]; oTableBuffer() { next = NULL; } bool is_oTableEntry(void* p) { return p >= (void*) &entries[0] && p < (void*) &entries[object_table_size] || next && next->is_oTableEntry(p); } }; struct oTablePoint { oTableBuffer* buffer; int32 index; oTablePoint() { index = 0; } }; struct offsetEntry: oTableObj { memOop* ptr; int32 offset; offsetEntry* next; offsetEntry(memOop* p, int32 o, offsetEntry* n) { ptr = p; offset = o; next = n; } inline memOop add_offset(memOop p, memOop* _ptr); // in oTable.h }; struct oTable: ResourceObj { oTableBuffer* bottom; oTablePoint point; oTablePoint current; offsetEntry* offsets; // Since gc marking utilize nested resource marks oTable has to // use its own resource area. ResourceArea resource_area; oTable() { bottom = NULL; } void grow(); inline memOop add(memOop p); inline void record_derivation(memOop* ptr, int32 offset); inline memOop restore_derivation(memOop p, memOop* ptr); bool contains(memOopClass* p); oTableEntry* as_oTableEntry(memOopClass* p) { assert(contains(p),"should be a pointer to an object in the objectTable"); return (oTableEntry*)p; } void gc_mark_contents(); void gc_mark_rest(); bool is_oTableEntry(void* p) { return bottom->is_oTableEntry(p); } };