# HG changeset patch # User Lukas Stadler # Date 1354273718 -3600 # Node ID 1c76a458616ea3e701023c6be03e886d5c485422 # Parent acfca8c77dd297777efe4c88434a7e96aad68943 simplified TLAB allocation (don't use + and -) diff -r acfca8c77dd2 -r 1c76a458616e graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Fri Nov 30 11:13:36 2012 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Fri Nov 30 12:08:38 2012 +0100 @@ -61,9 +61,9 @@ Word thread = thread(); Word top = loadWordFromWord(thread, threadTlabTopOffset()); Word end = loadWordFromWord(thread, threadTlabEndOffset()); - Word available = end.minus(top); - if (available.aboveOrEqual(Word.fromInt(size))) { - Word newTop = top.plus(size); + Word newTop = top.plus(size); + // this check might lead to problems if the TLAB is within 16GB of the address space end (checked in c++ code) + if (newTop.belowOrEqual(end)) { storeObject(thread, 0, threadTlabTopOffset(), newTop); return top; } diff -r acfca8c77dd2 -r 1c76a458616e src/share/vm/graal/graalCompiler.cpp --- a/src/share/vm/graal/graalCompiler.cpp Fri Nov 30 11:13:36 2012 +0100 +++ b/src/share/vm/graal/graalCompiler.cpp Fri Nov 30 12:08:38 2012 +0100 @@ -49,6 +49,11 @@ JavaThread* THREAD = JavaThread::current(); TRACE_graal_1("GraalCompiler::initialize"); + unsigned long heap_end = (long) Universe::heap()->reserved_region().end(); + unsigned long allocation_end = heap_end + 16l * 1024 * 1024 * 1024; + guarantee(heap_end < allocation_end, "heap end too close to end of address space (might lead to erroneous TLAB allocations)"); + NOT_LP64(error("check TLAB allocation code for address space conflicts")); + _deopted_leaf_graph_count = 0; initialize_buffer_blob();