assert that there are no outstanding Get*Critical requests during allocation

When GetStringCritical or GetPrimitiveArrayCritical are called, the VM
cannot risk new Java heap allocations until the corresponding release
method is called because allocations may result in GC, which cannot
happen while a string or array is pinned in memory.  We already have a
check for this latter in the footprint function used during GC, but
it's best to catch the problem as early as possible.
This commit is contained in:
Joel Dice 2013-02-05 09:48:20 -07:00
parent 57a67fb312
commit 5a07e04d56

View File

@ -3458,6 +3458,8 @@ object
allocate3(Thread* t, Allocator* allocator, Machine::AllocationType type,
unsigned sizeInBytes, bool objectMask)
{
expect(t, t->criticalLevel == 0);
if (UNLIKELY(t->flags & Thread::UseBackupHeapFlag)) {
expect(t, t->backupHeapIndex + ceiling(sizeInBytes, BytesPerWord)
<= ThreadBackupHeapSizeInWords);