annotate test/testlibrary/ClassFileInstaller.java @ 10185:d50cc62e94ff

8012715: G1: GraphKit accesses PtrQueue::_index as int but is size_t Summary: In graphKit INT operations were generated to access PtrQueue::_index which has type size_t. This is 64 bit on 64-bit machines. No problems occur on little endian machines as long as the index fits into 32 bit, but on big endian machines the upper part is read, which is zero. This leads to unnecessary branches to the slow path in the runtime. Reviewed-by: twisti, johnc Contributed-by: Martin Doerr <martin.doerr@sap.com>
author johnc
date Wed, 24 Apr 2013 14:48:43 -0700
parents 1b0dc9f87e75
children 43083e670adf
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8098
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
1 /*
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
4 *
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
7 * published by the Free Software Foundation.
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
8 *
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
13 * accompanied this code).
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
14 *
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
18 *
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
21 * questions.
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
22 */
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
23
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
24 import java.io.InputStream;
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
25 import java.nio.file.Files;
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
26 import java.nio.file.Path;
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
27 import java.nio.file.Paths;
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
28 import java.nio.file.StandardCopyOption;
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
29
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
30 /**
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
31 * Dump a class file for a class on the class path in the current directory
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
32 */
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
33 public class ClassFileInstaller {
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
34 /**
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
35 * @param args The names of the classes to dump
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
36 * @throws Exception
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
37 */
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
38 public static void main(String... args) throws Exception {
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
39 for (String arg : args) {
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
40 ClassLoader cl = ClassFileInstaller.class.getClassLoader();
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
41
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
42 // Convert dotted class name to a path to a class file
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
43 String pathName = arg.replace('.', '/').concat(".class");
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
44 InputStream is = cl.getResourceAsStream(pathName);
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
45
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
46 // Create the class file's package directory
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
47 Path p = Paths.get(pathName);
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
48 Files.createDirectories(p.getParent());
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
49 // Create the class file
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
50 Files.copy(is, p, StandardCopyOption.REPLACE_EXISTING);
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
51 }
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
52 }
1b0dc9f87e75 8006753: fix failed for JDK-8002415 White box testing API for HotSpot
mgerdin
parents:
diff changeset
53 }