Mercurial > hg > graal-compiler
comparison src/share/vm/memory/cardTableModRefBS.cpp @ 10271:f9be75d21404
8012902: remove use of global operator new - take 2
Summary: The fix of 8010992, disable use of global operator new and new[] which caused failure on some tests. This takes two of the bugs also add ALLOW_OPERATOR_NEW_USAGE to prevent crash for third party code calling operator new of jvm on certain platforms.
Reviewed-by: coleenp, dholmes, zgu
Contributed-by: yumin.qi@oracle.com
author | minqi |
---|---|
date | Tue, 14 May 2013 09:41:12 -0700 |
parents | 746b070f5022 |
children | a837fa3d3f86 |
comparison
equal
deleted
inserted
replaced
10269:a9270d9ecb13 | 10271:f9be75d21404 |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
78 | 78 |
79 assert(card_size <= 512, "card_size must be less than 512"); // why? | 79 assert(card_size <= 512, "card_size must be less than 512"); // why? |
80 | 80 |
81 _covered = new MemRegion[max_covered_regions]; | 81 _covered = new MemRegion[max_covered_regions]; |
82 _committed = new MemRegion[max_covered_regions]; | 82 _committed = new MemRegion[max_covered_regions]; |
83 if (_covered == NULL || _committed == NULL) | 83 if (_covered == NULL || _committed == NULL) { |
84 vm_exit_during_initialization("couldn't alloc card table covered region set."); | 84 vm_exit_during_initialization("couldn't alloc card table covered region set."); |
85 int i; | 85 } |
86 for (i = 0; i < max_covered_regions; i++) { | 86 |
87 _covered[i].set_word_size(0); | |
88 _committed[i].set_word_size(0); | |
89 } | |
90 _cur_covered_regions = 0; | 87 _cur_covered_regions = 0; |
91 | |
92 const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 : | 88 const size_t rs_align = _page_size == (size_t) os::vm_page_size() ? 0 : |
93 MAX2(_page_size, (size_t) os::vm_allocation_granularity()); | 89 MAX2(_page_size, (size_t) os::vm_allocation_granularity()); |
94 ReservedSpace heap_rs(_byte_map_size, rs_align, false); | 90 ReservedSpace heap_rs(_byte_map_size, rs_align, false); |
95 | 91 |
96 MemTracker::record_virtual_memory_type((address)heap_rs.base(), mtGC); | 92 MemTracker::record_virtual_memory_type((address)heap_rs.base(), mtGC); |
132 if (_lowest_non_clean == NULL | 128 if (_lowest_non_clean == NULL |
133 || _lowest_non_clean_chunk_size == NULL | 129 || _lowest_non_clean_chunk_size == NULL |
134 || _lowest_non_clean_base_chunk_index == NULL | 130 || _lowest_non_clean_base_chunk_index == NULL |
135 || _last_LNC_resizing_collection == NULL) | 131 || _last_LNC_resizing_collection == NULL) |
136 vm_exit_during_initialization("couldn't allocate an LNC array."); | 132 vm_exit_during_initialization("couldn't allocate an LNC array."); |
137 for (i = 0; i < max_covered_regions; i++) { | 133 for (int i = 0; i < max_covered_regions; i++) { |
138 _lowest_non_clean[i] = NULL; | 134 _lowest_non_clean[i] = NULL; |
139 _lowest_non_clean_chunk_size[i] = 0; | 135 _lowest_non_clean_chunk_size[i] = 0; |
140 _last_LNC_resizing_collection[i] = -1; | 136 _last_LNC_resizing_collection[i] = -1; |
141 } | 137 } |
142 | 138 |
148 &_byte_map[0], | 144 &_byte_map[0], |
149 &_byte_map[_last_valid_index]); | 145 &_byte_map[_last_valid_index]); |
150 gclog_or_tty->print_cr(" " | 146 gclog_or_tty->print_cr(" " |
151 " byte_map_base: " INTPTR_FORMAT, | 147 " byte_map_base: " INTPTR_FORMAT, |
152 byte_map_base); | 148 byte_map_base); |
149 } | |
150 } | |
151 | |
152 CardTableModRefBS::~CardTableModRefBS() { | |
153 if (_covered) { | |
154 delete[] _covered; | |
155 _covered = NULL; | |
156 } | |
157 if (_committed) { | |
158 delete[] _committed; | |
159 _committed = NULL; | |
160 } | |
161 if (_lowest_non_clean) { | |
162 FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC); | |
163 _lowest_non_clean = NULL; | |
164 } | |
165 if (_lowest_non_clean_chunk_size) { | |
166 FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC); | |
167 _lowest_non_clean_chunk_size = NULL; | |
168 } | |
169 if (_lowest_non_clean_base_chunk_index) { | |
170 FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC); | |
171 _lowest_non_clean_base_chunk_index = NULL; | |
172 } | |
173 if (_last_LNC_resizing_collection) { | |
174 FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC); | |
175 _last_LNC_resizing_collection = NULL; | |
153 } | 176 } |
154 } | 177 } |
155 | 178 |
156 int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) { | 179 int CardTableModRefBS::find_covering_region_by_base(HeapWord* base) { |
157 int i; | 180 int i; |