--- old/hotspot/src/share/vm/gc_implementation/parNew/parGCAllocBuffer.hpp 2009-08-01 04:10:43.982095514 +0100 +++ new/hotspot/src/share/vm/gc_implementation/parNew/parGCAllocBuffer.hpp 2009-08-01 04:10:43.897123752 +0100 @@ -2,7 +2,7 @@ #pragma ident "@(#)parGCAllocBuffer.hpp 1.30 07/05/29 09:44:13 JVM" #endif /* - * Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2001-2008 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,8 +44,8 @@ size_t _allocated; // in HeapWord units size_t _wasted; // in HeapWord units char tail[32]; - static const size_t FillerHeaderSize; - static const size_t AlignmentReserve; + static size_t FillerHeaderSize; + static size_t AlignmentReserve; public: // Initializes the buffer to be empty, but with the given "word_sz". @@ -66,9 +66,8 @@ // return NULL. HeapWord* allocate(size_t word_sz) { HeapWord* res = _top; - HeapWord* new_top = _top + word_sz; - if (new_top <= _end) { - _top = new_top; + if (pointer_delta(_end, _top) >= word_sz) { + _top = _top + word_sz; return res; } else { return NULL; @@ -78,10 +77,9 @@ // Undo the last allocation in the buffer, which is required to be of the // "obj" of the given "word_sz". void undo_allocation(HeapWord* obj, size_t word_sz) { - assert(_top - word_sz >= _bottom - && _top - word_sz == obj, - "Bad undo_allocation"); - _top = _top - word_sz; + assert(pointer_delta(_top, _bottom) >= word_sz, "Bad undo"); + assert(pointer_delta(_top, obj) == word_sz, "Bad undo"); + _top = obj; } // The total (word) size of the buffer, including both allocated and