50 setAddressVisitor(oopVisitor); 51 } 52 53 public void setAddressVisitor(AddressVisitor addressVisitor) { 54 this.addressVisitor = addressVisitor; 55 } 56 57 public void visitOopLocation(Address oopAddr) { 58 addressVisitor.visitAddress(oopAddr); 59 } 60 61 public void visitDerivedOopLocation(Address baseOopAddr, Address derivedOopAddr) { 62 if (VM.getVM().isClientCompiler()) { 63 Assert.that(false, "should not reach here"); 64 } else if (VM.getVM().isServerCompiler() && 65 VM.getVM().useDerivedPointerTable()) { 66 Assert.that(false, "FIXME: add derived pointer table"); 67 } 68 } 69 70 public void visitValueLocation(Address valueAddr) { 71 } 72 73 public void visitNarrowOopLocation(Address narrowOopAddr) { 74 addressVisitor.visitCompOopAddress(narrowOopAddr); 75 } 76 } 77 78 static { 79 VM.registerVMInitializedObserver(new Observer() { 80 public void update(Observable o, Object data) { 81 initialize(VM.getVM().getTypeDataBase()); 82 } 83 }); 84 } 85 86 private static void initialize(TypeDataBase db) { 87 Type type = db.lookupType("ImmutableOopMapSet"); 88 89 countField = type.getCIntegerField("_count"); 90 sizeField = type.getCIntegerField("_size"); 91 classSize = type.getSize(); 92 199 } 200 201 // handle derived pointers first (otherwise base pointer may be 202 // changed before derived pointer offset has been collected) 203 OopMapValue omv; 204 { 205 for (OopMapStream oms = new OopMapStream(map, OopMapValue.OopTypes.DERIVED_OOP_VALUE); !oms.isDone(); oms.next()) { 206 if (VM.getVM().isClientCompiler()) { 207 Assert.that(false, "should not reach here"); 208 } 209 omv = oms.getCurrent(); 210 Address loc = fr.oopMapRegToLocation(omv.getReg(), regMap); 211 if (loc != null) { 212 Address baseLoc = fr.oopMapRegToLocation(omv.getContentReg(), regMap); 213 Address derivedLoc = loc; 214 visitor.visitDerivedOopLocation(baseLoc, derivedLoc); 215 } 216 } 217 } 218 219 // We want narow oop, value and oop oop_types 220 OopMapValue.OopTypes[] values = new OopMapValue.OopTypes[]{ 221 OopMapValue.OopTypes.OOP_VALUE, OopMapValue.OopTypes.VALUE_VALUE, OopMapValue.OopTypes.NARROWOOP_VALUE 222 }; 223 224 { 225 for (OopMapStream oms = new OopMapStream(map, values); !oms.isDone(); oms.next()) { 226 omv = oms.getCurrent(); 227 Address loc = fr.oopMapRegToLocation(omv.getReg(), regMap); 228 if (loc != null) { 229 if (omv.getType() == OopMapValue.OopTypes.OOP_VALUE) { 230 // This assert commented out because this will be useful 231 // to detect in the debugging system 232 // assert(Universe::is_heap_or_null(*loc), "found non oop pointer"); 233 visitor.visitOopLocation(loc); 234 } else if (omv.getType() == OopMapValue.OopTypes.VALUE_VALUE) { 235 visitor.visitValueLocation(loc); 236 } else if (omv.getType() == OopMapValue.OopTypes.NARROWOOP_VALUE) { 237 visitor.visitNarrowOopLocation(loc); 238 } 239 } 240 } 241 } 242 } 243 244 /** 245 * Update callee-saved register info for the following frame. 246 * Should only be called in non-core builds. 247 */ 248 public static void updateRegisterMap(Frame fr, CodeBlob cb, RegisterMap regMap, boolean debugging) { 249 if (Assert.ASSERTS_ENABLED) { 250 Assert.that(!VM.getVM().isCore(), "non-core builds only"); 251 } 252 253 if (!VM.getVM().isDebugging()) { 254 if (Assert.ASSERTS_ENABLED) { 255 ImmutableOopMapSet maps = cb.getOopMaps(); | 50 setAddressVisitor(oopVisitor); 51 } 52 53 public void setAddressVisitor(AddressVisitor addressVisitor) { 54 this.addressVisitor = addressVisitor; 55 } 56 57 public void visitOopLocation(Address oopAddr) { 58 addressVisitor.visitAddress(oopAddr); 59 } 60 61 public void visitDerivedOopLocation(Address baseOopAddr, Address derivedOopAddr) { 62 if (VM.getVM().isClientCompiler()) { 63 Assert.that(false, "should not reach here"); 64 } else if (VM.getVM().isServerCompiler() && 65 VM.getVM().useDerivedPointerTable()) { 66 Assert.that(false, "FIXME: add derived pointer table"); 67 } 68 } 69 70 public void visitNarrowOopLocation(Address narrowOopAddr) { 71 addressVisitor.visitCompOopAddress(narrowOopAddr); 72 } 73 } 74 75 static { 76 VM.registerVMInitializedObserver(new Observer() { 77 public void update(Observable o, Object data) { 78 initialize(VM.getVM().getTypeDataBase()); 79 } 80 }); 81 } 82 83 private static void initialize(TypeDataBase db) { 84 Type type = db.lookupType("ImmutableOopMapSet"); 85 86 countField = type.getCIntegerField("_count"); 87 sizeField = type.getCIntegerField("_size"); 88 classSize = type.getSize(); 89 196 } 197 198 // handle derived pointers first (otherwise base pointer may be 199 // changed before derived pointer offset has been collected) 200 OopMapValue omv; 201 { 202 for (OopMapStream oms = new OopMapStream(map, OopMapValue.OopTypes.DERIVED_OOP_VALUE); !oms.isDone(); oms.next()) { 203 if (VM.getVM().isClientCompiler()) { 204 Assert.that(false, "should not reach here"); 205 } 206 omv = oms.getCurrent(); 207 Address loc = fr.oopMapRegToLocation(omv.getReg(), regMap); 208 if (loc != null) { 209 Address baseLoc = fr.oopMapRegToLocation(omv.getContentReg(), regMap); 210 Address derivedLoc = loc; 211 visitor.visitDerivedOopLocation(baseLoc, derivedLoc); 212 } 213 } 214 } 215 216 // We want narow oop and oop oop_types 217 OopMapValue.OopTypes[] values = new OopMapValue.OopTypes[] { 218 OopMapValue.OopTypes.OOP_VALUE, OopMapValue.OopTypes.NARROWOOP_VALUE 219 }; 220 221 { 222 for (OopMapStream oms = new OopMapStream(map, values); !oms.isDone(); oms.next()) { 223 omv = oms.getCurrent(); 224 Address loc = fr.oopMapRegToLocation(omv.getReg(), regMap); 225 if (loc != null) { 226 if (omv.getType() == OopMapValue.OopTypes.OOP_VALUE) { 227 // This assert commented out because this will be useful 228 // to detect in the debugging system 229 // assert(Universe::is_heap_or_null(*loc), "found non oop pointer"); 230 visitor.visitOopLocation(loc); 231 } else if (omv.getType() == OopMapValue.OopTypes.NARROWOOP_VALUE) { 232 visitor.visitNarrowOopLocation(loc); 233 } 234 } 235 } 236 } 237 } 238 239 /** 240 * Update callee-saved register info for the following frame. 241 * Should only be called in non-core builds. 242 */ 243 public static void updateRegisterMap(Frame fr, CodeBlob cb, RegisterMap regMap, boolean debugging) { 244 if (Assert.ASSERTS_ENABLED) { 245 Assert.that(!VM.getVM().isCore(), "non-core builds only"); 246 } 247 248 if (!VM.getVM().isDebugging()) { 249 if (Assert.ASSERTS_ENABLED) { 250 ImmutableOopMapSet maps = cb.getOopMaps(); |