330 virtual void do_ptr(void** p) = 0; 331 332 // Read/write the 32-bit unsigned integer pointed to by p. 333 virtual void do_u4(u4* p) = 0; 334 335 // Read/write the bool pointed to by p. 336 virtual void do_bool(bool* p) = 0; 337 338 // Read/write the region specified. 339 virtual void do_region(u_char* start, size_t size) = 0; 340 341 // Check/write the tag. If reading, then compare the tag against 342 // the passed in value and fail is they don't match. This allows 343 // for verification that sections of the serialized data are of the 344 // correct length. 345 virtual void do_tag(int tag) = 0; 346 347 // Read/write the oop 348 virtual void do_oop(oop* o) = 0; 349 350 bool writing() { 351 return !reading(); 352 } 353 }; 354 355 class SymbolClosure : public StackObj { 356 public: 357 virtual void do_symbol(Symbol**) = 0; 358 359 // Clear LSB in symbol address; it can be set by CPSlot. 360 static Symbol* load_symbol(Symbol** p) { 361 return (Symbol*)(intptr_t(*p) & ~1); 362 } 363 364 // Store symbol, adjusting new pointer if the original pointer was adjusted 365 // (symbol references in constant pool slots have their LSB set to 1). 366 static void store_symbol(Symbol** p, Symbol* sym) { 367 *p = (Symbol*)(intptr_t(sym) | (intptr_t(*p) & 1)); 368 } 369 }; | 330 virtual void do_ptr(void** p) = 0; 331 332 // Read/write the 32-bit unsigned integer pointed to by p. 333 virtual void do_u4(u4* p) = 0; 334 335 // Read/write the bool pointed to by p. 336 virtual void do_bool(bool* p) = 0; 337 338 // Read/write the region specified. 339 virtual void do_region(u_char* start, size_t size) = 0; 340 341 // Check/write the tag. If reading, then compare the tag against 342 // the passed in value and fail is they don't match. This allows 343 // for verification that sections of the serialized data are of the 344 // correct length. 345 virtual void do_tag(int tag) = 0; 346 347 // Read/write the oop 348 virtual void do_oop(oop* o) = 0; 349 350 // Read/write a oop that's the type of java.lang.Class 351 virtual void do_mirror_oop(oop* o) = 0; 352 353 bool writing() { 354 return !reading(); 355 } 356 }; 357 358 class SymbolClosure : public StackObj { 359 public: 360 virtual void do_symbol(Symbol**) = 0; 361 362 // Clear LSB in symbol address; it can be set by CPSlot. 363 static Symbol* load_symbol(Symbol** p) { 364 return (Symbol*)(intptr_t(*p) & ~1); 365 } 366 367 // Store symbol, adjusting new pointer if the original pointer was adjusted 368 // (symbol references in constant pool slots have their LSB set to 1). 369 static void store_symbol(Symbol** p, Symbol* sym) { 370 *p = (Symbol*)(intptr_t(sym) | (intptr_t(*p) & 1)); 371 } 372 }; |