301 };
302
303 // A closure that is applied without any arguments.
304 class VoidClosure : public StackObj {
305 public:
306 // I would have liked to declare this a pure virtual, but that breaks
307 // in mysterious ways, for unknown reasons.
308 virtual void do_void();
309 };
310
311
312 // YieldClosure is intended for use by iteration loops
313 // to incrementalize their work, allowing interleaving
314 // of an interruptable task so as to allow other
315 // threads to run (which may not otherwise be able to access
316 // exclusive resources, for instance). Additionally, the
317 // closure also allows for aborting an ongoing iteration
318 // by means of checking the return value from the polling
319 // call.
320 class YieldClosure : public StackObj {
321 public:
322 virtual bool should_return() = 0;
323 };
324
325 // Abstract closure for serializing data (read or write).
326
327 class SerializeClosure : public Closure {
328 public:
329 // Return bool indicating whether closure implements read or write.
330 virtual bool reading() const = 0;
331
332 // Read/write the void pointer pointed to by p.
333 virtual void do_ptr(void** p) = 0;
334
335 // Read/write the 32-bit unsigned integer pointed to by p.
336 virtual void do_u4(u4* 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
|
301 };
302
303 // A closure that is applied without any arguments.
304 class VoidClosure : public StackObj {
305 public:
306 // I would have liked to declare this a pure virtual, but that breaks
307 // in mysterious ways, for unknown reasons.
308 virtual void do_void();
309 };
310
311
312 // YieldClosure is intended for use by iteration loops
313 // to incrementalize their work, allowing interleaving
314 // of an interruptable task so as to allow other
315 // threads to run (which may not otherwise be able to access
316 // exclusive resources, for instance). Additionally, the
317 // closure also allows for aborting an ongoing iteration
318 // by means of checking the return value from the polling
319 // call.
320 class YieldClosure : public StackObj {
321 public:
322 virtual bool should_return() = 0;
323 // Yield on a fine-grain level. The check in case of not yielding should be very fast.
324 virtual bool should_return_fine_grain() { return false; }
325 };
326
327 // Abstract closure for serializing data (read or write).
328
329 class SerializeClosure : public Closure {
330 public:
331 // Return bool indicating whether closure implements read or write.
332 virtual bool reading() const = 0;
333
334 // Read/write the void pointer pointed to by p.
335 virtual void do_ptr(void** p) = 0;
336
337 // Read/write the 32-bit unsigned integer pointed to by p.
338 virtual void do_u4(u4* p) = 0;
339
340 // Read/write the region specified.
341 virtual void do_region(u_char* start, size_t size) = 0;
342
343 // Check/write the tag. If reading, then compare the tag against
344 // the passed in value and fail is they don't match. This allows
|