8 *
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 * @test
26 * @bug 6700100 8156760
27 * @summary small instance clone as loads/stores
28 * @compile TestInstanceCloneAsLoadsStores.java TestInstanceCloneUtils.java
29 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* TestInstanceCloneAsLoadsStores
30 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode TestInstanceCloneAsLoadsStores
31 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:CompileCommand=dontinline,TestInstanceCloneAsLoadsStores::m* -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks TestInstanceCloneAsLoadsStores
32 */
33
34 public class TestInstanceCloneAsLoadsStores extends TestInstanceCloneUtils {
35
36 // Should be compiled as loads/stores
37 static Object m1(D src) throws CloneNotSupportedException {
38 return src.clone();
39 }
40
41 // Should be compiled as adds of src (dest allocation eliminated)
42 static int m2(D src) throws CloneNotSupportedException {
43 D dest = (D)src.clone();
44 return dest.i1 + dest.i2 + ((int)dest.i3) + dest.i4 + dest.i5;
45 }
46
47 // Should be compiled as arraycopy stub call (object too large)
48 static int m3(E src) throws CloneNotSupportedException {
49 E dest = (E)src.clone();
50 return dest.i1 + dest.i2 + dest.i3 + dest.i4 + dest.i5 +
51 dest.i6 + dest.i7 + dest.i8 + dest.i9;
52 }
53
|
8 *
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 * @test
26 * @bug 6700100 8156760
27 * @summary small instance clone as loads/stores
28 * @library /
29 *
30 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
31 * -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m*
32 * compiler.arraycopy.TestInstanceCloneAsLoadsStores
33 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
34 * -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m*
35 * -XX:+IgnoreUnrecognizedVMOptions -XX:+StressArrayCopyMacroNode
36 * compiler.arraycopy.TestInstanceCloneAsLoadsStores
37 * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement
38 * -XX:CompileCommand=dontinline,compiler.arraycopy.TestInstanceCloneAsLoadsStores::m*
39 * -XX:+IgnoreUnrecognizedVMOptions -XX:-ReduceInitialCardMarks
40 * compiler.arraycopy.TestInstanceCloneAsLoadsStores
41 */
42
43 package compiler.arraycopy;
44
45 public class TestInstanceCloneAsLoadsStores extends TestInstanceCloneUtils {
46
47 // Should be compiled as loads/stores
48 static Object m1(D src) throws CloneNotSupportedException {
49 return src.clone();
50 }
51
52 // Should be compiled as adds of src (dest allocation eliminated)
53 static int m2(D src) throws CloneNotSupportedException {
54 D dest = (D)src.clone();
55 return dest.i1 + dest.i2 + ((int)dest.i3) + dest.i4 + dest.i5;
56 }
57
58 // Should be compiled as arraycopy stub call (object too large)
59 static int m3(E src) throws CloneNotSupportedException {
60 E dest = (E)src.clone();
61 return dest.i1 + dest.i2 + dest.i3 + dest.i4 + dest.i5 +
62 dest.i6 + dest.i7 + dest.i8 + dest.i9;
63 }
64
|