src/share/vm/utilities/taskqueue.hpp

changeset 548
ba764ed4b6f2
parent 435
a61af66fc99e
child 631
d1605aabd0a1
child 777
37f87013dfd8
     1.1 --- a/src/share/vm/utilities/taskqueue.hpp	Fri Apr 11 09:56:35 2008 -0400
     1.2 +++ b/src/share/vm/utilities/taskqueue.hpp	Sun Apr 13 17:43:42 2008 -0400
     1.3 @@ -490,7 +490,31 @@
     1.4  typedef GenericTaskQueue<Task>         OopTaskQueue;
     1.5  typedef GenericTaskQueueSet<Task>      OopTaskQueueSet;
     1.6  
     1.7 -typedef oop* StarTask;
     1.8 +
     1.9 +#define COMPRESSED_OOP_MASK  1
    1.10 +
    1.11 +// This is a container class for either an oop* or a narrowOop*.
    1.12 +// Both are pushed onto a task queue and the consumer will test is_narrow()
    1.13 +// to determine which should be processed.
    1.14 +class StarTask {
    1.15 +  void*  _holder;        // either union oop* or narrowOop*
    1.16 + public:
    1.17 +  StarTask(narrowOop *p) { _holder = (void *)((uintptr_t)p | COMPRESSED_OOP_MASK); }
    1.18 +  StarTask(oop *p)       { _holder = (void*)p; }
    1.19 +  StarTask()             { _holder = NULL; }
    1.20 +  operator oop*()        { return (oop*)_holder; }
    1.21 +  operator narrowOop*()  {
    1.22 +    return (narrowOop*)((uintptr_t)_holder & ~COMPRESSED_OOP_MASK);
    1.23 +  }
    1.24 +
    1.25 +  // Operators to preserve const/volatile in assignments required by gcc
    1.26 +  void operator=(const volatile StarTask& t) volatile { _holder = t._holder; }
    1.27 +
    1.28 +  bool is_narrow() const {
    1.29 +    return (((uintptr_t)_holder & COMPRESSED_OOP_MASK) != 0);
    1.30 +  }
    1.31 +};
    1.32 +
    1.33  typedef GenericTaskQueue<StarTask>     OopStarTaskQueue;
    1.34  typedef GenericTaskQueueSet<StarTask>  OopStarTaskQueueSet;
    1.35  

mercurial