Skip to content

Commit

Permalink
RVM-1055 : Move assertion for cursor state in allocPages into the syn…
Browse files Browse the repository at this point in the history
…chronized part.

The cursor state cannot be safely checked in an unsynchronized part because different parts of the assertion checking code might see different values.
  • Loading branch information
erik-brangs committed Mar 21, 2016
1 parent 064074a commit a4e5467
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions MMTk/src/org/mmtk/utility/heap/MonotonePageResource.java
Expand Up @@ -127,6 +127,10 @@ public int getAvailablePhysicalPages() {
@Override
@Inline
protected Address allocPages(int reservedPages, int requiredPages, boolean zeroed) {
boolean newChunk = false;
lock();
Address rtn = cursor;

if (VM.VERIFY_ASSERTIONS) {
/*
* Cursor should always be zero, or somewhere in the current chunk. If we have just
Expand All @@ -141,9 +145,6 @@ protected Address allocPages(int reservedPages, int requiredPages, boolean zeroe
Space.chunkAlign(cursor, true).EQ(currentChunk) ||
Space.chunkAlign(cursor, true).EQ(currentChunk.plus(Space.BYTES_IN_CHUNK)));
}
boolean newChunk = false;
lock();
Address rtn = cursor;

if (metaDataPagesPerRegion != 0) {
/* adjust allocation for metadata */
Expand Down

0 comments on commit a4e5467

Please sign in to comment.