Mercurial > hg > truffle
comparison src/share/vm/memory/allocation.hpp @ 12109:faf2631b9334
8022683: JNI GetStringUTFChars should return NULL on allocation failure not abort the VM
Summary: Return NULL on OOM from GetStringChars, GetStringUTFChars and Get<PrimitiveType>ArrayElements family of functions.
Reviewed-by: dholmes, coleenp
author | dsimms |
---|---|
date | Mon, 26 Aug 2013 09:33:01 +0200 |
parents | cf9d71d3e474 |
children | 9758d9f36299 e2722a66aba7 |
comparison
equal
deleted
inserted
replaced
12108:badf4244ceae | 12109:faf2631b9334 |
---|---|
664 | 664 |
665 #define NEW_RESOURCE_OBJ_RETURN_NULL(type)\ | 665 #define NEW_RESOURCE_OBJ_RETURN_NULL(type)\ |
666 NEW_RESOURCE_ARRAY_RETURN_NULL(type, 1) | 666 NEW_RESOURCE_ARRAY_RETURN_NULL(type, 1) |
667 | 667 |
668 #define NEW_C_HEAP_ARRAY3(type, size, memflags, pc, allocfail)\ | 668 #define NEW_C_HEAP_ARRAY3(type, size, memflags, pc, allocfail)\ |
669 (type*) AllocateHeap(size * sizeof(type), memflags, pc, allocfail) | 669 (type*) AllocateHeap((size) * sizeof(type), memflags, pc, allocfail) |
670 | 670 |
671 #define NEW_C_HEAP_ARRAY2(type, size, memflags, pc)\ | 671 #define NEW_C_HEAP_ARRAY2(type, size, memflags, pc)\ |
672 (type*) (AllocateHeap((size) * sizeof(type), memflags, pc)) | 672 (type*) (AllocateHeap((size) * sizeof(type), memflags, pc)) |
673 | 673 |
674 #define NEW_C_HEAP_ARRAY(type, size, memflags)\ | 674 #define NEW_C_HEAP_ARRAY(type, size, memflags)\ |
675 (type*) (AllocateHeap((size) * sizeof(type), memflags)) | 675 (type*) (AllocateHeap((size) * sizeof(type), memflags)) |
676 | 676 |
677 #define NEW_C_HEAP_ARRAY2_RETURN_NULL(type, size, memflags, pc)\ | 677 #define NEW_C_HEAP_ARRAY2_RETURN_NULL(type, size, memflags, pc)\ |
678 NEW_C_HEAP_ARRAY3(type, size, memflags, pc, AllocFailStrategy::RETURN_NULL) | 678 NEW_C_HEAP_ARRAY3(type, (size), memflags, pc, AllocFailStrategy::RETURN_NULL) |
679 | 679 |
680 #define NEW_C_HEAP_ARRAY_RETURN_NULL(type, size, memflags)\ | 680 #define NEW_C_HEAP_ARRAY_RETURN_NULL(type, size, memflags)\ |
681 NEW_C_HEAP_ARRAY3(type, size, memflags, (address)0, AllocFailStrategy::RETURN_NULL) | 681 NEW_C_HEAP_ARRAY3(type, (size), memflags, (address)0, AllocFailStrategy::RETURN_NULL) |
682 | 682 |
683 #define REALLOC_C_HEAP_ARRAY(type, old, size, memflags)\ | 683 #define REALLOC_C_HEAP_ARRAY(type, old, size, memflags)\ |
684 (type*) (ReallocateHeap((char*)old, (size) * sizeof(type), memflags)) | 684 (type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags)) |
685 | 685 |
686 #define REALLOC_C_HEAP_ARRAY_RETURN_NULL(type, old, size, memflags)\ | 686 #define REALLOC_C_HEAP_ARRAY_RETURN_NULL(type, old, size, memflags)\ |
687 (type*) (ReallocateHeap((char*)old, (size) * sizeof(type), memflags, AllocFailStrategy::RETURN_NULL)) | 687 (type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags, AllocFailStrategy::RETURN_NULL)) |
688 | 688 |
689 #define FREE_C_HEAP_ARRAY(type, old, memflags) \ | 689 #define FREE_C_HEAP_ARRAY(type, old, memflags) \ |
690 FreeHeap((char*)(old), memflags) | 690 FreeHeap((char*)(old), memflags) |
691 | 691 |
692 // allocate type in heap without calling ctor | 692 // allocate type in heap without calling ctor |