9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26
27 #include "gc/shared/memset_with_concurrent_readers.hpp"
28 #include "runtime/prefetch.inline.hpp"
29 #include "utilities/debug.hpp"
30 #include "utilities/globalDefinitions.hpp"
31 #include "utilities/macros.hpp"
32
33 #if INCLUDE_ALL_GCS
34
35 // An implementation of memset, for use when there may be concurrent
36 // readers of the region being stored into.
37 //
38 // We can't use the standard library memset if it is implemented using
39 // block initializing stores. Doing so can result in concurrent readers
40 // seeing spurious zeros.
41 //
42 // We can't use the obvious C/C++ for-loop, because the compiler may
43 // recognize the idiomatic loop and optimize it into a call to the
44 // standard library memset; we've seen exactly this happen with, for
45 // example, Solaris Studio 12.3. Hence the use of inline assembly
46 // code, hiding loops from the compiler's optimizer.
47 //
48 // We don't attempt to use the standard library memset when it is safe
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
23 */
24
25 #include "precompiled.hpp"
26
27 #include "gc/shared/memset_with_concurrent_readers.hpp"
28 #include "runtime/prefetch.inline.hpp"
29 #include "utilities/align.hpp"
30 #include "utilities/debug.hpp"
31 #include "utilities/globalDefinitions.hpp"
32 #include "utilities/macros.hpp"
33
34 #if INCLUDE_ALL_GCS
35
36 // An implementation of memset, for use when there may be concurrent
37 // readers of the region being stored into.
38 //
39 // We can't use the standard library memset if it is implemented using
40 // block initializing stores. Doing so can result in concurrent readers
41 // seeing spurious zeros.
42 //
43 // We can't use the obvious C/C++ for-loop, because the compiler may
44 // recognize the idiomatic loop and optimize it into a call to the
45 // standard library memset; we've seen exactly this happen with, for
46 // example, Solaris Studio 12.3. Hence the use of inline assembly
47 // code, hiding loops from the compiler's optimizer.
48 //
49 // We don't attempt to use the standard library memset when it is safe
|