jdk/make/non-build-utils/src/build/tools/makeclasslist/makeClasslist.js
changeset 37879 58764aa6c155
parent 37878 19e3d89b31f4
child 37880 60ec48925dc6
equal deleted inserted replaced
37878:19e3d89b31f4 37879:58764aa6c155
     1 /*
       
     2  * Copyright (c) 2015, 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.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 /**
       
    27  * This tool is used to help create the class list for class data sharing.
       
    28  *
       
    29  * The classlist is produced internally by first running a select number of
       
    30  * startup benchmarks with the -XX:DumpLoadedClassList=<file> option, then
       
    31  * running this tool in the following fashion to produce a complete classlist:
       
    32  *
       
    33  * jjs -scripting makeClasslist.js -- list1 list2 list3 > classlist.platform
       
    34  *
       
    35  * The lists should be listed in roughly smallest to largest order based on
       
    36  * application size.
       
    37  *
       
    38  * After generating the classlist it's necessary to add a checksum (using
       
    39  * AddJsum.java) before checking it into the workspace as the corresponding
       
    40  * platform-specific classlist, such as make/data/classlist/classlist.linux 
       
    41  */
       
    42 "use strict";
       
    43 var classlist = [];
       
    44 var seenClasses = {};
       
    45 
       
    46 for (var a in $ARG) {
       
    47   var arg = $ARG[a];
       
    48 
       
    49   var classes = readFully(arg).replace(/[\r\n]+/g, "\n").split("\n");
       
    50 
       
    51   for (var c in classes) {
       
    52     var clazz = classes[c];
       
    53     if (clazz !== "" && seenClasses[clazz] === undefined) {
       
    54       seenClasses[clazz] = clazz;
       
    55       classlist.push(clazz);
       
    56     }
       
    57   }
       
    58 }
       
    59 
       
    60 for (c in classlist) {
       
    61   print(classlist[c]);
       
    62 }