Thu, 24 Oct 2013 16:23:07 -0700
8026328: Setting a breakpoint on invokedynamic crashes the JVM
Reviewed-by: jrose, roland
1 /*
2 * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
3 * Copyright 2007 Red Hat, Inc.
4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 *
6 * This code is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This code is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
26 #ifndef CPU_ZERO_VM_COPY_ZERO_HPP
27 #define CPU_ZERO_VM_COPY_ZERO_HPP
29 // Inline functions for memory copy and fill.
31 static void pd_conjoint_words(HeapWord* from, HeapWord* to, size_t count) {
32 memmove(to, from, count * HeapWordSize);
33 }
35 static void pd_disjoint_words(HeapWord* from, HeapWord* to, size_t count) {
36 switch (count) {
37 case 8: to[7] = from[7];
38 case 7: to[6] = from[6];
39 case 6: to[5] = from[5];
40 case 5: to[4] = from[4];
41 case 4: to[3] = from[3];
42 case 3: to[2] = from[2];
43 case 2: to[1] = from[1];
44 case 1: to[0] = from[0];
45 case 0: break;
46 default:
47 memcpy(to, from, count * HeapWordSize);
48 break;
49 }
50 }
52 static void pd_disjoint_words_atomic(HeapWord* from,
53 HeapWord* to,
54 size_t count) {
55 switch (count) {
56 case 8: to[7] = from[7];
57 case 7: to[6] = from[6];
58 case 6: to[5] = from[5];
59 case 5: to[4] = from[4];
60 case 4: to[3] = from[3];
61 case 3: to[2] = from[2];
62 case 2: to[1] = from[1];
63 case 1: to[0] = from[0];
64 case 0: break;
65 default:
66 while (count-- > 0) {
67 *to++ = *from++;
68 }
69 break;
70 }
71 }
73 static void pd_aligned_conjoint_words(HeapWord* from,
74 HeapWord* to,
75 size_t count) {
76 memmove(to, from, count * HeapWordSize);
77 }
79 static void pd_aligned_disjoint_words(HeapWord* from,
80 HeapWord* to,
81 size_t count) {
82 pd_disjoint_words(from, to, count);
83 }
85 static void pd_conjoint_bytes(void* from, void* to, size_t count) {
86 memmove(to, from, count);
87 }
89 static void pd_conjoint_bytes_atomic(void* from, void* to, size_t count) {
90 memmove(to, from, count);
91 }
93 static void pd_conjoint_jshorts_atomic(jshort* from, jshort* to, size_t count) {
94 _Copy_conjoint_jshorts_atomic(from, to, count);
95 }
97 static void pd_conjoint_jints_atomic(jint* from, jint* to, size_t count) {
98 _Copy_conjoint_jints_atomic(from, to, count);
99 }
101 static void pd_conjoint_jlongs_atomic(jlong* from, jlong* to, size_t count) {
102 _Copy_conjoint_jlongs_atomic(from, to, count);
103 }
105 static void pd_conjoint_oops_atomic(oop* from, oop* to, size_t count) {
106 #ifdef _LP64
107 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
108 _Copy_conjoint_jlongs_atomic((jlong*)from, (jlong*)to, count);
109 #else
110 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
111 _Copy_conjoint_jints_atomic((jint*)from, (jint*)to, count);
112 #endif // _LP64
113 }
115 static void pd_arrayof_conjoint_bytes(HeapWord* from,
116 HeapWord* to,
117 size_t count) {
118 _Copy_arrayof_conjoint_bytes(from, to, count);
119 }
121 static void pd_arrayof_conjoint_jshorts(HeapWord* from,
122 HeapWord* to,
123 size_t count) {
124 _Copy_arrayof_conjoint_jshorts(from, to, count);
125 }
127 static void pd_arrayof_conjoint_jints(HeapWord* from,
128 HeapWord* to,
129 size_t count) {
130 _Copy_arrayof_conjoint_jints(from, to, count);
131 }
133 static void pd_arrayof_conjoint_jlongs(HeapWord* from,
134 HeapWord* to,
135 size_t count) {
136 _Copy_arrayof_conjoint_jlongs(from, to, count);
137 }
139 static void pd_arrayof_conjoint_oops(HeapWord* from,
140 HeapWord* to,
141 size_t count) {
142 #ifdef _LP64
143 assert(BytesPerLong == BytesPerOop, "jlongs and oops must be the same size");
144 _Copy_arrayof_conjoint_jlongs(from, to, count);
145 #else
146 assert(BytesPerInt == BytesPerOop, "jints and oops must be the same size");
147 _Copy_arrayof_conjoint_jints(from, to, count);
148 #endif // _LP64
149 }
151 static void pd_fill_to_words(HeapWord* tohw, size_t count, juint value) {
152 #ifdef _LP64
153 julong* to = (julong*) tohw;
154 julong v = ((julong) value << 32) | value;
155 #else
156 juint* to = (juint*) tohw;
157 juint v = value;
158 #endif // _LP64
160 while (count-- > 0) {
161 *to++ = v;
162 }
163 }
165 static void pd_fill_to_aligned_words(HeapWord* tohw,
166 size_t count,
167 juint value) {
168 pd_fill_to_words(tohw, count, value);
169 }
171 static void pd_fill_to_bytes(void* to, size_t count, jubyte value) {
172 memset(to, value, count);
173 }
175 static void pd_zero_to_words(HeapWord* tohw, size_t count) {
176 pd_fill_to_words(tohw, count, 0);
177 }
179 static void pd_zero_to_bytes(void* to, size_t count) {
180 memset(to, 0, count);
181 }
183 #endif // CPU_ZERO_VM_COPY_ZERO_HPP