inline void HeapRegionSetBase::add(HeapRegion* hr) { check_mt_safety(); assert(hr->containing_set() == NULL, hrs_ext_msg(this, "should not already have a containing set %u")); assert(hr->next() == NULL && hr->prev() == NULL, hrs_ext_msg(this, "should not already be linked")); _count.increment(1u, hr->capacity()); hr->set_containing_set(this); verify_region(hr); }
inline void HeapRegionSetBase::remove(HeapRegion* hr) { check_mt_safety(); verify_region(hr); assert(hr->next() == NULL && hr->prev() == NULL, hrs_ext_msg(this, "should already be unlinked")); hr->set_containing_set(NULL); assert(_count.length() > 0, hrs_ext_msg(this, "pre-condition")); _count.decrement(1u, hr->capacity()); }
inline void HeapRegionSetBase::remove(HeapRegion* hr) { check_mt_safety(); verify_region(hr); assert_heap_region_set(hr->next() == NULL, "should already be unlinked"); assert_heap_region_set(hr->prev() == NULL, "should already be unlinked"); hr->set_containing_set(NULL); assert_heap_region_set(_length > 0, "pre-condition"); _length--; }
inline void HeapRegionSetBase::add(HeapRegion* hr) { check_mt_safety(); assert_heap_region_set(hr->containing_set() == NULL, "should not already have a containing set"); assert_heap_region_set(hr->next() == NULL, "should not already be linked"); assert_heap_region_set(hr->prev() == NULL, "should not already be linked"); _length++; hr->set_containing_set(this); verify_region(hr); }
void HeapRegionSetBase::verify_next_region(HeapRegion* hr) { // See comment in verify() about MT safety and verification. hrl_assert_mt_safety_ok(this); assert(_verify_in_progress, hrl_ext_msg(this, "verification should be in progress")); guarantee(verify_region(hr, this), hrl_ext_msg(this, "region verification")); _calc_length += 1; if (!hr->isHumongous()) { _calc_region_num += 1; } else { _calc_region_num += calculate_region_num(hr); } _calc_total_capacity_bytes += hr->capacity(); _calc_total_used_bytes += hr->used(); }
void FreeRegionList::remove_all() { check_mt_safety(); verify_optional(); HeapRegion* curr = _head; while (curr != NULL) { verify_region(curr); HeapRegion* next = curr->next(); curr->set_next(NULL); curr->set_prev(NULL); curr->set_containing_set(NULL); curr = next; } clear(); verify_optional(); }
static void test_ExtCreateRegion(void) { static const RECT empty_rect; static const RECT rc = { 111, 222, 333, 444 }; static const RECT rc_xformed = { 76, 151, 187, 262 }; union { RGNDATA data; char buf[sizeof(RGNDATAHEADER) + sizeof(RECT)]; } rgn; HRGN hrgn; XFORM xform; if (0) /* crashes under Win9x */ { SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, 0, NULL); ok(!hrgn, "ExtCreateRegion should fail\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "ERROR_INVALID_PARAMETER, got %u\n", GetLastError()); } rgn.data.rdh.dwSize = 0; rgn.data.rdh.iType = 0; rgn.data.rdh.nCount = 0; rgn.data.rdh.nRgnSize = 0; SetRectEmpty(&rgn.data.rdh.rcBound); memcpy(rgn.data.Buffer, &rc, sizeof(rc)); SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data); ok(!hrgn, "ExtCreateRegion should fail\n"); ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %u\n", GetLastError()); rgn.data.rdh.dwSize = sizeof(rgn.data.rdh) - 1; SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data); ok(!hrgn, "ExtCreateRegion should fail\n"); ok(GetLastError() == 0xdeadbeef, "0xdeadbeef, got %u\n", GetLastError()); /* although XP doesn't care about the type Win9x does */ rgn.data.rdh.iType = RDH_RECTANGLES; rgn.data.rdh.dwSize = sizeof(rgn.data.rdh); SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data); ok(hrgn != 0, "ExtCreateRegion error %u\n", GetLastError()); verify_region(hrgn, &empty_rect); DeleteObject(hrgn); rgn.data.rdh.nCount = 1; SetRectEmpty(&rgn.data.rdh.rcBound); memcpy(rgn.data.Buffer, &rc, sizeof(rc)); SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, sizeof(rgn), &rgn.data); ok(hrgn != 0, "ExtCreateRegion error %u\n", GetLastError()); verify_region(hrgn, &rc); DeleteObject(hrgn); rgn.data.rdh.dwSize = sizeof(rgn.data.rdh) + 1; SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(NULL, 1, &rgn.data); ok(hrgn != 0 || broken(GetLastError() == 0xdeadbeef), /* NT4 */ "ExtCreateRegion error %u\n", GetLastError()); if(hrgn) { verify_region(hrgn, &rc); DeleteObject(hrgn); } xform.eM11 = 0.5; /* 50% width */ xform.eM12 = 0.0; xform.eM21 = 0.0; xform.eM22 = 0.5; /* 50% height */ xform.eDx = 20.0; xform.eDy = 40.0; rgn.data.rdh.dwSize = sizeof(rgn.data.rdh); SetLastError(0xdeadbeef); hrgn = ExtCreateRegion(&xform, sizeof(rgn), &rgn.data); ok(hrgn != 0, "ExtCreateRegion error %u/%x\n", GetLastError(), GetLastError()); verify_region(hrgn, &rc_xformed); DeleteObject(hrgn); }
void G1SATBCardTableModRefBS::verify_g1_young_region(MemRegion mr) { verify_region(mr, g1_young_gen, true); }