Mercurial > hg > graal-compiler
comparison src/share/vm/oops/typeArrayKlass.cpp @ 3961:a92cdbac8b9e
7081933: Use zeroing elimination optimization for large array
Summary: Don't zero new typeArray during runtime call if the allocation is followed by arraycopy into it.
Reviewed-by: twisti
author | kvn |
---|---|
date | Mon, 26 Sep 2011 10:24:05 -0700 |
parents | c9ca3f51cf41 |
children | a735aec54ea4 |
comparison
equal
deleted
inserted
replaced
3960:f08d439fab8c | 3961:a92cdbac8b9e |
---|---|
74 complete_create_array_klass(k, super, CHECK_NULL); | 74 complete_create_array_klass(k, super, CHECK_NULL); |
75 | 75 |
76 return k(); | 76 return k(); |
77 } | 77 } |
78 | 78 |
79 typeArrayOop typeArrayKlass::allocate(int length, TRAPS) { | 79 typeArrayOop typeArrayKlass::allocate_common(int length, bool do_zero, TRAPS) { |
80 assert(log2_element_size() >= 0, "bad scale"); | 80 assert(log2_element_size() >= 0, "bad scale"); |
81 if (length >= 0) { | 81 if (length >= 0) { |
82 if (length <= max_length()) { | 82 if (length <= max_length()) { |
83 size_t size = typeArrayOopDesc::object_size(layout_helper(), length); | 83 size_t size = typeArrayOopDesc::object_size(layout_helper(), length); |
84 KlassHandle h_k(THREAD, as_klassOop()); | 84 KlassHandle h_k(THREAD, as_klassOop()); |
85 typeArrayOop t; | 85 typeArrayOop t; |
86 CollectedHeap* ch = Universe::heap(); | 86 CollectedHeap* ch = Universe::heap(); |
87 t = (typeArrayOop)CollectedHeap::array_allocate(h_k, (int)size, length, CHECK_NULL); | 87 if (do_zero) { |
88 t = (typeArrayOop)CollectedHeap::array_allocate(h_k, (int)size, length, CHECK_NULL); | |
89 } else { | |
90 t = (typeArrayOop)CollectedHeap::array_allocate_nozero(h_k, (int)size, length, CHECK_NULL); | |
91 } | |
88 assert(t->is_parsable(), "Don't publish unless parsable"); | 92 assert(t->is_parsable(), "Don't publish unless parsable"); |
89 return t; | 93 return t; |
90 } else { | 94 } else { |
91 report_java_out_of_memory("Requested array size exceeds VM limit"); | 95 report_java_out_of_memory("Requested array size exceeds VM limit"); |
92 THROW_OOP_0(Universe::out_of_memory_error_array_size()); | 96 THROW_OOP_0(Universe::out_of_memory_error_array_size()); |