comparison src/share/vm/runtime/os.cpp @ 14407:94c202aa2646

Merge
author kvn
date Thu, 01 Aug 2013 17:25:10 -0700
parents 75ef1a499665 5e3b6f79d280
children e2722a66aba7
comparison
equal deleted inserted replaced
14406:c9f0adfb4a8b 14407:94c202aa2646
593 593
594 void* os::malloc(size_t size, MEMFLAGS memflags, address caller) { 594 void* os::malloc(size_t size, MEMFLAGS memflags, address caller) {
595 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1)); 595 NOT_PRODUCT(inc_stat_counter(&num_mallocs, 1));
596 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size)); 596 NOT_PRODUCT(inc_stat_counter(&alloc_bytes, size));
597 597
598 #ifdef ASSERT
599 // checking for the WatcherThread and crash_protection first
600 // since os::malloc can be called when the libjvm.{dll,so} is
601 // first loaded and we don't have a thread yet.
602 // try to find the thread after we see that the watcher thread
603 // exists and has crash protection.
604 WatcherThread *wt = WatcherThread::watcher_thread();
605 if (wt != NULL && wt->has_crash_protection()) {
606 Thread* thread = ThreadLocalStorage::get_thread_slow();
607 if (thread == wt) {
608 assert(!wt->has_crash_protection(),
609 "Can't malloc with crash protection from WatcherThread");
610 }
611 }
612 #endif
613
598 if (size == 0) { 614 if (size == 0) {
599 // return a valid pointer if size is zero 615 // return a valid pointer if size is zero
600 // if NULL is returned the calling functions assume out of memory. 616 // if NULL is returned the calling functions assume out of memory.
601 size = 1; 617 size = 1;
602 } 618 }