1 #
   2 # Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
   3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4 #
   5 # This code is free software; you can redistribute it and/or modify it
   6 # under the terms of the GNU General Public License version 2 only, as
   7 # published by the Free Software Foundation.
   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 DESCRIPTION
  26 
  27 This is replacement for CompileTheWorld (CTW) written on java. Its purpose is
  28 to make possible the use of CTW in product builds.
  29 
  30 DEPENDENCES
  31 
  32 The tool depends on Whitebox API. Assumed, that the sources of whitebox are
  33 located in '../whitebox' directory.
  34 
  35 BUILDING
  36 
  37 Simple way to build, just type 'make'.
  38 
  39 Makefile uses environment variables 'ALT_BOOTDIR', 'BOOTDIR' as root-dir of jdk
  40 that will be used for compilation and creating jar.
  41 
  42 On successful building 'ctw.jar' will be created.
  43 
  44 RUNNING
  45 
  46 Since the tool uses WhiteBox API, options 'UnlockDiagnosticVMOptions' and
  47 'WhiteBoxAPI' should be specified, and 'wb.jar' should be added to
  48 boot-classpath:
  49   $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar 
  50 
  51 Arguments can be paths to '.jar, '.zip', '.lst' files or directories with
  52 classes, that define which classes will be compiled:
  53   - '.jar', '.zip' files and directories are interpreted like in classpath
  54 (including '<dir>/*' syntax)
  55   - '.lst' files -- files with class names (in java notation) to compile.
  56 CTW will try to find these classes with default class loader, so they should
  57 be located in classpath.
  58 
  59 Without arguments it would work as old version of CTW: all classes in
  60 boot-classpath will be compiled, excluding classes in 'rt.jar' if 'rt.jar' isn't
  61 first in boot-classpath.
  62 
  63 Due CTW's flags also are not available in product builds, the tool uses
  64 properties with the same names:
  65   - 'CompileTheWorldPreloadClasses' -- type:boolean, default:true, description:
  66 Preload all classes used by a class before start loading
  67   - 'CompileTheWorldStartAt' -- type:long, default:1, description: First class
  68 to consider
  69   - 'CompileTheWorldStopAt' -- type:long, default:Long.MAX_VALUE, description:
  70 Last class to consider
  71 
  72 Also it uses additional properties:
  73   - 'sun.hotspot.tools.ctw.verbose' -- type:boolean, default:false,
  74 description: Verbose output, adds additional information about compilation
  75   - 'sun.hotspot.tools.ctw.logfile' -- type:string, default:null,
  76 description: Path to logfile, if it's null, cout will be used.
  77 
  78 EXAMPLES
  79 
  80 compile classes from 'rt.jar':
  81   $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar ${JAVA_HOME}/jre/lib/rt.jar
  82 
  83 compile classes from all '.jar' in './testjars' directory:
  84   $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar ./testjars/*
  85 
  86 compile classes from './build/classes' directory:
  87   $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar ./build/classes
  88 
  89 compile only java.lang.String, java.lang.Object classes:
  90   $ echo java.lang.String > classes.lst
  91   $ echo java.lang.Object >> classes.lst
  92   $ java -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:wb.jar -jar ctw.jar classes.lst
  93