test/testlibrary/ctw/README

Tue, 08 Aug 2017 15:57:29 +0800

author
aoqi
date
Tue, 08 Aug 2017 15:57:29 +0800
changeset 6876
710a3c8b516e
parent 0
f90c822e73f8
child 7894
599c27e30262
permissions
-rw-r--r--

merge

aoqi@0 1 #
aoqi@0 2 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
aoqi@0 3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
aoqi@0 4 #
aoqi@0 5 # This code is free software; you can redistribute it and/or modify it
aoqi@0 6 # under the terms of the GNU General Public License version 2 only, as
aoqi@0 7 # published by the Free Software Foundation.
aoqi@0 8 #
aoqi@0 9 # This code is distributed in the hope that it will be useful, but WITHOUT
aoqi@0 10 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
aoqi@0 11 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
aoqi@0 12 # version 2 for more details (a copy is included in the LICENSE file that
aoqi@0 13 # accompanied this code).
aoqi@0 14 #
aoqi@0 15 # You should have received a copy of the GNU General Public License version
aoqi@0 16 # 2 along with this work; if not, write to the Free Software Foundation,
aoqi@0 17 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
aoqi@0 18 #
aoqi@0 19 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
aoqi@0 20 # or visit www.oracle.com if you need additional information or have any
aoqi@0 21 # questions.
aoqi@0 22 #
aoqi@0 23 #
aoqi@0 24
aoqi@0 25 DESCRIPTION
aoqi@0 26
aoqi@0 27 This is replacement for CompileTheWorld (CTW) written on java. Its purpose is
aoqi@0 28 to make possible the use of CTW in product builds.
aoqi@0 29
aoqi@0 30 DEPENDENCES
aoqi@0 31
aoqi@0 32 The tool depends on Whitebox API. Assumed, that the sources of whitebox are
aoqi@0 33 located in '../whitebox' directory.
aoqi@0 34
aoqi@0 35 BUILDING
aoqi@0 36
aoqi@0 37 Simple way to build, just type 'make'.
aoqi@0 38
aoqi@0 39 Makefile uses environment variables 'ALT_BOOTDIR', 'BOOTDIR' as root-dir of jdk
aoqi@0 40 that will be used for compilation and creating jar.
aoqi@0 41
aoqi@0 42 On successful building 'ctw.jar' will be created.
aoqi@0 43
aoqi@0 44 RUNNING
aoqi@0 45
aoqi@0 46 Since the tool uses WhiteBox API, options 'UnlockDiagnosticVMOptions' and
aoqi@0 47 'WhiteBoxAPI' should be specified, and 'wb.jar' should be added to
aoqi@0 48 boot-classpath:
aoqi@0 49 $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar
aoqi@0 50
aoqi@0 51 Arguments can be paths to '.jar, '.zip', '.lst' files or directories with
aoqi@0 52 classes, that define which classes will be compiled:
aoqi@0 53 - '.jar', '.zip' files and directories are interpreted like in classpath
aoqi@0 54 (including '<dir>/*' syntax)
aoqi@0 55 - '.lst' files -- files with class names (in java notation) to compile.
aoqi@0 56 CTW will try to find these classes with default class loader, so they should
aoqi@0 57 be located in classpath.
aoqi@0 58
aoqi@0 59 Without arguments it would work as old version of CTW: all classes in
aoqi@0 60 boot-classpath will be compiled, excluding classes in 'rt.jar' if 'rt.jar' isn't
aoqi@0 61 first in boot-classpath.
aoqi@0 62
aoqi@0 63 Due CTW's flags also are not available in product builds, the tool uses
aoqi@0 64 properties with the same names:
aoqi@0 65 - 'CompileTheWorldPreloadClasses' -- type:boolean, default:true, description:
aoqi@0 66 Preload all classes used by a class before start loading
aoqi@0 67 - 'CompileTheWorldStartAt' -- type:long, default:1, description: First class
aoqi@0 68 to consider
aoqi@0 69 - 'CompileTheWorldStopAt' -- type:long, default:Long.MAX_VALUE, description:
aoqi@0 70 Last class to consider
aoqi@0 71
aoqi@0 72 Also it uses additional properties:
aoqi@0 73 - 'sun.hotspot.tools.ctw.verbose' -- type:boolean, default:false,
aoqi@0 74 description: Verbose output, adds additional information about compilation
aoqi@0 75 - 'sun.hotspot.tools.ctw.logfile' -- type:string, default:null,
aoqi@0 76 description: Path to logfile, if it's null, cout will be used.
aoqi@0 77
aoqi@0 78 EXAMPLES
aoqi@0 79
aoqi@0 80 compile classes from 'rt.jar':
aoqi@0 81 $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar ${JAVA_HOME}/jre/lib/rt.jar
aoqi@0 82
aoqi@0 83 compile classes from all '.jar' in './testjars' directory:
aoqi@0 84 $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar ./testjars/*
aoqi@0 85
aoqi@0 86 compile classes from './build/classes' directory:
aoqi@0 87 $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar ./build/classes
aoqi@0 88
aoqi@0 89 compile only java.lang.String, java.lang.Object classes:
aoqi@0 90 $ echo java.lang.String > classes.lst
aoqi@0 91 $ echo java.lang.Object >> classes.lst
aoqi@0 92 $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar classes.lst
aoqi@0 93

mercurial