-/**
- *
- */
-void enable()
-{
- if (!thread_needLock())
- {
- assert(gc.disabled > 0);
- gc.disabled--;
- }
- else synchronized (gc.lock)
- {
- assert(gc.disabled > 0);
- gc.disabled--;
- }
-}
-
-
-/**
- *
- */
-void disable()
-{
- if (!thread_needLock())
- {
- gc.disabled++;
- }
- else synchronized (gc.lock)
- {
- gc.disabled++;
- }
-}
-
-
-/**
- *
- */
-uint getAttr(void* p)
-{
- if (!p)
- {
- return 0;
- }
-
- uint go()
- {
- Pool* pool = findPool(p);
- uint old_attrs = 0;
-
- if (pool)
- {
- auto bit_i = cast(size_t)(p - pool.baseAddr) / 16;
-
- old_attrs = getAttr(pool, bit_i);
- }
- return old_attrs;
- }
-
- if (!thread_needLock())
- {
- return go();
- }
- else synchronized (gc.lock)
- {
- return go();
- }
-}
-
-
-/**
- *
- */
-uint setAttr(void* p, uint mask)
-{
- if (!p)
- {
- return 0;
- }
-
- uint go()
- {
- Pool* pool = findPool(p);
- uint old_attrs = 0;
-
- if (pool)
- {
- auto bit_i = cast(size_t)(p - pool.baseAddr) / 16;
-
- old_attrs = getAttr(pool, bit_i);
- setAttr(pool, bit_i, mask);
- }
- return old_attrs;
- }
-
- if (!thread_needLock())
- {
- return go();
- }
- else synchronized (gc.lock)
- {
- return go();
- }
-}
-
-
-/**
- *
- */
-uint clrAttr(void* p, uint mask)
-{
- if (!p)
- {
- return 0;
- }
-
- uint go()
- {
- Pool* pool = findPool(p);
- uint old_attrs = 0;
-
- if (pool)
- {
- auto bit_i = cast(size_t)(p - pool.baseAddr) / 16;
-
- old_attrs = getAttr(pool, bit_i);
- clrAttr(pool, bit_i, mask);
- }
- return old_attrs;
- }
-
- if (!thread_needLock())
- {
- return go();
- }
- else synchronized (gc.lock)
- {
- return go();
- }
-}
-
-
-/**
- *
- */
-void *malloc(size_t size, uint attrs, PointerMap ptrmap)
-{
- if (!size)
- {
- return null;
- }
-
- if (!thread_needLock())
- {
- return mallocNoSync(size, attrs, ptrmap.bits.ptr);
- }
- else synchronized (gc.lock)
- {
- return mallocNoSync(size, attrs, ptrmap.bits.ptr);
- }
-}
-
-