Mercurial > hg > graal-jvmci-8
comparison src/share/vm/prims/whitebox.cpp @ 10341:f54c85acc043
8013726: runtime/memory/ReserveMemory.java fails due to 'assert(bytes % os::vm_allocation_granularity() == 0) failed: reserve block size'
Summary: Fix regression test to work on all platforms
Reviewed-by: ctornqvi, dholmes
author | mikael |
---|---|
date | Tue, 21 May 2013 09:43:23 -0700 |
parents | d17700c82d7d |
children | a837fa3d3f86 |
comparison
equal
deleted
inserted
replaced
10314:bbddfb08190f | 10341:f54c85acc043 |
---|---|
35 | 35 |
36 #include "runtime/interfaceSupport.hpp" | 36 #include "runtime/interfaceSupport.hpp" |
37 #include "runtime/os.hpp" | 37 #include "runtime/os.hpp" |
38 #include "utilities/debug.hpp" | 38 #include "utilities/debug.hpp" |
39 #include "utilities/macros.hpp" | 39 #include "utilities/macros.hpp" |
40 #include "utilities/exceptions.hpp" | |
40 | 41 |
41 #if INCLUDE_ALL_GCS | 42 #if INCLUDE_ALL_GCS |
42 #include "gc_implementation/g1/concurrentMark.hpp" | 43 #include "gc_implementation/g1/concurrentMark.hpp" |
43 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | 44 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
44 #include "gc_implementation/g1/heapRegionRemSet.hpp" | 45 #include "gc_implementation/g1/heapRegionRemSet.hpp" |
328 Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(true); | 329 Universe::heap()->collector_policy()->set_should_clear_all_soft_refs(true); |
329 Universe::heap()->collect(GCCause::_last_ditch_collection); | 330 Universe::heap()->collect(GCCause::_last_ditch_collection); |
330 WB_END | 331 WB_END |
331 | 332 |
332 | 333 |
333 WB_ENTRY(jlong, WB_ReserveMemory(JNIEnv* env, jobject o, jlong size)) | 334 WB_ENTRY(void, WB_ReadReservedMemory(JNIEnv* env, jobject o)) |
334 return (jlong)os::reserve_memory(size, NULL, 0); | 335 // static+volatile in order to force the read to happen |
336 // (not be eliminated by the compiler) | |
337 static char c; | |
338 static volatile char* p; | |
339 | |
340 p = os::reserve_memory(os::vm_allocation_granularity(), NULL, 0); | |
341 if (p == NULL) { | |
342 THROW_MSG(vmSymbols::java_lang_OutOfMemoryError(), "Failed to reserve memory"); | |
343 } | |
344 | |
345 c = *p; | |
335 WB_END | 346 WB_END |
336 | 347 |
337 //Some convenience methods to deal with objects from java | 348 //Some convenience methods to deal with objects from java |
338 int WhiteBox::offset_for_field(const char* field_name, oop object, | 349 int WhiteBox::offset_for_field(const char* field_name, oop object, |
339 Symbol* signature_symbol) { | 350 Symbol* signature_symbol) { |
435 {CC"clearMethodState", | 446 {CC"clearMethodState", |
436 CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState}, | 447 CC"(Ljava/lang/reflect/Executable;)V", (void*)&WB_ClearMethodState}, |
437 {CC"isInStringTable", CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable }, | 448 {CC"isInStringTable", CC"(Ljava/lang/String;)Z", (void*)&WB_IsInStringTable }, |
438 {CC"fullGC", CC"()V", (void*)&WB_FullGC }, | 449 {CC"fullGC", CC"()V", (void*)&WB_FullGC }, |
439 | 450 |
440 {CC"reserveMemory", CC"(J)J", (void*)&WB_ReserveMemory }, | 451 {CC"readReservedMemory", CC"()V", (void*)&WB_ReadReservedMemory }, |
441 }; | 452 }; |
442 | 453 |
443 #undef CC | 454 #undef CC |
444 | 455 |
445 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass)) | 456 JVM_ENTRY(void, JVM_RegisterWhiteBoxMethods(JNIEnv* env, jclass wbclass)) |