# HG changeset patch # User Josef Eisl # Date 1394813992 -3600 # Node ID c4219e527b834fb58e7dd0fe800b1a151af1e4c8 # Parent 10dde0063f5a822a8653237094c821ef9bf87b06# Parent f659d019d3ab9153631e7c419a1392c4efbc36e5 Merge. diff -r 10dde0063f5a -r c4219e527b83 .hgtags --- a/.hgtags Thu Mar 13 18:45:17 2014 +0100 +++ b/.hgtags Fri Mar 14 17:19:52 2014 +0100 @@ -404,3 +404,7 @@ fca262db9c4309f99d2f5542ab0780e45c2f1578 jdk8-b120 41f4cad94c581034d4c427d2aaabcc20f26342d0 hs25-b63 b124e22eb772806c13d942cc110de38da0108147 graal-0.1 +ce2d7e46f3c7e41241f3b407705a4071323a11ab jdk9-b00 +050a626a88951140df874f7b163e304d07b6c296 jdk9-b01 +b188446de75bda5fc52d102cddf242c3ef5ecbdf jdk9-b02 +b2fee789d23f3cdabb3db4e51af43038e5692d3a jdk9-b03 diff -r 10dde0063f5a -r c4219e527b83 CHANGELOG.md --- a/CHANGELOG.md Thu Mar 13 18:45:17 2014 +0100 +++ b/CHANGELOG.md Fri Mar 14 17:19:52 2014 +0100 @@ -3,7 +3,8 @@ ## `tip` ### Graal * New methods for querying memory usage of individual objects and object graphs in Graal API (MetaAccessProvider#getMemorySize, MetaUtil#getMemorySizeRecursive). -* ... +* New (tested) invariant that equality comparisons for JavaType/JavaMethod/JavaField values use .equals() instead of '=='. +* Made graph caching compilation-local. ### Truffle * ... diff -r 10dde0063f5a -r c4219e527b83 THIRD_PARTY_README --- a/THIRD_PARTY_README Thu Mar 13 18:45:17 2014 +0100 +++ b/THIRD_PARTY_README Fri Mar 14 17:19:52 2014 +0100 @@ -2,11 +2,12 @@ ----------------------------- %% This notice is provided with respect to ASM Bytecode Manipulation -Framework v3.1, which is included with JRE 7, JDK 7, and OpenJDK 7. +Framework v5.0, which may be included with JRE 8, and JDK 8, and +OpenJDK 8. --- begin of LICENSE --- -Copyright (c) 2000-2005 INRIA, France Telecom +Copyright (c) 2000-2011 France Télécom All rights reserved. Redistribution and use in source and binary forms, with or without @@ -40,8 +41,41 @@ -------------------------------------------------------------------------------- -%% This notice is provided with respect to CodeViewer 1.0, which is included -with JDK 7. +%% This notice is provided with respect to BSDiff v4.3, which may be +included with JRE 8, JDK 8, and OpenJDK 8. + +--- begin of LICENSE --- + +Copyright 2003-2005 Colin Percival +All rights reserved + +Redistribution and use in source and binary forms, with or without +modification, are permitted providing that the following conditions +are met: +1. Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + +%% This notice is provided with respect to CodeViewer 1.0, which may be +included with JDK 8. --- begin of LICENSE --- @@ -81,8 +115,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to Cryptix AES 3.2.0, which is -included with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to Cryptix AES 3.2.0, which may be +included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -121,7 +155,7 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to CUP Parser Generator for -Java 0.10k, which is included with JRE 7, JDK 7, and OpenJDK 7. +Java 0.10k, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -148,7 +182,7 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to Document Object Model (DOM) Level 2 -& 3, which is included with JRE 7, JDK 7, and OpenJDK 7. +& 3, which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -212,19 +246,52 @@ ------------------------------------------------------------------------------- +%% This notice is provided with respect to Dynalink v0.5, which may be +included with JRE 8, JDK 8, and OpenJDK 8. + +--- begin of LICENSE --- + +Copyright (c) 2009-2013, Attila Szegedi + +All rights reserved.Redistribution and use in source and binary forms, with or +without modification, are permitted provided that the following conditions are +met:* Redistributions of source code must retain the above copyright notice, +this list of conditions and the following disclaimer. * Redistributions in +binary form must reproduce the above copyright notice, this list of +conditions and the following disclaimer in the documentation and/or other +materials provided with the distribution. * Neither the name of Attila +Szegedi nor the names of its contributors may be used to endorse or promote +products derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF SUCH DAMAGE. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + %% This notice is provided with respect to Elliptic Curve Cryptography, which -is included with JRE 7, JDK 7, and OpenJDK 7. +may be included with JRE 8, JDK 8, and OpenJDK 8. You are receiving a copy of the Elliptic Curve Cryptography library in source -form with the JDK 7 source distribution and object code in the JRE 7 & JDK 7 -runtime. - -The terms of the Oracle license do NOT apply to the Elliptic Curve -Cryptography library program; it is licensed under the following license, -separately from the Oracle programs you receive. If you do not wish to install -this program, you may delete the library named libsunec.so (on Solaris and -Linux systems) or sunec.dll (on Windows systems) from the JRE bin directory -reserved for native libraries. +form with the JDK 8 and OpenJDK 8 source distributions, and as object code in +the JRE 8 & JDK 8 runtimes. + +In the case of the JRE 8 & JDK 8 runtimes, the terms of the Oracle license do +NOT apply to the Elliptic Curve Cryptography library; it is licensed under the +following license, separately from Oracle's JDK & JRE. If you do not wish to +install the Elliptic Curve Cryptography library, you may delete the library +named libsunec.so (on Solaris and Linux systems) or sunec.dll (on Windows +systems) from the JRE bin directory reserved for native libraries. + --- begin of LICENSE --- @@ -735,13 +802,138 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to FontConfig 2.5, which is -included with JRE 7, JDK 7, and OpenJDK 7 source distributions on +%% This notice is provided with respect to ECMAScript Language +Specification ECMA-262 Edition 5.1 which may be included with +JRE 8, JDK 8, and OpenJDK 8. + +--- begin of LICENSE --- + +Copyright notice +Copyright © 2011 Ecma International +Ecma International +Rue du Rhone 114 +CH-1204 Geneva +Tel: +41 22 849 6000 +Fax: +41 22 849 6001 +Web: http://www.ecma-international.org + +This document and possible translations of it may be copied and furnished to +others, and derivative works that comment on or otherwise explain it or assist +in its implementation may be prepared, copied, published, and distributed, in +whole or in part, without restriction of any kind, provided that the above +copyright notice and this section are included on all such copies and derivative +works. However, this document itself may not be modified in any way, including +by removing the copyright notice or references to Ecma International, except as +needed for the purpose of developing any document or deliverable produced by +Ecma International (in which case the rules applied to copyrights must be +followed) or as required to translate it into languages other than English. The +limited permissions granted above are perpetual and will not be revoked by Ecma +International or its successors or assigns. This document and the information +contained herein is provided on an "AS IS" basis and ECMA INTERNATIONAL +DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY +WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY OWNERSHIP +RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR +PURPOSE." Software License + +All Software contained in this document ("Software)" is protected by copyright +and is being made available under the "BSD License", included below. This +Software may be subject to third party rights (rights from parties other than +Ecma International), including patent rights, and no licenses under such third +party rights are granted under this license even if the third party concerned is +a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS +AVAILABLE AT http://www.ecma-international.org/memento/codeofconduct.htm FOR +INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO +IMPLEMENT ECMA INTERNATIONAL STANDARDS*. Redistribution and use in source and +binary forms, with or without modification, are permitted provided that the +following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this +list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, +this list of conditions and the following disclaimer in the documentation and/or +other materials provided with the distribution. + +3. Neither the name of the authors nor Ecma International may be used to endorse +or promote products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT +SHALL ECMA INTERNATIONAL BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING +IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY +OF SUCH DAMAGE. +--- end of LICENSE --- + +%% This notice is provided with respect to Dynalink library which is included +with the Nashorn technology. + +--- begin of LICENSE --- +Copyright (c) 2009-2013, Attila Szegedi + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: +* Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +* Neither the name of the copyright holder nor the names of + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDER +BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR +BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +--- end of LICENSE --- + +%% This notice is provided with respect to Joni library which is included +with the Nashorn technology. + +--- begin of LICENSE --- +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies +of the Software, and to permit persons to whom the Software is furnished to do +so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + +%% This notice is provided with respect to FontConfig 2.5, which may be +included with JRE 8, JDK 8, and OpenJDK 8 source distributions on Linux and Solaris. --- begin of LICENSE --- -Copyright ¬© 2001,2003 Keith Packard +Copyright © 2001,2003 Keith Packard Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the @@ -765,7 +957,7 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to IAIK PKCS#11 Wrapper, -which is included with JRE 7, JDK 7, and OpenJDK 7. +which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -816,7 +1008,7 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to ICU4C 4.0.1 and ICU4J 4.4, which -is included with JRE 7, JDK 7, and OpenJDK 7. +may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -852,8 +1044,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to IJG JPEG 6b, which is -included with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to IJG JPEG 6b, which may be +included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -891,8 +1083,35 @@ -------------------------------------------------------------------------------- -%% This notice is provided with respect to JOpt-Simple v3.0, which is -included with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to Joni v1.1.9, which may be +included with JRE 8, JDK 8, and OpenJDK 8. + +--- begin of LICENSE --- + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + +%% This notice is provided with respect to JOpt-Simple v3.0, which may be +included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -921,8 +1140,39 @@ -------------------------------------------------------------------------------- +%% This notice is provided with respect to JSON, which may be included +with JRE 8 & JDK 8. + +--- begin of LICENSE --- + +Copyright (c) 2002 JSON.org + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +The Software shall be used for Good, not Evil. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + %% This notice is provided with respect to Kerberos functionality, which -which is included with JRE 7, JDK 7, and OpenJDK 7. +which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -934,7 +1184,7 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to Kerberos functionality from -FundsXpress, INC., which is included with JRE 7, JDK 7, and OpenJDK 7. +FundsXpress, INC., which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -967,8 +1217,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to Kronos OpenGL headers, which is -included with JDK 7 and OpenJDK 7 source distributions. +%% This notice is provided with respect to Kronos OpenGL headers, which may be +included with JDK 8 and OpenJDK 8 source distributions. --- begin of LICENSE --- @@ -1000,8 +1250,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to libpng 1.2.18, which is -included with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to libpng 1.5.4, which may be +included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -1014,8 +1264,10 @@ If you modify libpng you may insert additional notices immediately following this sentence. -libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are -Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are +This code is released under the libpng license. + +libpng versions 1.2.6, August 15, 2004, through 1.5.4, July 7, 2011, are +Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors @@ -1112,14 +1364,14 @@ Glenn Randers-Pehrson glennrp at users.sourceforge.net -May 15, 2007 +July 7, 2011 --- end of LICENSE --- ------------------------------------------------------------------------------- -%% This notice is provided with respect to libungif 4.1.3, which is -included with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to libungif 4.1.3, which may be +included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -1147,8 +1399,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to Little CMS 2.0, which is -included with OpenJDK 7. +%% This notice is provided with respect to Little CMS 2.4, which may be +included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -1183,7 +1435,7 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to Mesa 3D Graphics Library v4.1, -which is included with JRE 7, JDK 7, and OpenJDK 7 source distributions. +which may be included with JRE 8, JDK 8, and OpenJDK 8 source distributions. --- begin of LICENSE --- @@ -1213,8 +1465,402 @@ ------------------------------------------------------------------------------- +%% This notice is provided with respect to Mozilla Network Security +Services (NSS), which is supplied with the JDK test suite in the OpenJDK +source code repository. It is licensed under Mozilla Public License (MPL), +version 2.0. + +The NSS libraries are supplied in executable form, built from unmodified +NSS source code labeled with the "NSS_3.13.1_RTM" release tag. + +The NSS source code is available in the OpenJDK source code repository at: + jdk/test/sun/security/pkcs11/nss/src + +The NSS libraries are available in the OpenJDK source code repository at: + jdk/test/sun/security/pkcs11/nss/lib + +--- begin of LICENSE --- + +Mozilla Public License Version 2.0 +================================== + +1. Definitions +-------------- + +1.1. "Contributor" + means each individual or legal entity that creates, contributes to + the creation of, or owns Covered Software. + +1.2. "Contributor Version" + means the combination of the Contributions of others (if any) used + by a Contributor and that particular Contributor's Contribution. + +1.3. "Contribution" + means Covered Software of a particular Contributor. + +1.4. "Covered Software" + means Source Code Form to which the initial Contributor has attached + the notice in Exhibit A, the Executable Form of such Source Code + Form, and Modifications of such Source Code Form, in each case + including portions thereof. + +1.5. "Incompatible With Secondary Licenses" + means + + (a) that the initial Contributor has attached the notice described + in Exhibit B to the Covered Software; or + + (b) that the Covered Software was made available under the terms of + version 1.1 or earlier of the License, but not also under the + terms of a Secondary License. + +1.6. "Executable Form" + means any form of the work other than Source Code Form. + +1.7. "Larger Work" + means a work that combines Covered Software with other material, in + a separate file or files, that is not Covered Software. + +1.8. "License" + means this document. + +1.9. "Licensable" + means having the right to grant, to the maximum extent possible, + whether at the time of the initial grant or subsequently, any and + all of the rights conveyed by this License. + +1.10. "Modifications" + means any of the following: + + (a) any file in Source Code Form that results from an addition to, + deletion from, or modification of the contents of Covered + Software; or + + (b) any new file in Source Code Form that contains any Covered + Software. + +1.11. "Patent Claims" of a Contributor + means any patent claim(s), including without limitation, method, + process, and apparatus claims, in any patent Licensable by such + Contributor that would be infringed, but for the grant of the + License, by the making, using, selling, offering for sale, having + made, import, or transfer of either its Contributions or its + Contributor Version. + +1.12. "Secondary License" + means either the GNU General Public License, Version 2.0, the GNU + Lesser General Public License, Version 2.1, the GNU Affero General + Public License, Version 3.0, or any later versions of those + licenses. + +1.13. "Source Code Form" + means the form of the work preferred for making modifications. + +1.14. "You" (or "Your") + means an individual or a legal entity exercising rights under this + License. For legal entities, "You" includes any entity that + controls, is controlled by, or is under common control with You. For + purposes of this definition, "control" means (a) the power, direct + or indirect, to cause the direction or management of such entity, + whether by contract or otherwise, or (b) ownership of more than + fifty percent (50%) of the outstanding shares or beneficial + ownership of such entity. + +2. License Grants and Conditions +-------------------------------- + +2.1. Grants + +Each Contributor hereby grants You a world-wide, royalty-free, +non-exclusive license: + +(a) under intellectual property rights (other than patent or trademark) + Licensable by such Contributor to use, reproduce, make available, + modify, display, perform, distribute, and otherwise exploit its + Contributions, either on an unmodified basis, with Modifications, or + as part of a Larger Work; and + +(b) under Patent Claims of such Contributor to make, use, sell, offer + for sale, have made, import, and otherwise transfer either its + Contributions or its Contributor Version. + +2.2. Effective Date + +The licenses granted in Section 2.1 with respect to any Contribution +become effective for each Contribution on the date the Contributor first +distributes such Contribution. + +2.3. Limitations on Grant Scope + +The licenses granted in this Section 2 are the only rights granted under +this License. No additional rights or licenses will be implied from the +distribution or licensing of Covered Software under this License. +Notwithstanding Section 2.1(b) above, no patent license is granted by a +Contributor: + +(a) for any code that a Contributor has removed from Covered Software; + or + +(b) for infringements caused by: (i) Your and any other third party's + modifications of Covered Software, or (ii) the combination of its + Contributions with other software (except as part of its Contributor + Version); or + +(c) under Patent Claims infringed by Covered Software in the absence of + its Contributions. + +This License does not grant any rights in the trademarks, service marks, +or logos of any Contributor (except as may be necessary to comply with +the notice requirements in Section 3.4). + +2.4. Subsequent Licenses + +No Contributor makes additional grants as a result of Your choice to +distribute the Covered Software under a subsequent version of this +License (see Section 10.2) or under the terms of a Secondary License (if +permitted under the terms of Section 3.3). + +2.5. Representation + +Each Contributor represents that the Contributor believes its +Contributions are its original creation(s) or it has sufficient rights +to grant the rights to its Contributions conveyed by this License. + +2.6. Fair Use + +This License is not intended to limit any rights You have under +applicable copyright doctrines of fair use, fair dealing, or other +equivalents. + +2.7. Conditions + +Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted +in Section 2.1. + +3. Responsibilities +------------------- + +3.1. Distribution of Source Form + +All distribution of Covered Software in Source Code Form, including any +Modifications that You create or to which You contribute, must be under +the terms of this License. You must inform recipients that the Source +Code Form of the Covered Software is governed by the terms of this +License, and how they can obtain a copy of this License. You may not +attempt to alter or restrict the recipients' rights in the Source Code +Form. + +3.2. Distribution of Executable Form + +If You distribute Covered Software in Executable Form then: + +(a) such Covered Software must also be made available in Source Code + Form, as described in Section 3.1, and You must inform recipients of + the Executable Form how they can obtain a copy of such Source Code + Form by reasonable means in a timely manner, at a charge no more + than the cost of distribution to the recipient; and + +(b) You may distribute such Executable Form under the terms of this + License, or sublicense it under different terms, provided that the + license for the Executable Form does not attempt to limit or alter + the recipients' rights in the Source Code Form under this License. + +3.3. Distribution of a Larger Work + +You may create and distribute a Larger Work under terms of Your choice, +provided that You also comply with the requirements of this License for +the Covered Software. If the Larger Work is a combination of Covered +Software with a work governed by one or more Secondary Licenses, and the +Covered Software is not Incompatible With Secondary Licenses, this +License permits You to additionally distribute such Covered Software +under the terms of such Secondary License(s), so that the recipient of +the Larger Work may, at their option, further distribute the Covered +Software under the terms of either this License or such Secondary +License(s). + +3.4. Notices + +You may not remove or alter the substance of any license notices +(including copyright notices, patent notices, disclaimers of warranty, +or limitations of liability) contained within the Source Code Form of +the Covered Software, except that You may alter any license notices to +the extent required to remedy known factual inaccuracies. + +3.5. Application of Additional Terms + +You may choose to offer, and to charge a fee for, warranty, support, +indemnity or liability obligations to one or more recipients of Covered +Software. However, You may do so only on Your own behalf, and not on +behalf of any Contributor. You must make it absolutely clear that any +such warranty, support, indemnity, or liability obligation is offered by +You alone, and You hereby agree to indemnify every Contributor for any +liability incurred by such Contributor as a result of warranty, support, +indemnity or liability terms You offer. You may include additional +disclaimers of warranty and limitations of liability specific to any +jurisdiction. + +4. Inability to Comply Due to Statute or Regulation +--------------------------------------------------- + +If it is impossible for You to comply with any of the terms of this +License with respect to some or all of the Covered Software due to +statute, judicial order, or regulation then You must: (a) comply with +the terms of this License to the maximum extent possible; and (b) +describe the limitations and the code they affect. Such description must +be placed in a text file included with all distributions of the Covered +Software under this License. Except to the extent prohibited by statute +or regulation, such description must be sufficiently detailed for a +recipient of ordinary skill to be able to understand it. + +5. Termination +-------------- + +5.1. The rights granted under this License will terminate automatically +if You fail to comply with any of its terms. However, if You become +compliant, then the rights granted under this License from a particular +Contributor are reinstated (a) provisionally, unless and until such +Contributor explicitly and finally terminates Your grants, and (b) on an +ongoing basis, if such Contributor fails to notify You of the +non-compliance by some reasonable means prior to 60 days after You have +come back into compliance. Moreover, Your grants from a particular +Contributor are reinstated on an ongoing basis if such Contributor +notifies You of the non-compliance by some reasonable means, this is the +first time You have received notice of non-compliance with this License +from such Contributor, and You become compliant prior to 30 days after +Your receipt of the notice. + +5.2. If You initiate litigation against any entity by asserting a patent +infringement claim (excluding declaratory judgment actions, +counter-claims, and cross-claims) alleging that a Contributor Version +directly or indirectly infringes any patent, then the rights granted to +You by any and all Contributors for the Covered Software under Section +2.1 of this License shall terminate. + +5.3. In the event of termination under Sections 5.1 or 5.2 above, all +end user license agreements (excluding distributors and resellers) which +have been validly granted by You or Your distributors under this License +prior to termination shall survive termination. + +************************************************************************ +* * +* 6. Disclaimer of Warranty * +* ------------------------- * +* * +* Covered Software is provided under this License on an "as is" * +* basis, without warranty of any kind, either expressed, implied, or * +* statutory, including, without limitation, warranties that the * +* Covered Software is free of defects, merchantable, fit for a * +* particular purpose or non-infringing. The entire risk as to the * +* quality and performance of the Covered Software is with You. * +* Should any Covered Software prove defective in any respect, You * +* (not any Contributor) assume the cost of any necessary servicing, * +* repair, or correction. This disclaimer of warranty constitutes an * +* essential part of this License. No use of any Covered Software is * +* authorized under this License except under this disclaimer. * +* * +************************************************************************ + +************************************************************************ +* * +* 7. Limitation of Liability * +* -------------------------- * +* * +* Under no circumstances and under no legal theory, whether tort * +* (including negligence), contract, or otherwise, shall any * +* Contributor, or anyone who distributes Covered Software as * +* permitted above, be liable to You for any direct, indirect, * +* special, incidental, or consequential damages of any character * +* including, without limitation, damages for lost profits, loss of * +* goodwill, work stoppage, computer failure or malfunction, or any * +* and all other commercial damages or losses, even if such party * +* shall have been informed of the possibility of such damages. This * +* limitation of liability shall not apply to liability for death or * +* personal injury resulting from such party's negligence to the * +* extent applicable law prohibits such limitation. Some * +* jurisdictions do not allow the exclusion or limitation of * +* incidental or consequential damages, so this exclusion and * +* limitation may not apply to You. * +* * +************************************************************************ + +8. Litigation +------------- + +Any litigation relating to this License may be brought only in the +courts of a jurisdiction where the defendant maintains its principal +place of business and such litigation shall be governed by laws of that +jurisdiction, without reference to its conflict-of-law provisions. +Nothing in this Section shall prevent a party's ability to bring +cross-claims or counter-claims. + +9. Miscellaneous +---------------- + +This License represents the complete agreement concerning the subject +matter hereof. If any provision of this License is held to be +unenforceable, such provision shall be reformed only to the extent +necessary to make it enforceable. Any law or regulation which provides +that the language of a contract shall be construed against the drafter +shall not be used to construe this License against a Contributor. + +10. Versions of the License +--------------------------- + +10.1. New Versions + +Mozilla Foundation is the license steward. Except as provided in Section +10.3, no one other than the license steward has the right to modify or +publish new versions of this License. Each version will be given a +distinguishing version number. + +10.2. Effect of New Versions + +You may distribute the Covered Software under the terms of the version +of the License under which You originally received the Covered Software, +or under the terms of any subsequent version published by the license +steward. + +10.3. Modified Versions + +If you create software not governed by this License, and you want to +create a new license for such software, you may create and use a +modified version of this License if you rename the license and remove +any references to the name of the license steward (except to note that +such modified license differs from this License). + +10.4. Distributing Source Code Form that is Incompatible With Secondary +Licenses + +If You choose to distribute Source Code Form that is Incompatible With +Secondary Licenses under the terms of this version of the License, the +notice described in Exhibit B of this License must be attached. + +Exhibit A - Source Code Form License Notice +------------------------------------------- + + This Source Code Form is subject to the terms of the Mozilla Public + License, v. 2.0. If a copy of the MPL was not distributed with this + file, You can obtain one at http://mozilla.org/MPL/2.0/. + +If it is not possible or desirable to put the notice in a particular +file, then You may include the notice in a location (such as a LICENSE +file in a relevant directory) where a recipient would be likely to look +for such a notice. + +You may add additional accurate notices of copyright ownership. + +Exhibit B - "Incompatible With Secondary Licenses" Notice +--------------------------------------------------------- + + This Source Code Form is "Incompatible With Secondary Licenses", as + defined by the Mozilla Public License, v. 2.0. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + %% This notice is provided with respect to PC/SC Lite for Suse Linux v.1.1.1, -which is included with JRE 7, JDK 7, and OpenJDK 7 on Linux and Solaris. +which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris. --- begin of LICENSE --- @@ -1257,8 +1903,30 @@ ------------------------------------------------------------------------------- +%% This notice is provided with respect to PorterStemmer v4, which may be +included with JRE 8, JDK 8, and OpenJDK 8. + +--- begin of LICENSE --- + +See: http://tartarus.org/~martin/PorterStemmer + +The software is completely free for any purpose, unless notes at the head of +the program text indicates otherwise (which is rare). In any case, the notes +about licensing are never more restrictive than the BSD License. + +In every case where the software is not written by me (Martin Porter), this +licensing arrangement has been endorsed by the contributor, and it is +therefore unnecessary to ask the contributor again to confirm it. + +I have not asked any contributors (or their employers, if they have them) for +proofs that they have the right to distribute their software in this way. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + %% This notice is provided with respect to Relax NG Object/Parser v.20050510, -which is included with JRE 7, JDK 7, and OpenJDK 7. +which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -1285,8 +1953,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to RelaxNGCC v1.12, which is -included with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to RelaxNGCC v1.12, which may be +included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -1335,487 +2003,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to Mozilla Rhino v1.7R3, which -is included with JRE 7, JDK 7, and OpenJDK 7 - ---- begin of LICENSE --- - - MOZILLA PUBLIC LICENSE - Version 1.1 - - --------------- - -1. Definitions. - - 1.0.1. "Commercial Use" means distribution or otherwise making the - Covered Code available to a third party. - - 1.1. "Contributor" means each entity that creates or contributes to - the creation of Modifications. - - 1.2. "Contributor Version" means the combination of the Original - Code, prior Modifications used by a Contributor, and the Modifications - made by that particular Contributor. - - 1.3. "Covered Code" means the Original Code or Modifications or the - combination of the Original Code and Modifications, in each case - including portions thereof. - - 1.4. "Electronic Distribution Mechanism" means a mechanism generally - accepted in the software development community for the electronic - transfer of data. - - 1.5. "Executable" means Covered Code in any form other than Source - Code. - - 1.6. "Initial Developer" means the individual or entity identified - as the Initial Developer in the Source Code notice required by Exhibit - A. - - 1.7. "Larger Work" means a work which combines Covered Code or - portions thereof with code not governed by the terms of this License. - - 1.8. "License" means this document. - - 1.8.1. "Licensable" means having the right to grant, to the maximum - extent possible, whether at the time of the initial grant or - subsequently acquired, any and all of the rights conveyed herein. - - 1.9. "Modifications" means any addition to or deletion from the - substance or structure of either the Original Code or any previous - Modifications. When Covered Code is released as a series of files, a - Modification is: - A. Any addition to or deletion from the contents of a file - containing Original Code or previous Modifications. - - B. Any new file that contains any part of the Original Code or - previous Modifications. - - 1.10. "Original Code" means Source Code of computer software code - which is described in the Source Code notice required by Exhibit A as - Original Code, and which, at the time of its release under this - License is not already Covered Code governed by this License. - - 1.10.1. "Patent Claims" means any patent claim(s), now owned or - hereafter acquired, including without limitation, method, process, - and apparatus claims, in any patent Licensable by grantor. - - 1.11. "Source Code" means the preferred form of the Covered Code for - making modifications to it, including all modules it contains, plus - any associated interface definition files, scripts used to control - compilation and installation of an Executable, or source code - differential comparisons against either the Original Code or another - well known, available Covered Code of the Contributor's choice. The - Source Code can be in a compressed or archival form, provided the - appropriate decompression or de-archiving software is widely available - for no charge. - - 1.12. "You" (or "Your") means an individual or a legal entity - exercising rights under, and complying with all of the terms of, this - License or a future version of this License issued under Section 6.1. - For legal entities, "You" includes any entity which controls, is - controlled by, or is under common control with You. For purposes of - this definition, "control" means (a) the power, direct or indirect, - to cause the direction or management of such entity, whether by - contract or otherwise, or (b) ownership of more than fifty percent - (50%) of the outstanding shares or beneficial ownership of such - entity. - -2. Source Code License. - - 2.1. The Initial Developer Grant. - The Initial Developer hereby grants You a world-wide, royalty-free, - non-exclusive license, subject to third party intellectual property - claims: - (a) under intellectual property rights (other than patent or - trademark) Licensable by Initial Developer to use, reproduce, - modify, display, perform, sublicense and distribute the Original - Code (or portions thereof) with or without Modifications, and/or - as part of a Larger Work; and - - (b) under Patents Claims infringed by the making, using or - selling of Original Code, to make, have made, use, practice, - sell, and offer for sale, and/or otherwise dispose of the - Original Code (or portions thereof). - - (c) the licenses granted in this Section 2.1(a) and (b) are - effective on the date Initial Developer first distributes - Original Code under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is - granted: 1) for code that You delete from the Original Code; 2) - separate from the Original Code; or 3) for infringements caused - by: i) the modification of the Original Code or ii) the - combination of the Original Code with other software or devices. - - 2.2. Contributor Grant. - Subject to third party intellectual property claims, each Contributor - hereby grants You a world-wide, royalty-free, non-exclusive license - - (a) under intellectual property rights (other than patent or - trademark) Licensable by Contributor, to use, reproduce, modify, - display, perform, sublicense and distribute the Modifications - created by such Contributor (or portions thereof) either on an - unmodified basis, with other Modifications, as Covered Code - and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or - selling of Modifications made by that Contributor either alone - and/or in combination with its Contributor Version (or portions - of such combination), to make, use, sell, offer for sale, have - made, and/or otherwise dispose of: 1) Modifications made by that - Contributor (or portions thereof); and 2) the combination of - Modifications made by that Contributor with its Contributor - Version (or portions of such combination). - - (c) the licenses granted in Sections 2.2(a) and 2.2(b) are - effective on the date Contributor first makes Commercial Use of - the Covered Code. - - (d) Notwithstanding Section 2.2(b) above, no patent license is - granted: 1) for any code that Contributor has deleted from the - Contributor Version; 2) separate from the Contributor Version; - 3) for infringements caused by: i) third party modifications of - Contributor Version or ii) the combination of Modifications made - by that Contributor with other software (except as part of the - Contributor Version) or other devices; or 4) under Patent Claims - infringed by Covered Code in the absence of Modifications made by - that Contributor. - -3. Distribution Obligations. - - 3.1. Application of License. - The Modifications which You create or to which You contribute are - governed by the terms of this License, including without limitation - Section 2.2. The Source Code version of Covered Code may be - distributed only under the terms of this License or a future version - of this License released under Section 6.1, and You must include a - copy of this License with every copy of the Source Code You - distribute. You may not offer or impose any terms on any Source Code - version that alters or restricts the applicable version of this - License or the recipients' rights hereunder. However, You may include - an additional document offering the additional rights described in - Section 3.5. - - 3.2. Availability of Source Code. - Any Modification which You create or to which You contribute must be - made available in Source Code form under the terms of this License - either on the same media as an Executable version or via an accepted - Electronic Distribution Mechanism to anyone to whom you made an - Executable version available; and if made available via Electronic - Distribution Mechanism, must remain available for at least twelve (12) - months after the date it initially became available, or at least six - (6) months after a subsequent version of that particular Modification - has been made available to such recipients. You are responsible for - ensuring that the Source Code version remains available even if the - Electronic Distribution Mechanism is maintained by a third party. - - 3.3. Description of Modifications. - You must cause all Covered Code to which You contribute to contain a - file documenting the changes You made to create that Covered Code and - the date of any change. You must include a prominent statement that - the Modification is derived, directly or indirectly, from Original - Code provided by the Initial Developer and including the name of the - Initial Developer in (a) the Source Code, and (b) in any notice in an - Executable version or related documentation in which You describe the - origin or ownership of the Covered Code. - - 3.4. Intellectual Property Matters - (a) Third Party Claims. - If Contributor has knowledge that a license under a third party's - intellectual property rights is required to exercise the rights - granted by such Contributor under Sections 2.1 or 2.2, - Contributor must include a text file with the Source Code - distribution titled "LEGAL" which describes the claim and the - party making the claim in sufficient detail that a recipient will - know whom to contact. If Contributor obtains such knowledge after - the Modification is made available as described in Section 3.2, - Contributor shall promptly modify the LEGAL file in all copies - Contributor makes available thereafter and shall take other steps - (such as notifying appropriate mailing lists or newsgroups) - reasonably calculated to inform those who received the Covered - Code that new knowledge has been obtained. - - (b) Contributor APIs. - If Contributor's Modifications include an application programming - interface and Contributor has knowledge of patent licenses which - are reasonably necessary to implement that API, Contributor must - also include this information in the LEGAL file. - - (c) Representations. - Contributor represents that, except as disclosed pursuant to - Section 3.4(a) above, Contributor believes that Contributor's - Modifications are Contributor's original creation(s) and/or - Contributor has sufficient rights to grant the rights conveyed by - this License. - - 3.5. Required Notices. - You must duplicate the notice in Exhibit A in each file of the Source - Code. If it is not possible to put such notice in a particular Source - Code file due to its structure, then You must include such notice in a - location (such as a relevant directory) where a user would be likely - to look for such a notice. If You created one or more Modification(s) - You may add your name as a Contributor to the notice described in - Exhibit A. You must also duplicate this License in any documentation - for the Source Code where You describe recipients' rights or ownership - rights relating to Covered Code. You may choose to offer, and to - charge a fee for, warranty, support, indemnity or liability - obligations to one or more recipients of Covered Code. However, You - may do so only on Your own behalf, and not on behalf of the Initial - Developer or any Contributor. You must make it absolutely clear than - any such warranty, support, indemnity or liability obligation is - offered by You alone, and You hereby agree to indemnify the Initial - Developer and every Contributor for any liability incurred by the - Initial Developer or such Contributor as a result of warranty, - support, indemnity or liability terms You offer. - - 3.6. Distribution of Executable Versions. - You may distribute Covered Code in Executable form only if the - requirements of Section 3.1-3.5 have been met for that Covered Code, - and if You include a notice stating that the Source Code version of - the Covered Code is available under the terms of this License, - including a description of how and where You have fulfilled the - obligations of Section 3.2. The notice must be conspicuously included - in any notice in an Executable version, related documentation or - collateral in which You describe recipients' rights relating to the - Covered Code. You may distribute the Executable version of Covered - Code or ownership rights under a license of Your choice, which may - contain terms different from this License, provided that You are in - compliance with the terms of this License and that the license for the - Executable version does not attempt to limit or alter the recipient's - rights in the Source Code version from the rights set forth in this - License. If You distribute the Executable version under a different - license You must make it absolutely clear that any terms which differ - from this License are offered by You alone, not by the Initial - Developer or any Contributor. You hereby agree to indemnify the - Initial Developer and every Contributor for any liability incurred by - the Initial Developer or such Contributor as a result of any such - terms You offer. - - 3.7. Larger Works. - You may create a Larger Work by combining Covered Code with other code - not governed by the terms of this License and distribute the Larger - Work as a single product. In such a case, You must make sure the - requirements of this License are fulfilled for the Covered Code. - -4. Inability to Comply Due to Statute or Regulation. - - If it is impossible for You to comply with any of the terms of this - License with respect to some or all of the Covered Code due to - statute, judicial order, or regulation then You must: (a) comply with - the terms of this License to the maximum extent possible; and (b) - describe the limitations and the code they affect. Such description - must be included in the LEGAL file described in Section 3.4 and must - be included with all distributions of the Source Code. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Application of this License. - - This License applies to code to which the Initial Developer has - attached the notice in Exhibit A and to related Covered Code. - -6. Versions of the License. - - 6.1. New Versions. - Netscape Communications Corporation ("Netscape") may publish revised - and/or new versions of the License from time to time. Each version - will be given a distinguishing version number. - - 6.2. Effect of New Versions. - Once Covered Code has been published under a particular version of the - License, You may always continue to use it under the terms of that - version. You may also choose to use such Covered Code under the terms - of any subsequent version of the License published by Netscape. No one - other than Netscape has the right to modify the terms applicable to - Covered Code created under this License. - - 6.3. Derivative Works. - If You create or use a modified version of this License (which you may - only do in order to apply it to code which is not already Covered Code - governed by this License), You must (a) rename Your license so that - the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape", - "MPL", "NPL" or any confusingly similar phrase do not appear in your - license (except to note that your license differs from this License) - and (b) otherwise make it clear that Your version of the license - contains terms which differ from the Mozilla Public License and - Netscape Public License. (Filling in the name of the Initial - Developer, Original Code or Contributor in the notice described in - Exhibit A shall not of themselves be deemed to be modifications of - this License.) - -7. DISCLAIMER OF WARRANTY. - - COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS, - WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, - WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF - DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. - THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE - IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, - YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE - COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER - OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF - ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. - -8. TERMINATION. - - 8.1. This License and the rights granted hereunder will terminate - automatically if You fail to comply with terms herein and fail to cure - such breach within 30 days of becoming aware of the breach. All - sublicenses to the Covered Code which are properly granted shall - survive any termination of this License. Provisions which, by their - nature, must remain in effect beyond the termination of this License - shall survive. - - 8.2. If You initiate litigation by asserting a patent infringement - claim (excluding declatory judgment actions) against Initial Developer - or a Contributor (the Initial Developer or Contributor against whom - You file such action is referred to as "Participant") alleging that: - - (a) such Participant's Contributor Version directly or indirectly - infringes any patent, then any and all rights granted by such - Participant to You under Sections 2.1 and/or 2.2 of this License - shall, upon 60 days notice from Participant terminate prospectively, - unless if within 60 days after receipt of notice You either: (i) - agree in writing to pay Participant a mutually agreeable reasonable - royalty for Your past and future use of Modifications made by such - Participant, or (ii) withdraw Your litigation claim with respect to - the Contributor Version against such Participant. If within 60 days - of notice, a reasonable royalty and payment arrangement are not - mutually agreed upon in writing by the parties or the litigation claim - is not withdrawn, the rights granted by Participant to You under - Sections 2.1 and/or 2.2 automatically terminate at the expiration of - the 60 day notice period specified above. - - (b) any software, hardware, or device, other than such Participant's - Contributor Version, directly or indirectly infringes any patent, then - any rights granted to You by such Participant under Sections 2.1(b) - and 2.2(b) are revoked effective as of the date You first made, used, - sold, distributed, or had made, Modifications made by that - Participant. - - 8.3. If You assert a patent infringement claim against Participant - alleging that such Participant's Contributor Version directly or - indirectly infringes any patent where such claim is resolved (such as - by license or settlement) prior to the initiation of patent - infringement litigation, then the reasonable value of the licenses - granted by such Participant under Sections 2.1 or 2.2 shall be taken - into account in determining the amount or value of any payment or - license. - - 8.4. In the event of termination under Sections 8.1 or 8.2 above, - all end user license agreements (excluding distributors and resellers) - which have been validly granted by You or any distributor hereunder - prior to termination shall survive termination. - -9. LIMITATION OF LIABILITY. - - UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT - (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL - DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, - OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR - ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY - CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, - WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER - COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN - INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF - LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY - RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW - PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE - EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO - THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. - -10. U.S. GOVERNMENT END USERS. - - The Covered Code is a "commercial item," as that term is defined in - 48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer - software" and "commercial computer software documentation," as such - terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 - C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), - all U.S. Government End Users acquire Covered Code with only those - rights set forth herein. - -11. MISCELLANEOUS. - - This License represents the complete agreement concerning subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. This License shall be governed by - California law provisions (except to the extent applicable law, if - any, provides otherwise), excluding its conflict-of-law provisions. - With respect to disputes in which at least one party is a citizen of, - or an entity chartered or registered to do business in the United - States of America, any litigation relating to this License shall be - subject to the jurisdiction of the Federal Courts of the Northern - District of California, with venue lying in Santa Clara County, - California, with the losing party responsible for costs, including - without limitation, court costs and reasonable attorneys' fees and - expenses. The application of the United Nations Convention on - Contracts for the International Sale of Goods is expressly excluded. - Any law or regulation which provides that the language of a contract - shall be construed against the drafter shall not apply to this - License. - -12. RESPONSIBILITY FOR CLAIMS. - - As between Initial Developer and the Contributors, each party is - responsible for claims and damages arising, directly or indirectly, - out of its utilization of rights under this License and You agree to - work with Initial Developer and Contributors to distribute such - responsibility on an equitable basis. Nothing herein is intended or - shall be deemed to constitute any admission of liability. - -13. MULTIPLE-LICENSED CODE. - - Initial Developer may designate portions of the Covered Code as - "Multiple-Licensed". "Multiple-Licensed" means that the Initial - Developer permits you to utilize portions of the Covered Code under - Your choice of the NPL or the alternative licenses, if any, specified - by the Initial Developer in the file described in Exhibit A. - -EXHIBIT A - Mozilla Public License. - - ``The contents of this file are subject to the Mozilla Public License - Version 1.1 (the "License"); you may not use this file except in - compliance with the License. You may obtain a copy of the License at - http://www.mozilla.org/MPL/ - - Software distributed under the License is distributed on an "AS IS" - basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - License for the specific language governing rights and limitations - under the License. - - The Original Code is ______________________________________. - - The Initial Developer of the Original Code is ________________________. - Portions created by ______________________ are Copyright (C) ______ - _______________________. All Rights Reserved. - - Contributor(s): ______________________________________. - - Alternatively, the contents of this file may be used under the terms - of the _____ license (the "[___] License"), in which case the - provisions of [______] License are applicable instead of those - above. If you wish to allow use of your version of this file only - under the terms of the [____] License and not to allow others to use - your version of this file under the MPL, indicate your decision by - deleting the provisions above and replace them with the notice and - other provisions required by the [___] License. If you do not delete - the provisions above, a recipient may use your version of this file - under either the MPL or the [___] License." - - [NOTE: The text of this Exhibit A may differ slightly from the text of - the notices in the Source Code files of the Original Code. You should - use the text of this Exhibit A rather than the text found in the - Original Code Source Code for Your Modifications.] - ---- end of LICENSE --- - -------------------------------------------------------------------------------- - -%% This notice is provided with respect to SAX 2.0.1, which is included -with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to SAX 2.0.1, which may be included +with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -1876,8 +2065,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to SoftFloat version 2b, which is -included with JRE 7, JDK 7, and OpenJDK 7 on Linux/ARM. +%% This notice is provided with respect to SoftFloat version 2b, which may be +included with JRE 8, JDK 8, and OpenJDK 8 on Linux/ARM. --- begin of LICENSE --- @@ -1909,12 +2098,41 @@ ------------------------------------------------------------------------------- +%% This notice is provided with respect to Sparkle 1.5, +which may be included with JRE 8 on Mac OS X. + +--- begin of LICENSE --- + +Copyright (c) 2012 Sparkle.org and Andy Matuschak + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +--- end of LICENSE --- + +------------------------------------------------------------------------------- + %% Portions licensed from Taligent, Inc. ------------------------------------------------------------------------------- -%% This notice is provided with respect to Thai Dictionary, which is -included with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to Thai Dictionary, which may be +included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -1947,8 +2165,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to Unicode 6.0.0, CLDR v1.4.1, & CLDR -v1.9, which is included with JRE 7, JDK 7, and OpenJDK 7. +%% This notice is provided with respect to Unicode 6.2.0 & CLDR 21.0.1 +which may be included with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- @@ -1959,7 +2177,7 @@ Trademark Usage Policy. A. Unicode Copyright. - 1. Copyright © 1991-2011 Unicode, Inc. All rights reserved. + 1. Copyright © 1991-2013 Unicode, Inc. All rights reserved. 2. Certain documents and files on this website contain a legend indicating that "Modification is permitted." Any person is hereby authorized, @@ -2094,7 +2312,7 @@ COPYRIGHT AND PERMISSION NOTICE -Copyright © 1991-2011 Unicode, Inc. All rights reserved. Distributed under the +Copyright © 1991-2012 Unicode, Inc. All rights reserved. Distributed under the Terms of Use in http://www.unicode.org/copyright.html. Permission is hereby granted, free of charge, to any person obtaining a copy @@ -2134,8 +2352,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to UPX v3.01, which is included -with JRE 7 on Windows. +%% This notice is provided with respect to UPX v3.01, which may be included +with JRE 8 on Windows. --- begin of LICENSE --- @@ -2274,7 +2492,7 @@ ------------------------------------------------------------------------------- %% This notice is provided with respect to Xfree86-VidMode Extension 1.0, -which is included with JRE 7, JDK 7, and OpenJDK 7 on Linux and Solaris. +which may be included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris. --- begin of LICENSE --- @@ -2326,8 +2544,8 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to X Window System 6.8.2, which is -included with JRE 7, JDK 7, and OpenJDK 7 on Linux and Solaris. +%% This notice is provided with respect to X Window System 6.8.2, which may be +included with JRE 8, JDK 8, and OpenJDK 8 on Linux and Solaris. --- begin of LICENSE --- @@ -3131,12 +3349,12 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to zlib v1.2.3, which is included -with JRE 7, JDK 7, and OpenJDK 7 +%% This notice is provided with respect to zlib v1.2.5, which may be included +with JRE 8, JDK 8, and OpenJDK 8. --- begin of LICENSE --- - version 1.2.3, July 18th, 2005 + version 1.2.5, July 18th, 2005 Copyright (C) 1995-2005 Jean-loup Gailly and Mark Adler @@ -3163,16 +3381,18 @@ ------------------------------------------------------------------------------- -%% This notice is provided with respect to the following which is -included with JRE 7, JDK 7, and OpenJDK 7, except where noted: - - Apache Derby 10.8.1.2 [included with JDK 7 only] +%% This notice is provided with respect to the following which may be +included with JRE 8, JDK 8, and OpenJDK 8, except where noted: + + Apache Commons Math 2.2 + Apache Derby 10.10.1.2 [included with JDK 8] Apache Jakarta BCEL 5.2 Apache Jakarta Regexp 1.4 - Apache Santuario XMLSec-Java 1.4.2 + Apache Santuario XML Security for Java 1.5.4 Apache Xalan-Java 2.7.1 - Apache Xerces2 Java 2.10.0 + Apache Xerces Java 2.10.0 Apache XML Resolver 1.1 + Dynalink 0.5 --- begin of LICENSE --- diff -r 10dde0063f5a -r c4219e527b83 agent/make/Makefile --- a/agent/make/Makefile Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/make/Makefile Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/make/mkinstall --- a/agent/make/mkinstall Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/make/mkinstall Fri Mar 14 17:19:52 2014 +0100 @@ -27,7 +27,9 @@ cp ../src/os/solaris/proc/amd64/libsaproc.so $SA_NAME/solaris/amd64 cp ../src/os/solaris/proc/sparc/libsaproc.so $SA_NAME/solaris/sparc +cp ../src/os/solaris/proc/sparc/libsaproc_audit.so $SA_NAME/solaris/sparc cp ../src/os/solaris/proc/sparcv9/libsaproc.so $SA_NAME/solaris/sparcv9 +cp ../src/os/solaris/proc/sparcv9/libsaproc_audit.so $SA_NAME/solaris/sparcv9 cp ../src/os/solaris/proc/i386/libsaproc.so $SA_NAME/solaris/i386 cp ../src/os/linux/i386/libsaproc.so $SA_NAME/linux/i386 cp ../src/os/linux/ia64/libsaproc.so $SA_NAME/linux/ia64 diff -r 10dde0063f5a -r c4219e527b83 agent/make/saenv.sh --- a/agent/make/saenv.sh Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/make/saenv.sh Fri Mar 14 17:19:52 2014 +0100 @@ -48,16 +48,17 @@ CPU=i386 fi else - # configure audit helper library if SA_ALTROOT is set - if [ -n "$SA_ALTROOT" ]; then - LD_AUDIT_32=$STARTDIR/../src/os/solaris/proc/`uname -p`/libsaproc_audit.so - export LD_AUDIT_32 - if [ ! -f $LD_AUDIT_32 ]; then - echo "SA_ALTROOT is set and can't find libsaproc_audit.so." - echo "Make sure to build it with 'make natives'." - exit 1 - fi + # configure audit helper library for solaris + LD_AUDIT_32=$STARTDIR/../src/os/solaris/proc/`uname -p`/libsaproc_audit.so + if [ ! -f $LD_AUDIT_32 ]; then + LD_AUDIT_32=$STARTDIR/solaris/`uname -p`/libsaproc_audit.so + fi + if [ ! -f $LD_AUDIT_32 ]; then + echo "Can't find libsaproc_audit.so." + echo "Make sure to build it with 'make natives'." + exit 1 fi + export LD_AUDIT_32 SA_LIBPATH=$STARTDIR/../src/os/solaris/proc/`uname -p`:$STARTDIR/solaris/`uname -p` OPTIONS="-Dsa.library.path=$SA_LIBPATH -Dsun.jvm.hotspot.debugger.useProcDebugger" CPU=sparc diff -r 10dde0063f5a -r c4219e527b83 agent/make/saenv64.sh --- a/agent/make/saenv64.sh Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/make/saenv64.sh Fri Mar 14 17:19:52 2014 +0100 @@ -43,16 +43,19 @@ fi fi -# configure audit helper library if SA_ALTROOT is set -if [ -n "$SA_ALTROOT" ]; then - LD_AUDIT_64=$STARTDIR/../src/os/solaris/proc/$CPU/libsaproc_audit.so - export LD_AUDIT_64 - if [ ! -f $LD_AUDIT_64 ]; then - echo "SA_ALTROOT is set and can't find libsaproc_audit.so." - echo "Make sure to build it with 'make natives'." - exit 1 - fi +# configure audit helper library +LD_AUDIT_64=$STARTDIR/../src/os/solaris/proc/$CPU/libsaproc_audit.so +if [ ! -f $LD_AUDIT_64 ]; then + LD_AUDIT_64=$STARTDIR/solaris/$CPU/libsaproc_audit.so fi + +if [ ! -f $LD_AUDIT_64 ]; then + echo "Can't find libsaproc_audit.so." + echo "Make sure to build it with 'make natives'." + exit 1 +fi + +export LD_AUDIT_64 SA_LIBPATH=$STARTDIR/../src/os/solaris/proc/$CPU:$STARTDIR/solaris/$CPU OPTIONS="-Dsa.library.path=$SA_LIBPATH -Dsun.jvm.hotspot.debugger.useProcDebugger" diff -r 10dde0063f5a -r c4219e527b83 agent/src/os/linux/libproc.h --- a/agent/src/os/linux/libproc.h Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/os/linux/libproc.h Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -80,7 +80,7 @@ *************************************************************************************/ -#if defined(sparc) || defined(sparcv9) +#if defined(sparc) || defined(sparcv9) || defined(ppc64) #define user_regs_struct pt_regs #endif diff -r 10dde0063f5a -r c4219e527b83 agent/src/os/linux/libproc_impl.c --- a/agent/src/os/linux/libproc_impl.c Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/os/linux/libproc_impl.c Fri Mar 14 17:19:52 2014 +0100 @@ -29,54 +29,51 @@ #include #include "libproc_impl.h" -static const char* alt_root = NULL; -static int alt_root_len = -1; - #define SA_ALTROOT "SA_ALTROOT" -static void init_alt_root() { - if (alt_root_len == -1) { - alt_root = getenv(SA_ALTROOT); - if (alt_root) { - alt_root_len = strlen(alt_root); - } else { - alt_root_len = 0; - } - } -} - int pathmap_open(const char* name) { - int fd; - char alt_path[PATH_MAX + 1]; + static const char *alt_root = NULL; + static int alt_root_initialized = 0; - init_alt_root(); + int fd; + char alt_path[PATH_MAX + 1], *alt_path_end; + const char *s; - if (alt_root_len > 0) { - strcpy(alt_path, alt_root); - strcat(alt_path, name); - fd = open(alt_path, O_RDONLY); - if (fd >= 0) { - print_debug("path %s substituted for %s\n", alt_path, name); - return fd; - } + if (!alt_root_initialized) { + alt_root_initialized = -1; + alt_root = getenv(SA_ALTROOT); + } + + if (alt_root == NULL) { + return open(name, O_RDONLY); + } + + strcpy(alt_path, alt_root); + alt_path_end = alt_path + strlen(alt_path); - if (strrchr(name, '/')) { - strcpy(alt_path, alt_root); - strcat(alt_path, strrchr(name, '/')); - fd = open(alt_path, O_RDONLY); - if (fd >= 0) { - print_debug("path %s substituted for %s\n", alt_path, name); - return fd; - } - } - } else { - fd = open(name, O_RDONLY); - if (fd >= 0) { - return fd; - } - } + // Strip path items one by one and try to open file with alt_root prepended + s = name; + while (1) { + strcat(alt_path, s); + s += 1; + + fd = open(alt_path, O_RDONLY); + if (fd >= 0) { + print_debug("path %s substituted for %s\n", alt_path, name); + return fd; + } - return -1; + // Linker always put full path to solib to process, so we can rely + // on presence of /. If slash is not present, it means, that SOlib doesn't + // physically exist (e.g. linux-gate.so) and we fail opening it anyway + if ((s = strchr(s, '/')) == NULL) { + break; + } + + *alt_path_end = 0; + } + + return -1; } static bool _libsaproc_debug; diff -r 10dde0063f5a -r c4219e527b83 agent/src/os/linux/salibelf.c --- a/agent/src/os/linux/salibelf.c Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/os/linux/salibelf.c Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/os/linux/symtab.c --- a/agent/src/os/linux/symtab.c Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/os/linux/symtab.c Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -214,8 +214,10 @@ + 2); strcpy(debug_pathname, name); char *last_slash = strrchr(debug_pathname, '/'); - if (last_slash == NULL) + if (last_slash == NULL) { + free(debug_pathname); return -1; + } /* Look in the same directory as the object. */ strcpy(last_slash+1, debug_filename); diff -r 10dde0063f5a -r c4219e527b83 agent/src/os/solaris/proc/saproc.cpp --- a/agent/src/os/solaris/proc/saproc.cpp Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/os/solaris/proc/saproc.cpp Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/os/win32/windbg/sawindbg.cpp --- a/agent/src/os/win32/windbg/sawindbg.cpp Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/os/win32/windbg/sawindbg.cpp Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java --- a/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java --- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/HSDB.java --- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java --- a/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java --- a/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java --- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,9 +95,15 @@ int entryBci = task.osrBci(); int compLevel = task.compLevel(); Klass holder = method.getMethodHolder(); - out.println("compile " + holder.getName().asString() + " " + - OopUtilities.escapeString(method.getName().asString()) + " " + - method.getSignature().asString() + " " + - entryBci + " " + compLevel); + out.print("compile " + holder.getName().asString() + " " + + OopUtilities.escapeString(method.getName().asString()) + " " + + method.getSignature().asString() + " " + + entryBci + " " + compLevel); + Compile compiler = compilerData(); + if (compiler != null) { + // Dump inlining data. + compiler.dumpInlineData(out); + } + out.println(); } } diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java --- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java --- a/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java --- a/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java Fri Mar 14 17:19:52 2014 +0100 @@ -55,31 +55,21 @@ if (pc == null) { return null; } + + /* Typically we have about ten loaded objects here. So no reason to do + sort/binary search here. Linear search gives us acceptable performance.*/ + List objs = getLoadObjectList(); - Object[] arr = objs.toArray(); - // load objects are sorted by base address, do binary search - int mid = -1; - int low = 0; - int high = arr.length - 1; - while (low <= high) { - mid = (low + high) >> 1; - LoadObject midVal = (LoadObject) arr[mid]; - long cmp = pc.minus(midVal.getBase()); - if (cmp < 0) { - high = mid - 1; - } else if (cmp > 0) { - long size = midVal.getSize(); - if (cmp >= size) { - low = mid + 1; - } else { - return (LoadObject) arr[mid]; - } - } else { // match found - return (LoadObject) arr[mid]; - } + for (int i = 0; i < objs.size(); i++) { + LoadObject ob = (LoadObject) objs.get(i); + Address base = ob.getBase(); + long size = ob.getSize(); + if ( pc.greaterThanOrEqual(base) && pc.lessThan(base.addOffsetTo(size))) { + return ob; + } } - // no match found. + return null; } diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -24,19 +24,29 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.Set; import sun.jvm.hotspot.oops.ArrayKlass; +import sun.jvm.hotspot.oops.Instance; import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.ObjArrayKlass; -import sun.jvm.hotspot.oops.TypeArrayKlass; import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.Instance; +import sun.jvm.hotspot.oops.ObjArrayKlass; import sun.jvm.hotspot.oops.Symbol; -import java.util.List; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.Map; +import sun.jvm.hotspot.oops.TypeArrayKlass; + +import com.sun.jdi.ArrayReference; +import com.sun.jdi.ArrayType; +import com.sun.jdi.ClassLoaderReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.PrimitiveType; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.Type; +import com.sun.jdi.VirtualMachine; public class ArrayTypeImpl extends ReferenceTypeImpl implements ArrayType { protected ArrayTypeImpl(VirtualMachine aVm, ArrayKlass aRef) { @@ -75,7 +85,8 @@ } } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set handledInterfaces) { // arrays don't have methods } diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -24,12 +24,30 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; -import sun.jvm.hotspot.oops.Klass; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import sun.jvm.hotspot.oops.InstanceKlass; -import java.util.*; -import java.lang.ref.SoftReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.ClassType; +import com.sun.jdi.Field; +import com.sun.jdi.IncompatibleThreadStateException; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.InvalidTypeException; +import com.sun.jdi.InvocationException; +import com.sun.jdi.Method; +import com.sun.jdi.ObjectReference; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.ThreadReference; +import com.sun.jdi.Value; +import com.sun.jdi.VirtualMachine; public class ClassTypeImpl extends ReferenceTypeImpl implements ClassType @@ -195,22 +213,26 @@ return null; } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set seenInterfaces) { /* * Add methods from * parent types first, so that the methods in this class will * overwrite them in the hash table */ - Iterator iter = interfaces().iterator(); + Iterator iter = interfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - interfaze.addVisibleMethods(methodMap); + if (!seenInterfaces.contains(interfaze)) { + interfaze.addVisibleMethods(methodMap, seenInterfaces); + seenInterfaces.add(interfaze); + } } ClassTypeImpl clazz = (ClassTypeImpl)superclass(); if (clazz != null) { - clazz.addVisibleMethods(methodMap); + clazz.addVisibleMethods(methodMap, seenInterfaces); } addToMethodMap(methodMap, methods()); diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -24,15 +24,22 @@ package sun.jvm.hotspot.jdi; -import com.sun.jdi.*; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; + import sun.jvm.hotspot.oops.InstanceKlass; -import java.util.List; -import java.util.ArrayList; -import java.util.Map; -import java.util.Iterator; -import java.util.Collections; -import java.lang.ref.SoftReference; +import com.sun.jdi.ClassNotPreparedException; +import com.sun.jdi.ClassType; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.VirtualMachine; public class InterfaceTypeImpl extends ReferenceTypeImpl implements InterfaceType { @@ -96,16 +103,20 @@ return implementors; } - void addVisibleMethods(Map methodMap) { + @Override + void addVisibleMethods(Map methodMap, Set seenInterfaces) { /* * Add methods from * parent types first, so that the methods in this class will * overwrite them in the hash table */ - Iterator iter = superinterfaces().iterator(); + Iterator iter = superinterfaces().iterator(); while (iter.hasNext()) { InterfaceTypeImpl interfaze = (InterfaceTypeImpl)iter.next(); - interfaze.addVisibleMethods(methodMap); + if (!seenInterfaces.contains(interfaze)) { + interfaze.addVisibleMethods(methodMap, seenInterfaces); + seenInterfaces.add(interfaze); + } } addToMethodMap(methodMap, methods()); diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -24,24 +24,45 @@ package sun.jvm.hotspot.jdi; -import java.io.*; - -import com.sun.jdi.*; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Set; import sun.jvm.hotspot.memory.SystemDictionary; +import sun.jvm.hotspot.oops.ArrayKlass; +import sun.jvm.hotspot.oops.DefaultHeapVisitor; import sun.jvm.hotspot.oops.Instance; import sun.jvm.hotspot.oops.InstanceKlass; -import sun.jvm.hotspot.oops.ArrayKlass; import sun.jvm.hotspot.oops.JVMDIClassStatus; import sun.jvm.hotspot.oops.Klass; -import sun.jvm.hotspot.oops.ObjArray; import sun.jvm.hotspot.oops.Oop; import sun.jvm.hotspot.oops.Symbol; -import sun.jvm.hotspot.oops.DefaultHeapVisitor; import sun.jvm.hotspot.utilities.Assert; -import java.util.*; -import java.lang.ref.SoftReference; +import com.sun.jdi.AbsentInformationException; +import com.sun.jdi.ArrayType; +import com.sun.jdi.ClassLoaderReference; +import com.sun.jdi.ClassNotLoadedException; +import com.sun.jdi.ClassNotPreparedException; +import com.sun.jdi.ClassObjectReference; +import com.sun.jdi.Field; +import com.sun.jdi.InterfaceType; +import com.sun.jdi.Method; +import com.sun.jdi.ObjectReference; +import com.sun.jdi.PrimitiveType; +import com.sun.jdi.ReferenceType; +import com.sun.jdi.Type; +import com.sun.jdi.Value; +import com.sun.jdi.VirtualMachine; public abstract class ReferenceTypeImpl extends TypeImpl implements ReferenceType { @@ -421,7 +442,8 @@ } } - abstract void addVisibleMethods(Map methodMap); + abstract void addVisibleMethods(Map methodMap, Set seenInterfaces); + public final List visibleMethods() throws ClassNotPreparedException { checkPrepared(); /* @@ -430,8 +452,8 @@ * concatenation of name and signature. */ //System.out.println("jj: RTI: Calling addVisibleMethods for:" + this); - Map map = new HashMap(); - addVisibleMethods(map); + Map map = new HashMap(); + addVisibleMethods(map, new HashSet()); /* * ... but the hash map destroys order. Methods should be @@ -441,7 +463,7 @@ */ //System.out.println("jj: RTI: Calling allMethods for:" + this); - List list = new ArrayList(allMethods()); + List list = new ArrayList(allMethods()); //System.out.println("jj: allMethods = " + jjstr(list)); //System.out.println("jj: map = " + map.toString()); //System.out.println("jj: map = " + jjstr(map.values())); diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/memory/AdaptiveFreeList.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/AdaptiveFreeList.java Fri Mar 14 17:19:52 2014 +0100 @@ -0,0 +1,77 @@ +/* + * @(#)AdaptiveFreeList.java + * + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +package sun.jvm.hotspot.memory; + +import java.util.Observable; +import java.util.Observer; + +import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.runtime.VMObject; +import sun.jvm.hotspot.types.CIntegerField; +import sun.jvm.hotspot.types.Type; +import sun.jvm.hotspot.types.TypeDataBase; + +public class AdaptiveFreeList extends VMObject { + static { + VM.registerVMInitializedObserver(new Observer() { + public void update(Observable o, Object data) { + initialize(VM.getVM().getTypeDataBase()); + } + }); + } + + private static synchronized void initialize(TypeDataBase db) { + Type type = db.lookupType("AdaptiveFreeList"); + sizeField = type.getCIntegerField("_size"); + countField = type.getCIntegerField("_count"); + headerSize = type.getSize(); + } + + // Fields + private static CIntegerField sizeField; + private static CIntegerField countField; + private static long headerSize; + + //Constructor + public AdaptiveFreeList(Address address) { + super(address); + } + + // Accessors + public long size() { + return sizeField.getValue(addr); + } + + public long count() { + return countField.getValue(addr); + } + + public static long sizeOf() { + return headerSize; + } +} diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,25 +24,29 @@ package sun.jvm.hotspot.memory; -import java.io.*; -import java.util.*; -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.oops.*; -import sun.jvm.hotspot.runtime.*; -import sun.jvm.hotspot.types.*; -import sun.jvm.hotspot.utilities.*; +import java.io.PrintStream; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; +import java.util.Observable; +import java.util.Observer; + +import sun.jvm.hotspot.debugger.Address; +import sun.jvm.hotspot.debugger.Debugger; +import sun.jvm.hotspot.oops.ObjectHeap; +import sun.jvm.hotspot.oops.Oop; +import sun.jvm.hotspot.runtime.VM; +import sun.jvm.hotspot.runtime.VMObjectFactory; +import sun.jvm.hotspot.types.AddressField; +import sun.jvm.hotspot.types.Type; +import sun.jvm.hotspot.types.TypeDataBase; +import sun.jvm.hotspot.utilities.Assert; public class CompactibleFreeListSpace extends CompactibleSpace { private static AddressField collectorField; - - // for free size, three fields - // FreeBlockDictionary* _dictionary; // ptr to dictionary for large size blocks - // FreeList _indexedFreeList[IndexSetSize]; // indexed array for small size blocks - // LinearAllocBlock _smallLinearAllocBlock; // small linear alloc in TLAB private static AddressField indexedFreeListField; private static AddressField dictionaryField; private static long smallLinearAllocBlockFieldOffset; - private static long indexedFreeListSizeOf; private int heapWordSize; // 4 for 32bit, 8 for 64 bits private int IndexSetStart; // for small indexed list @@ -109,11 +113,11 @@ // small chunks long size = 0; Address cur = addr.addOffsetTo( indexedFreeListField.getOffset() ); - cur = cur.addOffsetTo(IndexSetStart*FreeList.sizeOf()); + cur = cur.addOffsetTo(IndexSetStart*AdaptiveFreeList.sizeOf()); for (int i=IndexSetStart; i"); - sizeField = type.getCIntegerField("_size"); - countField = type.getCIntegerField("_count"); - headerSize = type.getSize(); - } - - // Fields - private static CIntegerField sizeField; - private static CIntegerField countField; - private static long headerSize; - - //Constructor - public FreeList(Address address) { - super(address); - } - - // Accessors - public long size() { - return sizeField.getValue(addr); - } - - public long count() { - return countField.getValue(addr); - } - - public static long sizeOf() { - return headerSize; - } -} diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java --- a/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -152,7 +152,7 @@ private long indexOffset(long index) { if (Assert.ASSERTS_ENABLED) { - Assert.that(index > 0 && index < getLength(), "invalid cp index " + index + " " + getLength()); + Assert.that(index >= 0 && index < getLength(), "invalid cp index " + index + " " + getLength()); } return (index * getElementSize()) + headerSize; } diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/opto/Block.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java Fri Mar 14 17:19:52 2014 +0100 @@ -48,7 +48,7 @@ preOrderField = new CIntField(type.getCIntegerField("_pre_order"), 0); domDepthField = new CIntField(type.getCIntegerField("_dom_depth"), 0); idomField = type.getAddressField("_idom"); - freqField = type.getJFloatField("_freq"); + freqField = type.getJDoubleField("_freq"); } private static AddressField nodesField; @@ -57,7 +57,7 @@ private static CIntField preOrderField; private static CIntField domDepthField; private static AddressField idomField; - private static JFloatField freqField; + private static JDoubleField freqField; public Block(Address addr) { super(addr); @@ -67,8 +67,8 @@ return (int)preOrderField.getValue(getAddress()); } - public float freq() { - return (float)freqField.getValue(getAddress()); + public double freq() { + return (double)freqField.getValue(getAddress()); } public Node_List nodes() { diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java Fri Mar 14 17:19:52 2014 +0100 @@ -25,6 +25,7 @@ package sun.jvm.hotspot.opto; import java.util.*; +import java.io.PrintStream; import sun.jvm.hotspot.ci.*; import sun.jvm.hotspot.debugger.*; import sun.jvm.hotspot.runtime.*; @@ -92,4 +93,13 @@ } return null; } + + public void dumpInlineData(PrintStream out) { + InlineTree inlTree = ilt(); + if (inlTree != null) { + out.print(" inline " + inlTree.count()); + inlTree.dumpReplayData(out); + } + } + } diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java Fri Mar 14 17:19:52 2014 +0100 @@ -87,6 +87,11 @@ return GrowableArray.create(addr, inlineTreeConstructor); } + public int inlineLevel() { + JVMState jvms = callerJvms(); + return (jvms != null) ? jvms.depth() : 0; + } + public void printImpl(PrintStream st, int indent) { for (int i = 0; i < indent; i++) st.print(" "); st.printf(" @ %d ", callerBci()); @@ -101,4 +106,28 @@ public void print(PrintStream st) { printImpl(st, 2); } + + // Count number of nodes in this subtree + public int count() { + int result = 1; + GrowableArray subt = subtrees(); + for (int i = 0 ; i < subt.length(); i++) { + result += subt.at(i).count(); + } + return result; + } + + public void dumpReplayData(PrintStream out) { + out.printf(" %d %d ", inlineLevel(), callerBci()); + Method method = (Method)method().getMetadata(); + Klass holder = method.getMethodHolder(); + out.print(holder.getName().asString() + " " + + OopUtilities.escapeString(method.getName().asString()) + " " + + method.getSignature().asString()); + + GrowableArray subt = subtrees(); + for (int i = 0 ; i < subt.length(); i++) { + subt.at(i).dumpReplayData(out); + } + } } diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java Fri Mar 14 17:19:52 2014 +0100 @@ -88,6 +88,10 @@ return (int)bciField.getValue(getAddress()); } + public int depth() { + return (int)depthField.getValue(getAddress()); + } + public JVMState caller() { return create(callerField.getValue(getAddress())); } diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java Fri Mar 14 17:19:52 2014 +0100 @@ -103,11 +103,12 @@ } SystemDictionary dict = VM.getVM().getSystemDictionary(); - dict.classesDo(new SystemDictionary.ClassAndLoaderVisitor() { - public void visit(Klass k, Oop loader) { + dict.classesDo(new SystemDictionary.ClassVisitor() { + public void visit(Klass k) { if (! (k instanceof InstanceKlass)) { return; } + Oop loader = ((InstanceKlass) k).getClassLoader(); LoaderData ld = (loader != null) ? (LoaderData)loaderMap.get(loader) : bootstrapLoaderData; if (ld != null) { diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -98,11 +98,14 @@ break; default: throw new IllegalArgumentException(); } + if (cpCache == null) { return (short) cpCacheIndex; } else if (fmt.indexOf("JJJJ") >= 0) { - // change byte-ordering and go via secondary cache entry - throw new InternalError("unimplemented"); + // Invokedynamic require special handling + cpCacheIndex = ~cpCacheIndex; + cpCacheIndex = bytes.swapInt(cpCacheIndex); + return (short) cpCache.getEntryAt(cpCacheIndex).getConstantPoolIndex(); } else if (fmt.indexOf("JJ") >= 0) { // change byte-ordering and go via cache return (short) cpCache.getEntryAt((int) (0xFFFF & bytes.swapShort((short)cpCacheIndex))).getConstantPoolIndex(); diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java --- a/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java --- a/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,8 +61,9 @@ long h = 0; int s = 0; int len = buf.length; + // Emulate the unsigned int in java_lang_String::hash_code while (len-- > 0) { - h = 31*h + (0xFFL & buf[s]); + h = 31*h + (0xFFFFFFFFL & buf[s]); s++; } return h & 0xFFFFFFFFL; diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff -r 10dde0063f5a -r c4219e527b83 agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Thu Mar 13 18:45:17 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Fri Mar 14 17:19:52 2014 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -371,19 +371,23 @@ return sa.dbg.lookup(dso, sym); } -// returns the ClosestSymbol or null -function closestSymbolFor(addr) { - if (sa.cdbg == null) { +function loadObjectContainingPC(addr) { + if (sa.cdbg == null) { // no CDebugger support, return null return null; - } else { - var dso = sa.cdbg.loadObjectContainingPC(addr); - if (dso != null) { - return dso.closestSymbolToPC(addr); - } else { - return null; - } - } + } + + return sa.cdbg.loadObjectContainingPC(addr); +} + +// returns the ClosestSymbol or null +function closestSymbolFor(addr) { + var dso = loadObjectContainingPC(addr); + if (dso != null) { + return dso.closestSymbolToPC(addr); + } + + return null; } // Address-to-symbol @@ -804,6 +808,16 @@ // VM type to SA class map var vmType2Class = new Object(); +// C2 only classes +try{ + vmType2Class["ExceptionBlob"] = sapkg.code.ExceptionBlob; + vmType2Class["UncommonTrapBlob"] = sapkg.code.UncommonTrapBlob; +} catch(e) { + // Ignore exception. C2 specific objects might be not + // available in client VM +} + + // This is *not* exhaustive. Add more if needed. // code blobs vmType2Class["BufferBlob"] = sapkg.code.BufferBlob; @@ -812,10 +826,8 @@ vmType2Class["SafepointBlob"] = sapkg.code.SafepointBlob; vmType2Class["C2IAdapter"] = sapkg.code.C2IAdapter; vmType2Class["DeoptimizationBlob"] = sapkg.code.DeoptimizationBlob; -vmType2Class["ExceptionBlob"] = sapkg.code.ExceptionBlob; vmType2Class["I2CAdapter"] = sapkg.code.I2CAdapter; vmType2Class["OSRAdapter"] = sapkg.code.OSRAdapter; -vmType2Class["UncommonTrapBlob"] = sapkg.code.UncommonTrapBlob; vmType2Class["PCDesc"] = sapkg.code.PCDesc; // interpreter @@ -876,21 +888,29 @@ // returns description of given pointer as a String function whatis(addr) { - addr = any2addr(addr); - var ptrLoc = findPtr(addr); - if (ptrLoc.isUnknown()) { - var vmType = vmTypeof(addr); - if (vmType != null) { - return "pointer to " + vmType.name; - } else { - var sym = closestSymbolFor(addr); - if (sym != null) { - return sym.name + '+' + sym.offset; - } else { - return ptrLoc.toString(); - } - } - } else { - return ptrLoc.toString(); - } + addr = any2addr(addr); + var ptrLoc = findPtr(addr); + if (!ptrLoc.isUnknown()) { + return ptrLoc.toString(); + } + + var vmType = vmTypeof(addr); + if (vmType != null) { + return "pointer to " + vmType.name; + } + + var dso = loadObjectContainingPC(addr); + if (dso == null) { + return ptrLoc.toString(); + } + + var sym = dso.closestSymbolToPC(addr); + if (sym != null) { + return sym.name + '+' + sym.offset; + } + + var s = dso.getName(); + var p = s.lastIndexOf("/"); + var base = dso.getBase(); + return s.substring(p+1, s.length) + '+' + addr.minus(base); } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java Fri Mar 14 17:19:52 2014 +0100 @@ -64,7 +64,7 @@ public boolean equals(Object obj) { if (obj instanceof NoFinalizableSubclass) { NoFinalizableSubclass other = (NoFinalizableSubclass) obj; - return other.receiverType == receiverType; + return other.receiverType.equals(receiverType); } return false; } @@ -112,7 +112,7 @@ public boolean equals(Object obj) { if (obj instanceof ConcreteSubtype) { ConcreteSubtype other = (ConcreteSubtype) obj; - return other.context == context && other.subtype == subtype; + return other.context.equals(context) && other.subtype.equals(subtype); } return false; } @@ -166,7 +166,7 @@ public boolean equals(Object obj) { if (obj instanceof ConcreteMethod) { ConcreteMethod other = (ConcreteMethod) obj; - return other.method == method && other.context == context && other.impl == impl; + return other.method.equals(method) && other.context.equals(context) && other.impl.equals(impl); } return false; } @@ -199,7 +199,7 @@ public boolean equals(Object obj) { if (obj instanceof MethodContents) { MethodContents other = (MethodContents) obj; - return other.method == method; + return other.method.equals(method); } return false; } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Fri Mar 14 17:19:52 2014 +0100 @@ -464,13 +464,6 @@ private Assumptions assumptions; - /** - * The leafGraphIds will contain the StructuredGraph.graphId()s of the graphs that were - * incorporated into this compilation. These ids are later on used by the runtime system to - * evict graphs from the graph cache when deoptimizations occur. - */ - private long[] leafGraphIds; - public CompilationResult() { this(null); } @@ -515,14 +508,6 @@ return assumptions; } - public void setLeafGraphIds(long[] leafGraphIds) { - this.leafGraphIds = leafGraphIds; - } - - public long[] getLeafGraphIds() { - return leafGraphIds; - } - /** * Sets the frame size in bytes. Does not include the return address pushed onto the stack, if * any. diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java Fri Mar 14 17:19:52 2014 +0100 @@ -185,11 +185,11 @@ } if (o instanceof VirtualObject) { VirtualObject l = (VirtualObject) o; - if (l.type != type || l.values.length != values.length) { + if (!l.type.equals(type) || l.values.length != values.length) { return false; } for (int i = 0; i < values.length; i++) { - if (values[i] != l.values[i]) { + if (!Objects.equals(values[i], l.values[i])) { return false; } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Fri Mar 14 17:19:52 2014 +0100 @@ -22,6 +22,8 @@ */ package com.oracle.graal.api.meta; +import java.util.*; + /** * Represents an exception handler within the bytecodes. */ @@ -104,10 +106,7 @@ if (this.startBCI != that.startBCI || this.endBCI != that.endBCI || this.handlerBCI != that.handlerBCI || this.catchTypeCPI != that.catchTypeCPI) { return false; } - if (this.catchType == null || that.catchType == null) { - return this.catchType == that.catchType; - } - return this.catchType.equals(that.catchType); + return Objects.equals(this.catchType, that.catchType); } @Override diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Fri Mar 14 17:19:52 2014 +0100 @@ -185,6 +185,9 @@ */ boolean canBeInlined(); + /** + * Returns {@code true} if the inlining of this method should be forced. + */ boolean shouldBeInlined(); /** diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java --- a/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.baseline/src/com/oracle/graal/baseline/BaselineCompiler.java Fri Mar 14 17:19:52 2014 +0100 @@ -130,7 +130,7 @@ // emitCode Assumptions assumptions = new Assumptions(OptAssumptions.getValue()); - GraalCompiler.emitCode(backend, new long[0], assumptions, lirGen, compilationResult, installedCodeOwner, factory); + GraalCompiler.emitCode(backend, assumptions, lirGen, compilationResult, installedCodeOwner, factory); return compilationResult; } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/CheckGraalInvariants.java Fri Mar 14 17:19:52 2014 +0100 @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.compiler.test; + +import java.io.*; +import java.lang.reflect.*; +import java.util.*; +import java.util.zip.*; + +import org.junit.*; + +import com.oracle.graal.api.code.*; +import com.oracle.graal.api.meta.*; +import com.oracle.graal.api.runtime.*; +import com.oracle.graal.debug.*; +import com.oracle.graal.debug.internal.*; +import com.oracle.graal.java.*; +import com.oracle.graal.nodes.*; +import com.oracle.graal.phases.*; +import com.oracle.graal.phases.VerifyPhase.VerificationError; +import com.oracle.graal.phases.tiers.*; +import com.oracle.graal.phases.util.*; +import com.oracle.graal.phases.verify.*; +import com.oracle.graal.runtime.*; + +/** + * Checks that all classes in graal.jar (which must be on the class path) comply with global + * invariants such as using {@link Object#equals(Object)} to compare certain types instead of + * identity comparisons. + */ +public class CheckGraalInvariants { + + @Test + public void test() { + RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class); + Providers providers = rt.getHostBackend().getProviders(); + MetaAccessProvider metaAccess = providers.getMetaAccess(); + + PhaseSuite graphBuilderSuite = new PhaseSuite<>(); + graphBuilderSuite.appendPhase(new GraphBuilderPhase(GraphBuilderConfiguration.getEagerDefault())); + HighTierContext context = new HighTierContext(providers, new Assumptions(false), null, graphBuilderSuite, OptimisticOptimizations.NONE); + + Assume.assumeTrue(VerifyPhase.class.desiredAssertionStatus()); + + String bootclasspath = System.getProperty("sun.boot.class.path"); + Assert.assertNotNull("Cannot find value of boot class path", bootclasspath); + + bootclasspath.split(File.pathSeparator); + + String graalJar = null; + for (String e : bootclasspath.split(File.pathSeparator)) { + if (e.endsWith("graal.jar")) { + graalJar = e; + break; + } + } + Assert.assertNotNull("Could not find graal.jar on boot class path: " + bootclasspath, graalJar); + + final List classNames = new ArrayList<>(); + try { + final ZipFile zipFile = new ZipFile(new File(graalJar)); + for (final Enumeration e = zipFile.entries(); e.hasMoreElements();) { + final ZipEntry zipEntry = e.nextElement(); + String name = zipEntry.getName(); + if (name.endsWith(".class")) { + String className = name.substring(0, name.length() - ".class".length()).replace('/', '.'); + classNames.add(className); + } + } + } catch (IOException e) { + Assert.fail(e.toString()); + } + + // Allows a subset of methods to be checked through use of a system property + String property = System.getProperty(CheckGraalInvariants.class.getName() + ".filters"); + String[] filters = property == null ? null : property.split(","); + + List errors = new ArrayList<>(); + for (String className : classNames) { + try { + Class c = Class.forName(className, false, CheckGraalInvariants.class.getClassLoader()); + for (Method m : c.getDeclaredMethods()) { + if (Modifier.isNative(m.getModifiers()) || Modifier.isAbstract(m.getModifiers())) { + // ignore + } else { + String methodName = className + "." + m.getName(); + if (matches(filters, methodName)) { + StructuredGraph graph = new StructuredGraph(metaAccess.lookupJavaMethod(m)); + DebugConfig debugConfig = DebugScope.getConfig(); + DebugConfig noInterceptConfig = new DelegatingDebugConfig(debugConfig) { + @Override + public RuntimeException interceptException(Throwable e) { + return null; + } + }; + try (DebugConfigScope s = Debug.setConfig(noInterceptConfig)) { + graphBuilderSuite.apply(graph, context); + checkGraph(context, graph); + } catch (VerificationError e) { + errors.add(e.getMessage()); + } catch (LinkageError e) { + // suppress linkages errors resulting from eager resolution + } catch (Throwable e) { + StringWriter sw = new StringWriter(); + e.printStackTrace(new PrintWriter(sw)); + errors.add(String.format("Error while checking %s:%n%s", methodName, sw)); + } + } + } + } + + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + } + if (!errors.isEmpty()) { + StringBuilder msg = new StringBuilder(); + String nl = String.format("%n"); + for (String e : errors) { + if (msg.length() != 0) { + msg.append(nl); + } + msg.append(e); + } + Assert.fail(msg.toString()); + } + } + + /** + * Checks the invariants for a single graph. + */ + private static void checkGraph(HighTierContext context, StructuredGraph graph) { + new VerifyUsageWithEquals(Value.class).apply(graph, context); + new VerifyUsageWithEquals(Register.class).apply(graph, context); + new VerifyUsageWithEquals(JavaType.class).apply(graph, context); + new VerifyUsageWithEquals(JavaMethod.class).apply(graph, context); + new VerifyUsageWithEquals(JavaField.class).apply(graph, context); + } + + private static boolean matches(String[] filters, String s) { + if (filters == null || filters.length == 0) { + return true; + } + for (String filter : filters) { + if (s.contains(filter)) { + return true; + } + } + return false; + } +} diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri Mar 14 17:19:52 2014 +0100 @@ -30,9 +30,9 @@ import com.oracle.graal.alloc.*; import com.oracle.graal.api.code.*; -import com.oracle.graal.api.code.CompilationResult.*; +import com.oracle.graal.api.code.CompilationResult.DataPatch; import com.oracle.graal.api.meta.*; -import com.oracle.graal.api.meta.ProfilingInfo.*; +import com.oracle.graal.api.meta.ProfilingInfo.TriState; import com.oracle.graal.compiler.alloc.*; import com.oracle.graal.compiler.gen.*; import com.oracle.graal.compiler.target.*; @@ -43,7 +43,6 @@ import com.oracle.graal.lir.asm.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; -import com.oracle.graal.nodes.spi.*; import com.oracle.graal.nodes.util.*; import com.oracle.graal.options.*; import com.oracle.graal.phases.*; @@ -134,8 +133,8 @@ * @return the result of the compilation */ public static T compileGraph(StructuredGraph graph, Object stub, CallingConvention cc, ResolvedJavaMethod installedCodeOwner, Providers providers, Backend backend, - TargetDescription target, GraphCache cache, PhaseSuite graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, - SpeculationLog speculationLog, Suites suites, T compilationResult, CompilationResultBuilderFactory factory) { + TargetDescription target, Map cache, PhaseSuite graphBuilderSuite, OptimisticOptimizations optimisticOpts, + ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites, T compilationResult, CompilationResultBuilderFactory factory) { assert !graph.isFrozen(); try (Scope s0 = Debug.scope("GraalCompiler", graph, providers.getCodeCache())) { Assumptions assumptions = new Assumptions(OptAssumptions.getValue()); @@ -149,7 +148,7 @@ LIRGenerator lirGen = null; lirGen = emitLIR(backend, target, schedule, graph, stub, cc); try (Scope s = Debug.scope("CodeGen", lirGen)) { - emitCode(backend, getLeafGraphIdArray(graph), assumptions, lirGen, compilationResult, installedCodeOwner, factory); + emitCode(backend, assumptions, lirGen, compilationResult, installedCodeOwner, factory); } catch (Throwable e) { throw Debug.handle(e); } @@ -170,21 +169,11 @@ } } - private static long[] getLeafGraphIdArray(StructuredGraph graph) { - long[] leafGraphIdArray = new long[graph.getLeafGraphIds().size() + 1]; - int i = 0; - leafGraphIdArray[i++] = graph.graphId(); - for (long id : graph.getLeafGraphIds()) { - leafGraphIdArray[i++] = id; - } - return leafGraphIdArray; - } - /** * Builds the graph, optimizes it. */ - public static SchedulePhase emitHIR(Providers providers, TargetDescription target, StructuredGraph graph, Assumptions assumptions, GraphCache cache, PhaseSuite graphBuilderSuite, - OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites) { + public static SchedulePhase emitHIR(Providers providers, TargetDescription target, StructuredGraph graph, Assumptions assumptions, Map cache, + PhaseSuite graphBuilderSuite, OptimisticOptimizations optimisticOpts, ProfilingInfo profilingInfo, SpeculationLog speculationLog, Suites suites) { if (speculationLog != null) { speculationLog.collectFailedSpeculations(); @@ -297,7 +286,7 @@ } } - public static void emitCode(Backend backend, long[] leafGraphIds, Assumptions assumptions, LIRGenerator lirGen, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, + public static void emitCode(Backend backend, Assumptions assumptions, LIRGenerator lirGen, CompilationResult compilationResult, ResolvedJavaMethod installedCodeOwner, CompilationResultBuilderFactory factory) { CompilationResultBuilder crb = backend.newCompilationResultBuilder(lirGen, compilationResult, factory); backend.emitCode(crb, lirGen.getLIR(), installedCodeOwner); @@ -305,7 +294,6 @@ if (!assumptions.isEmpty()) { compilationResult.setAssumptions(assumptions); } - compilationResult.setLeafGraphIds(leafGraphIds); if (Debug.isMeterEnabled()) { List ldp = compilationResult.getDataReferences(); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Fri Mar 14 17:19:52 2014 +0100 @@ -45,8 +45,8 @@ this.nodeOperands = nodeOperands; } - protected HashMap virtualObjects = new HashMap<>(); - protected IdentityHashMap objectStates = new IdentityHashMap<>(); + protected final HashMap virtualObjects = new HashMap<>(); + protected final IdentityHashMap objectStates = new IdentityHashMap<>(); public LIRFrameState build(FrameState topState, LabelRef exceptionEdge) { assert virtualObjects.size() == 0; diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeList.java Fri Mar 14 17:19:52 2014 +0100 @@ -257,7 +257,7 @@ } @Override - public void snapshotTo(List to) { + public void snapshotTo(Collection to) { for (int i = 0; i < size; i++) { to.add(get(i)); } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/AbstractNodeIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/AbstractNodeIterable.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/AbstractNodeIterable.java Fri Mar 14 17:19:52 2014 +0100 @@ -74,7 +74,7 @@ } @Override - public void snapshotTo(List to) { + public void snapshotTo(Collection to) { for (T n : this) { to.add(n); } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterable.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterable.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/iterators/NodeIterable.java Fri Mar 14 17:19:52 2014 +0100 @@ -44,7 +44,7 @@ List snapshot(); - void snapshotTo(List to); + void snapshotTo(Collection to); T first(); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java --- a/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Fri Mar 14 17:19:52 2014 +0100 @@ -41,7 +41,6 @@ import com.oracle.graal.debug.Debug.Scope; import com.oracle.graal.graph.*; import com.oracle.graal.hotspot.*; -import com.oracle.graal.hotspot.HotSpotReplacementsImpl.GraphProducer; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.lir.*; import com.oracle.graal.lir.LIRInstruction.OperandFlag; @@ -165,30 +164,6 @@ return deviceInitialized; } - @Override - public GraphProducer getGraphProducer() { - if (!deviceInitialized) { - // GPU could not be initialized so offload is disabled - return null; - } - return new GraphProducer() { - - public StructuredGraph getGraphFor(ResolvedJavaMethod method) { - if (canOffloadToGPU(method)) { - ExternalCompilationResult ptxCode = PTXHotSpotBackend.this.compileKernel(method, true); - HotSpotNmethod installedPTXCode = PTXHotSpotBackend.this.installKernel(method, ptxCode); - return new PTXWrapperBuilder(method, installedPTXCode, getRuntime().getHostBackend().getProviders()).getGraph(); - } - return null; - } - - private boolean canOffloadToGPU(ResolvedJavaMethod method) { - HotSpotVMConfig config = getRuntime().getConfig(); - return config.gpuOffload && method.getName().contains("lambda$") && method.isSynthetic(); - } - }; - } - /** * Compiles a given method to PTX code. * diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Fri Mar 14 17:19:52 2014 +0100 @@ -32,6 +32,7 @@ import java.io.*; import java.lang.reflect.*; +import java.util.*; import java.util.concurrent.*; import java.util.concurrent.atomic.*; @@ -51,8 +52,6 @@ import com.oracle.graal.phases.*; import com.oracle.graal.phases.tiers.*; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - public class CompilationTask implements Runnable, Comparable { // Keep static finals in a group with withinEnqueue as the last one. CompilationTask can be @@ -127,15 +126,11 @@ return entryBCI; } - @SuppressFBWarnings(value = "NN_NAKED_NOTIFY") public void run() { withinEnqueue.set(Boolean.FALSE); try { runCompilation(true); } finally { - if (method.currentTask() == this) { - method.setCurrentTask(null); - } withinEnqueue.set(Boolean.TRUE); status.set(CompilationStatus.Finished); synchronized (this) { @@ -240,9 +235,9 @@ TTY.Filter filter = new TTY.Filter(PrintFilter.getValue(), method); long start = System.currentTimeMillis(); try (Scope s = Debug.scope("Compiling", new DebugDumpScope(String.valueOf(id), true))) { - GraphCache graphCache = backend.getRuntime().getGraphCache(); - if (graphCache != null) { - graphCache.removeStaleGraphs(); + Map graphCache = null; + if (GraalOptions.CacheGraphs.getValue()) { + graphCache = new HashMap<>(); } HotSpotProviders providers = backend.getProviders(); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Fri Mar 14 17:19:52 2014 +0100 @@ -27,13 +27,13 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.target.*; -import com.oracle.graal.hotspot.HotSpotReplacementsImpl.GraphProducer; import com.oracle.graal.hotspot.bridge.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.hotspot.stubs.*; import com.oracle.graal.lir.*; -import com.oracle.graal.lir.LIRInstruction.*; -import com.oracle.graal.lir.StandardOp.*; +import com.oracle.graal.lir.LIRInstruction.ValueProcedure; +import com.oracle.graal.lir.StandardOp.LabelOp; +import com.oracle.graal.lir.StandardOp.SaveRegistersOp; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.phases.tiers.*; @@ -95,14 +95,6 @@ } /** - * Gets the graph producer provided by this backend (if any). A primary use case for this is a - * GPU backend that may want to offload certain methods to the GPU. - */ - public GraphProducer getGraphProducer() { - return null; - } - - /** * Finds all the registers that are defined by some given LIR. * * @param lir the LIR to examine diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Fri Mar 14 17:19:52 2014 +0100 @@ -41,7 +41,6 @@ import com.oracle.graal.hotspot.logging.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.options.*; -import com.oracle.graal.phases.*; import com.oracle.graal.runtime.*; //JaCoCo Exclude @@ -196,8 +195,6 @@ protected/* final */CompilerToVM compilerToVm; protected/* final */VMToCompiler vmToCompiler; - private volatile HotSpotGraphCache cache; - protected final HotSpotVMConfig config; private final HotSpotBackend hostBackend; @@ -254,10 +251,6 @@ } registerBackend(factory.createBackend(this, hostBackend)); } - - if (GraalOptions.CacheGraphs.getValue()) { - cache = new HotSpotGraphCache(compilerToVm); - } } private HotSpotBackend registerBackend(HotSpotBackend backend) { @@ -314,10 +307,6 @@ return hostBackend.getTarget(); } - public HotSpotGraphCache getGraphCache() { - return cache; - } - public CompilerToVM getCompilerToVM() { return compilerToVm; } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Fri Mar 14 17:19:52 2014 +0100 @@ -26,12 +26,10 @@ import java.util.*; -import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; import com.oracle.graal.compiler.target.*; import com.oracle.graal.debug.*; import com.oracle.graal.debug.Debug.Scope; -import com.oracle.graal.hotspot.HotSpotReplacementsImpl.*; import com.oracle.graal.hotspot.meta.*; import com.oracle.graal.nodes.spi.*; @@ -60,8 +58,6 @@ lowerer.initialize(providers, config); HotSpotReplacementsImpl replacements = (HotSpotReplacementsImpl) providers.getReplacements(); - replacements.registerGraphProducers(getNonHostGraphProducers()); - // Install intrinsics. if (Intrinsify.getValue()) { try (Scope s = Debug.scope("RegisterReplacements", new DebugDumpScope("RegisterReplacements"))) { @@ -81,26 +77,4 @@ } } - - /** - * Gets the {@link GraphProducer}s from the non-host backends. These allow a GPU backend (for - * example) to offload compilation and execution of certain methods to a GPU. - *

- * Note that is is a very rough initial attempt at providing a hook for a GPU backend to - * intercept a compilation (or method inlining) for the purpose of routing execution to the GPU. - * Expect it to be extensively refined as experimentation with GPU offload proceeds. - */ - protected GraphProducer[] getNonHostGraphProducers() { - List list = new ArrayList<>(); - for (Map.Entry, HotSpotBackend> e : getRuntime().getBackends().entrySet()) { - HotSpotBackend value = e.getValue(); - if (value != this) { - GraphProducer gp = value.getGraphProducer(); - if (gp != null) { - list.add(gp); - } - } - } - return list.toArray(new GraphProducer[list.size()]); - } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -80,41 +80,6 @@ return super.registerMethodSubstitution(originalMethod, substituteMethod); } - /** - * A producer of graphs for methods. - */ - public interface GraphProducer { - - /** - * @returns a graph for {@code method} or null - */ - StructuredGraph getGraphFor(ResolvedJavaMethod method); - } - - /** - * Registers the graph producers that will take precedence over the registered method - * substitutions when {@link #getMethodSubstitution(ResolvedJavaMethod)} is called. - */ - public void registerGraphProducers(GraphProducer[] producers) { - assert this.graphProducers == UNINITIALIZED : "graph producers must be registered at most once"; - this.graphProducers = producers.clone(); - } - - private static GraphProducer[] UNINITIALIZED = {}; - - private GraphProducer[] graphProducers = UNINITIALIZED; - - @Override - public StructuredGraph getMethodSubstitution(ResolvedJavaMethod original) { - for (GraphProducer gp : graphProducers) { - StructuredGraph graph = gp.getGraphFor(original); - if (graph != null) { - return graph; - } - } - return super.getMethodSubstitution(original); - } - @Override public Class getMacroSubstitution(ResolvedJavaMethod method) { HotSpotResolvedJavaMethod hsMethod = (HotSpotResolvedJavaMethod) method; diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Fri Mar 14 17:19:52 2014 +0100 @@ -59,7 +59,7 @@ * Determines if a given metaspace Method can be inlined. A method may not be inlinable for a * number of reasons such as: *

    - *
  • a CompileOracle directive may prevent inlining or compilation of this methods
  • + *
  • a CompileOracle directive may prevent inlining or compilation of methods
  • *
  • the method may have a bytecode breakpoint set
  • *
  • the method may have other bytecode features that require special handling by the VM
  • *
@@ -118,7 +118,9 @@ */ long lookupType(String name, Class accessingClass, boolean resolve); - Object lookupConstantInPool(long metaspaceConstantPool, int cpi); + Object resolveConstantInPool(long metaspaceConstantPool, int cpi); + + Object resolvePossiblyCachedConstantInPool(long metaspaceConstantPool, int cpi); int lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool, int cpi); @@ -128,6 +130,8 @@ int lookupKlassRefIndexInPool(long metaspaceConstantPool, int cpi); + long constantPoolKlassAt(long metaspaceConstantPool, int cpi); + /** * Looks up a class entry in a constant pool. * @@ -163,7 +167,7 @@ */ long resolveField(long metaspaceConstantPool, int cpi, byte opcode, long[] info); - void loadReferencedTypeInPool(long metaspaceConstantPool, int cpi, byte opcode); + int constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool, int cpi); Object lookupAppendixInPool(long metaspaceConstantPool, int cpi); @@ -275,8 +279,6 @@ Object executeCompiledMethodVarargs(Object[] args, HotSpotInstalledCode hotspotInstalledCode) throws InvalidInstalledCodeException; - long[] getDeoptedLeafGraphIds(); - long[] getLineNumberTable(long metaspaceMethod); long getLocalVariableTableStart(long metaspaceMethod); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -63,8 +63,9 @@ @Override public native long lookupType(String name, Class accessingClass, boolean eagerResolve); - @Override - public native Object lookupConstantInPool(long metaspaceConstantPool, int cpi); + public native Object resolveConstantInPool(long metaspaceConstantPool, int cpi); + + public native Object resolvePossiblyCachedConstantInPool(long metaspaceConstantPool, int cpi); @Override public native int lookupNameAndTypeRefIndexInPool(long metaspaceConstantPool, int cpi); @@ -78,6 +79,8 @@ @Override public native int lookupKlassRefIndexInPool(long metaspaceConstantPool, int cpi); + public native long constantPoolKlassAt(long metaspaceConstantPool, int cpi); + @Override public native long lookupKlassInPool(long metaspaceConstantPool, int cpi); @@ -87,8 +90,7 @@ @Override public native long resolveField(long metaspaceConstantPool, int cpi, byte opcode, long[] info); - @Override - public native void loadReferencedTypeInPool(long metaspaceConstantPool, int cpi, byte opcode); + public native int constantPoolRemapInstructionOperandFromCache(long metaspaceConstantPool, int cpi); @Override public native Object lookupAppendixInPool(long metaspaceConstantPool, int cpi); @@ -125,9 +127,6 @@ public native Object executeCompiledMethodVarargs(Object[] args, HotSpotInstalledCode hotspotInstalledCode); @Override - public native long[] getDeoptedLeafGraphIds(); - - @Override public native long[] getLineNumberTable(long metaspaceMethod); @Override diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -330,9 +330,6 @@ TTY.println(" in %d ms (compiled %d methods)", System.currentTimeMillis() - startTime, compileQueue.getCompletedTaskCount()); } - if (runtime.getGraphCache() != null) { - runtime.getGraphCache().clear(); - } System.gc(); phaseTransition("bootstrap2"); } @@ -584,7 +581,6 @@ CompilationTask task = new CompilationTask(backend, method, entryBCI, block); try { - method.setCurrentTask(task); compileQueue.execute(task); if (block) { task.block(); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java Fri Mar 14 17:19:52 2014 +0100 @@ -45,8 +45,6 @@ import com.oracle.graal.options.*; import com.oracle.graal.replacements.nodes.*; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * This class contains infrastructure to maintain counters based on {@link DynamicCounterNode}s. The * infrastructure is enabled by specifying either the GenericDynamicCounters or @@ -107,7 +105,6 @@ public static long[] delta; public static final ArrayList staticCounters = new ArrayList<>(); - @SuppressFBWarnings(value = "AT_OPERATION_SEQUENCE_ON_CONCURRENT_ABSTRACTION", justification = "concurrent abstraction calls are in synchronized block") public static int getIndex(DynamicCounterNode counter) { if (!enabled) { throw new GraalInternalError("counter nodes shouldn't exist when counters are not enabled: " + counter.getGroup() + ", " + counter.getName()); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java Fri Mar 14 17:19:52 2014 +0100 @@ -40,6 +40,51 @@ private static final long serialVersionUID = -5443206401485234850L; /** + * Enum of all {@code JVM_CONSTANT} constants used in the VM. This includes the public and + * internal ones. + */ + private enum JVM_CONSTANT { + // @formatter:off + Utf8(config().jvmConstantUtf8), + Integer(config().jvmConstantInteger), + Long(config().jvmConstantLong), + Float(config().jvmConstantFloat), + Double(config().jvmConstantDouble), + Class(config().jvmConstantClass), + UnresolvedClass(config().jvmConstantUnresolvedClass), + UnresolvedClassInError(config().jvmConstantUnresolvedClassInError), + String(config().jvmConstantString), + Fieldref(config().jvmConstantFieldref), + MethodRef(config().jvmConstantMethodref), + InterfaceMethodref(config().jvmConstantInterfaceMethodref), + NameAndType(config().jvmConstantNameAndType), + MethodHandle(config().jvmConstantMethodHandle), + MethodHandleInError(config().jvmConstantMethodHandleInError), + MethodType(config().jvmConstantMethodType), + MethodTypeInError(config().jvmConstantMethodTypeInError); + // @formatter:on + + private final int value; + + private JVM_CONSTANT(int value) { + this.value = value; + } + + private static HotSpotVMConfig config() { + return runtime().getConfig(); + } + + public static JVM_CONSTANT getEnum(int value) { + for (JVM_CONSTANT e : values()) { + if (e.value == value) { + return e; + } + } + throw GraalInternalError.shouldNotReachHere("unknown enum value " + value); + } + } + + /** * Reference to the C++ ConstantPool object. */ private final long metaspaceConstantPool; @@ -86,11 +131,12 @@ * @param index constant pool index * @return constant pool tag */ - private int getTagAt(int index) { + private JVM_CONSTANT getTagAt(int index) { assertBounds(index); HotSpotVMConfig config = runtime().getConfig(); - long tags = unsafe.getAddress(metaspaceConstantPool + config.constantPoolTagsOffset); - return unsafe.getByteVolatile(null, tags + config.arrayU1DataOffset + index); + final long metaspaceConstantPoolTags = unsafe.getAddress(metaspaceConstantPool + config.constantPoolTagsOffset); + final int tag = unsafe.getByteVolatile(null, metaspaceConstantPoolTags + config.arrayU1DataOffset + index); + return JVM_CONSTANT.getEnum(tag); } /** @@ -101,8 +147,7 @@ */ private long getEntryAt(int index) { assertBounds(index); - HotSpotVMConfig config = runtime().getConfig(); - return unsafe.getAddress(metaspaceConstantPool + config.constantPoolSize + index * runtime().getTarget().wordSize); + return unsafe.getAddress(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize); } /** @@ -112,9 +157,8 @@ * @return integer constant pool entry at index */ private int getIntAt(int index) { - HotSpotVMConfig config = runtime().getConfig(); - assertTag(index, config.jvmConstantInteger); - return unsafe.getInt(metaspaceConstantPool + config.constantPoolSize + index * runtime().getTarget().wordSize); + assertTag(index, JVM_CONSTANT.Integer); + return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize); } /** @@ -124,9 +168,8 @@ * @return long constant pool entry */ private long getLongAt(int index) { - HotSpotVMConfig config = runtime().getConfig(); - assertTag(index, config.jvmConstantLong); - return unsafe.getLong(metaspaceConstantPool + config.constantPoolSize + index * runtime().getTarget().wordSize); + assertTag(index, JVM_CONSTANT.Long); + return unsafe.getLong(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize); } /** @@ -136,9 +179,8 @@ * @return float constant pool entry */ private float getFloatAt(int index) { - HotSpotVMConfig config = runtime().getConfig(); - assertTag(index, config.jvmConstantFloat); - return unsafe.getFloat(metaspaceConstantPool + config.constantPoolSize + index * runtime().getTarget().wordSize); + assertTag(index, JVM_CONSTANT.Float); + return unsafe.getFloat(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize); } /** @@ -148,9 +190,8 @@ * @return float constant pool entry */ private double getDoubleAt(int index) { - HotSpotVMConfig config = runtime().getConfig(); - assertTag(index, config.jvmConstantDouble); - return unsafe.getDouble(metaspaceConstantPool + config.constantPoolSize + index * runtime().getTarget().wordSize); + assertTag(index, JVM_CONSTANT.Double); + return unsafe.getDouble(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize); } /** @@ -160,9 +201,8 @@ * @return {@code JVM_CONSTANT_NameAndType} constant pool entry */ private int getNameAndTypeAt(int index) { - HotSpotVMConfig config = runtime().getConfig(); - assertTag(index, config.jvmConstantNameAndType); - return unsafe.getInt(metaspaceConstantPool + config.constantPoolSize + index * runtime().getTarget().wordSize); + assertTag(index, JVM_CONSTANT.NameAndType); + return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize); } /** @@ -239,6 +279,20 @@ } /** + * Gets the uncached klass reference index constant pool entry at index {@code index}. See: + * {@code ConstantPool::uncached_klass_ref_index_at}. + * + * @param index constant pool index + * @return klass reference index + */ + private int getUncachedKlassRefIndexAt(int index) { + assert getTagAt(index) == JVM_CONSTANT.Fieldref || getTagAt(index) == JVM_CONSTANT.MethodRef || getTagAt(index) == JVM_CONSTANT.InterfaceMethodref; + final int refIndex = unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolSize + index * runtime().getTarget().wordSize); + // klass ref index is in the low 16-bits. + return refIndex & 0xFFFF; + } + + /** * Asserts that the constant pool index {@code index} is in the bounds of the constant pool. * * @param index constant pool index @@ -253,115 +307,52 @@ * @param index constant pool index * @param tag expected tag */ - private void assertTag(int index, int tag) { - assert getTagAt(index) == tag : "constant pool tag at index " + index + " is " + getNameForTag(getTagAt(index)) + " but expected " + getNameForTag(tag); - } - - private static String getNameForTag(int tag) { - HotSpotVMConfig config = runtime().getConfig(); - if (tag == config.jvmConstantUtf8) { - return "JVM_CONSTANT_Utf8"; - } - if (tag == config.jvmConstantInteger) { - return "JVM_CONSTANT_Integer"; - } - if (tag == config.jvmConstantLong) { - return "JVM_CONSTANT_Long"; - } - if (tag == config.jvmConstantFloat) { - return "JVM_CONSTANT_Float"; - } - if (tag == config.jvmConstantDouble) { - return "JVM_CONSTANT_Double"; - } - if (tag == config.jvmConstantClass) { - return "JVM_CONSTANT_Class"; - } - if (tag == config.jvmConstantUnresolvedClass) { - return "JVM_CONSTANT_UnresolvedClass"; - } - if (tag == config.jvmConstantUnresolvedClassInError) { - return "JVM_CONSTANT_UnresolvedClassInError"; - } - if (tag == config.jvmConstantString) { - return "JVM_CONSTANT_String"; - } - if (tag == config.jvmConstantFieldref) { - return "JVM_CONSTANT_Fieldref"; - } - if (tag == config.jvmConstantMethodref) { - return "JVM_CONSTANT_Methodref"; - } - if (tag == config.jvmConstantInterfaceMethodref) { - return "JVM_CONSTANT_InterfaceMethodref"; - } - if (tag == config.jvmConstantNameAndType) { - return "JVM_CONSTANT_NameAndType"; - } - if (tag == config.jvmConstantMethodHandle) { - return "JVM_CONSTANT_MethodHandle"; - } - if (tag == config.jvmConstantMethodHandleInError) { - return "JVM_CONSTANT_MethodHandleInError"; - } - if (tag == config.jvmConstantMethodType) { - return "JVM_CONSTANT_MethodType"; - } - if (tag == config.jvmConstantMethodTypeInError) { - return "JVM_CONSTANT_MethodTypeInError"; - } - return "unknown constant tag " + tag; + private void assertTag(int index, JVM_CONSTANT tag) { + assert getTagAt(index) == tag : "constant pool tag at index " + index + " is " + getTagAt(index) + " but expected " + tag; } @Override public int length() { - HotSpotVMConfig config = runtime().getConfig(); - return unsafe.getInt(metaspaceConstantPool + config.constantPoolLengthOffset); + return unsafe.getInt(metaspaceConstantPool + runtime().getConfig().constantPoolLengthOffset); } @Override public Object lookupConstant(int cpi) { assert cpi != 0; - - HotSpotVMConfig config = runtime().getConfig(); - final int tag = getTagAt(cpi); - - // Handle primitive constant pool entries directly. - if (tag == config.jvmConstantInteger) { - return Constant.forInt(getIntAt(cpi)); - } - if (tag == config.jvmConstantLong) { - return Constant.forLong(getLongAt(cpi)); - } - if (tag == config.jvmConstantFloat) { - return Constant.forFloat(getFloatAt(cpi)); - } - if (tag == config.jvmConstantDouble) { - return Constant.forDouble(getDoubleAt(cpi)); + final JVM_CONSTANT tag = getTagAt(cpi); + switch (tag) { + case Integer: + return Constant.forInt(getIntAt(cpi)); + case Long: + return Constant.forLong(getLongAt(cpi)); + case Float: + return Constant.forFloat(getFloatAt(cpi)); + case Double: + return Constant.forDouble(getDoubleAt(cpi)); + case Class: + case UnresolvedClass: + case UnresolvedClassInError: + final int opcode = -1; // opcode is not used + return lookupType(cpi, opcode); + case String: + Object string = runtime().getCompilerToVM().resolvePossiblyCachedConstantInPool(metaspaceConstantPool, cpi); + return Constant.forObject(string); + case MethodHandle: + case MethodHandleInError: + case MethodType: + case MethodTypeInError: + Object obj = runtime().getCompilerToVM().resolveConstantInPool(metaspaceConstantPool, cpi); + return Constant.forObject(obj); + default: + throw GraalInternalError.shouldNotReachHere("unknown constant pool tag " + tag); } - - // All the other constant pool entries need special attention so we call down into the VM. - if (tag == config.jvmConstantClass || tag == config.jvmConstantUnresolvedClass || tag == config.jvmConstantUnresolvedClassInError) { - final int opcode = -1; // opcode is not used - return lookupType(cpi, opcode); - } - if (tag == config.jvmConstantString) { - Object string = runtime().getCompilerToVM().lookupConstantInPool(metaspaceConstantPool, cpi); - return Constant.forObject(string); - } - if (tag == config.jvmConstantMethodHandle || tag == config.jvmConstantMethodHandleInError || tag == config.jvmConstantMethodType || tag == config.jvmConstantMethodTypeInError) { - Object obj = runtime().getCompilerToVM().lookupConstantInPool(metaspaceConstantPool, cpi); - return Constant.forObject(obj); - } - - throw GraalInternalError.shouldNotReachHere("unknown constant pool tag " + tag); } @Override public String lookupUtf8(int cpi) { - assertTag(cpi, runtime().getConfig().jvmConstantUtf8); - long signature = getEntryAt(cpi); - HotSpotSymbol symbol = new HotSpotSymbol(signature); + assertTag(cpi, JVM_CONSTANT.Utf8); + final long metaspaceSymbol = getEntryAt(cpi); + HotSpotSymbol symbol = new HotSpotSymbol(metaspaceSymbol); return symbol.asString(); } @@ -473,7 +464,37 @@ break; default: index = toConstantPoolIndex(cpi, opcode); + index = runtime().getCompilerToVM().constantPoolRemapInstructionOperandFromCache(metaspaceConstantPool, index); } - runtime().getCompilerToVM().loadReferencedTypeInPool(metaspaceConstantPool, index, (byte) opcode); + + JVM_CONSTANT tag = getTagAt(index); + switch (tag) { + case Fieldref: + case MethodRef: + case InterfaceMethodref: + index = getUncachedKlassRefIndexAt(index); + tag = getTagAt(index); + assert tag == JVM_CONSTANT.Class || tag == JVM_CONSTANT.UnresolvedClass || tag == JVM_CONSTANT.UnresolvedClassInError : tag; + break; + default: + // nothing + break; + } + + switch (tag) { + case Class: + case UnresolvedClass: + case UnresolvedClassInError: + final long metaspaceKlass = runtime().getCompilerToVM().constantPoolKlassAt(metaspaceConstantPool, index); + HotSpotResolvedObjectType type = (HotSpotResolvedObjectType) HotSpotResolvedObjectType.fromMetaspaceKlass(metaspaceKlass); + Class klass = type.mirror(); + if (!klass.isPrimitive() && !klass.isArray()) { + unsafe.ensureClassInitialized(klass); + } + break; + default: + // nothing + break; + } } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotGraphCache.java Thu Mar 13 18:45:17 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,199 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.hotspot.meta; - -import static com.oracle.graal.phases.GraalOptions.*; - -import java.io.*; -import java.lang.ref.*; -import java.util.*; -import java.util.Map.Entry; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.hotspot.bridge.*; -import com.oracle.graal.nodes.*; -import com.oracle.graal.nodes.spi.*; - -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - -/** - * This class implements the graph caching system for the HotSpot platform. - * - * This implementation does not use a map to store the actual cached graphs. The problem is that - * such maps keep the graph, and therefore the {@link ResolvedJavaMethod} referenced from the graph, - * alive. For some applications and benchmarks this is a problem, e.g., the DaCapoScala "scalatest" - * benchmark will quickly run out of perm gen because of this. - * - * This cannot be solved with a {@code WeakHashMap}, since the values - * within the map will keep the keys alive. In order for this to work we would require a weak map in - * which the "strongness" of the value references depends upon the reachability of the keys. - * - * Therefore the graph cache is implemented in such a way that it stores its cache entries within - * the {@link ResolvedJavaMethod}. It uses the {@link ResolvedJavaMethod#getCompilerStorage()} map - * with the HotSpotGraphCache instance as key. The cached graph will be kept alive as long as the - * {@link ResolvedJavaMethod} is alive, but does not prevent the method, and therefore the class, - * from being unloaded. - * - * The {@link #cachedGraphIds} map is used to find the graphs that should be removed because of - * deoptimization, and to enforce the graph cache size restriction. - */ -public class HotSpotGraphCache implements GraphCache { - - private static final PrintStream out = System.out; - - private volatile long hitCounter; - private volatile long missCounter; - private volatile long removeHitCounter; - private volatile long removeCounter; - private volatile long putCounter; - - /** - * An ordered hash map for looking up the methods corresponding to a specific graph id. It - * enforces the maximum graph cache size by removing the oldest (in insertion-order) element if - * the cache gets too big. - */ - private final class LRUCache extends LinkedHashMap> { - - private static final long serialVersionUID = -3973307040793397840L; - - public LRUCache() { - super(GraphCacheSize.getValue() * 2, 0.75f, false); - } - - @Override - protected boolean removeEldestEntry(Entry> eldest) { - if (size() > GraphCacheSize.getValue()) { - ResolvedJavaMethod method = eldest.getValue().get(); - if (method != null) { - StructuredGraph cachedGraph = (StructuredGraph) method.getCompilerStorage().get(HotSpotGraphCache.this); - if (cachedGraph != null && cachedGraph.graphId() == eldest.getKey()) { - method.getCompilerStorage().remove(HotSpotGraphCache.this); - } - } - return true; - } else { - return false; - } - } - } - - private final Map> cachedGraphIds = Collections.synchronizedMap(new LRUCache()); - - public HotSpotGraphCache(CompilerToVM compilerToVM) { - this.compilerToVM = compilerToVM; - if (PrintGraphCache.getValue()) { - Runtime.getRuntime().addShutdownHook(new Thread() { - - @Override - public void run() { - out.println("put: " + putCounter); - out.println("get hit: " + hitCounter); - out.println("get miss: " + missCounter); - out.println("remove hit: " + removeHitCounter); - out.println("remove miss: " + (removeCounter - removeHitCounter)); - } - }); - } - } - - @Override - @SuppressFBWarnings(value = "VO_VOLATILE_INCREMENT", justification = "counters are only used for statistics") - public StructuredGraph get(ResolvedJavaMethod method) { - StructuredGraph result = (StructuredGraph) method.getCompilerStorage().get(this); - - if (PrintGraphCache.getValue()) { - if (result == null) { - missCounter++; - } else { - hitCounter++; - } - } - return result; - } - - @Override - @SuppressFBWarnings(value = "VO_VOLATILE_INCREMENT", justification = "counters are only used for statistics") - public boolean put(StructuredGraph graph, boolean hasMatureProfilingInfo) { - assert graph.method() != null; - if (hasMatureProfilingInfo) { - cachedGraphIds.put(graph.graphId(), new WeakReference<>(graph.method())); - graph.method().getCompilerStorage().put(this, graph); - - if (PrintGraphCache.getValue()) { - putCounter++; - } - return true; - } - return false; - } - - public void clear() { - synchronized (cachedGraphIds) { - for (WeakReference ref : cachedGraphIds.values()) { - ResolvedJavaMethod method = ref.get(); - if (method != null) { - method.getCompilerStorage().remove(this); - } - } - cachedGraphIds.clear(); - hitCounter = 0; - missCounter = 0; - removeHitCounter = 0; - removeCounter = 0; - putCounter = 0; - } - } - - @SuppressFBWarnings(value = "VO_VOLATILE_INCREMENT", justification = "counters are only used for statistics") - public void removeGraphs(long[] deoptedGraphs) { - for (long graphId : deoptedGraphs) { - WeakReference ref = cachedGraphIds.get(graphId); - ResolvedJavaMethod method = ref == null ? null : ref.get(); - if (method != null) { - StructuredGraph cachedGraph = (StructuredGraph) method.getCompilerStorage().get(this); - if (cachedGraph != null && cachedGraph.graphId() == graphId) { - method.getCompilerStorage().remove(this); - if (PrintGraphCache.getValue()) { - removeHitCounter++; - } - } - } - if (PrintGraphCache.getValue()) { - removeCounter++; - } - } - } - - private final CompilerToVM compilerToVM; - - public void removeStaleGraphs() { - long[] deoptedGraphs = compilerToVM.getDeoptedLeafGraphIds(); - if (deoptedGraphs != null) { - if (deoptedGraphs.length == 0) { - clear(); - } else { - removeGraphs(deoptedGraphs); - } - } - } -} diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Fri Mar 14 17:19:52 2014 +0100 @@ -68,6 +68,23 @@ } @Override + public boolean equals(Object obj) { + if (this == obj) { + return true; + } + if (obj instanceof HotSpotResolvedJavaField) { + HotSpotResolvedJavaField that = (HotSpotResolvedJavaField) obj; + return this.holder.equals(that.holder) && this.name.equals(that.name) && this.type.equals(that.type); + } + return false; + } + + @Override + public int hashCode() { + return name.hashCode(); + } + + @Override public int getModifiers() { return modifiers & getReflectionFieldModifiers(); } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Fri Mar 14 17:19:52 2014 +0100 @@ -62,7 +62,6 @@ private Map compilerStorage; private HotSpotMethodData methodData; private byte[] code; - private CompilationTask currentTask; private SpeculationLog speculationLog; /** @@ -128,6 +127,20 @@ return unsafe.getAddress(metaspaceMethod + runtime().getConfig().methodConstMethodOffset); } + @Override + public boolean equals(Object obj) { + if (obj instanceof HotSpotResolvedJavaMethod) { + HotSpotResolvedJavaMethod that = (HotSpotResolvedJavaMethod) obj; + return that.metaspaceMethod == metaspaceMethod; + } + return false; + } + + @Override + public int hashCode() { + return (int) metaspaceMethod; + } + /** * Returns this method's constant method flags ({@code ConstMethod::_flags}). * @@ -600,14 +613,6 @@ return unsafe.getInt(metaspaceMethod + config.methodVtableIndexOffset); } - public void setCurrentTask(CompilationTask task) { - currentTask = task; - } - - public CompilationTask currentTask() { - return currentTask; - } - public SpeculationLog getSpeculationLog() { if (speculationLog == null) { speculationLog = new SpeculationLog(); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Fri Mar 14 17:19:52 2014 +0100 @@ -44,4 +44,19 @@ } public abstract Class mirror(); + + @Override + public final boolean equals(Object obj) { + if (!(obj instanceof HotSpotResolvedJavaType)) { + return false; + } + HotSpotResolvedJavaType that = (HotSpotResolvedJavaType) obj; + return this.mirror().equals(that.mirror()); + } + + @Override + public final int hashCode() { + return getName().hashCode(); + } + } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Fri Mar 14 17:19:52 2014 +0100 @@ -593,7 +593,7 @@ } if (!includeSuperclasses) { int myFieldsStart = 0; - while (myFieldsStart < instanceFields.length && instanceFields[myFieldsStart].getDeclaringClass() != this) { + while (myFieldsStart < instanceFields.length && !instanceFields[myFieldsStart].getDeclaringClass().equals(this)) { myFieldsStart++; } if (myFieldsStart == 0) { @@ -763,20 +763,6 @@ } @Override - public boolean equals(Object obj) { - if (!(obj instanceof HotSpotResolvedObjectType)) { - return false; - } - HotSpotResolvedObjectType that = (HotSpotResolvedObjectType) obj; - return this.mirror() == that.mirror(); - } - - @Override - public int hashCode() { - return super.hashCode(); - } - - @Override public String toString() { String simpleName; if (isArray() || isInterface()) { diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Fri Mar 14 17:19:52 2014 +0100 @@ -154,7 +154,7 @@ @Override public boolean isAssignableFrom(ResolvedJavaType other) { assert other != null; - return other == this; + return other.equals(this); } @Override diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java Fri Mar 14 17:19:52 2014 +0100 @@ -42,7 +42,9 @@ protected boolean verify(StructuredGraph graph, PhaseContext context) { for (ConstantNode node : getConstantNodes(graph)) { if (node.recordsUsages() || !node.gatherUsages(graph).isEmpty()) { - assert !isObject(node) || isNullReference(node) || isInternedString(node) : "illegal object constant: " + node; + if (isObject(node) && !isNullReference(node) && !isInternedString(node)) { + throw new VerificationError("illegal object constant: " + node); + } } } return true; diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BciBlockMapping.java Fri Mar 14 17:19:52 2014 +0100 @@ -99,11 +99,6 @@ public Block retSuccessor; public boolean endsWithRet = false; - public BitSet localsLiveIn; - public BitSet localsLiveOut; - private BitSet localsLiveGen; - private BitSet localsLiveKill; - public Block exceptionDispatchBlock() { if (successors.size() > 0 && successors.get(successors.size() - 1) instanceof ExceptionDispatchBlock) { return successors.get(successors.size() - 1); @@ -167,6 +162,8 @@ private Block[] blockMap; public Block[] loopHeaders; + public LocalLiveness liveness; + /** * Creates a new BlockMap instance from bytecode of the given method . * @@ -212,7 +209,8 @@ } if (OptLivenessAnalysis.getValue()) { try (Scope s = Debug.scope("LivenessAnalysis")) { - computeLiveness(); + liveness = method.getMaxLocals() <= 64 ? new SmallLocalLiveness() : new LargeLocalLiveness(); + liveness.computeLiveness(); } catch (Throwable e) { throw Debug.handle(e); } @@ -729,153 +727,225 @@ return loops; } - private void computeLiveness() { - for (Block block : blocks) { - computeLocalLiveness(block); - } + /** + * Encapsulates the liveness calculation, so that subclasses for locals <= 64 and locals > 64 + * can be implemented. + */ + public abstract class LocalLiveness { + + private void computeLiveness() { + for (Block block : blocks) { + computeLocalLiveness(block); + } - boolean changed; - int iteration = 0; - do { - Debug.log("Iteration %d", iteration); - changed = false; - for (int i = blocks.size() - 1; i >= 0; i--) { - Block block = blocks.get(i); - Debug.log(" start B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen, - block.localsLiveKill); + boolean changed; + int iteration = 0; + do { + Debug.log("Iteration %d", iteration); + changed = false; + for (int i = blocks.size() - 1; i >= 0; i--) { + Block block = blocks.get(i); + int blockID = block.blockID; + // log statements in IFs because debugLiveX creates a new String + if (Debug.isLogEnabled()) { + Debug.log(" start B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), + debugLiveGen(blockID), debugLiveKill(blockID)); + } - boolean blockChanged = (iteration == 0); - if (block.successors.size() > 0) { - int oldCardinality = block.localsLiveOut.cardinality(); - for (Block sux : block.successors) { - Debug.log(" Successor B%d: %s", sux.blockID, sux.localsLiveIn); - block.localsLiveOut.or(sux.localsLiveIn); + boolean blockChanged = (iteration == 0); + if (block.successors.size() > 0) { + int oldCardinality = liveOutCardinality(blockID); + for (Block sux : block.successors) { + if (Debug.isLogEnabled()) { + Debug.log(" Successor B%d: %s", sux.blockID, debugLiveIn(sux.blockID)); + } + propagateLiveness(blockID, sux.blockID); + } + blockChanged |= (oldCardinality != liveOutCardinality(blockID)); } - blockChanged |= (oldCardinality != block.localsLiveOut.cardinality()); + + if (blockChanged) { + updateLiveness(blockID); + if (Debug.isLogEnabled()) { + Debug.log(" end B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, debugLiveIn(blockID), debugLiveOut(blockID), + debugLiveGen(blockID), debugLiveKill(blockID)); + } + } + changed |= blockChanged; } - - if (blockChanged) { - block.localsLiveIn.clear(); - block.localsLiveIn.or(block.localsLiveOut); - block.localsLiveIn.andNot(block.localsLiveKill); - block.localsLiveIn.or(block.localsLiveGen); - Debug.log(" end B%d [%d, %d] in: %s out: %s gen: %s kill: %s", block.blockID, block.startBci, block.endBci, block.localsLiveIn, block.localsLiveOut, block.localsLiveGen, - block.localsLiveKill); - } - changed |= blockChanged; - } - iteration++; - } while (changed); - } - - private void computeLocalLiveness(Block block) { - block.localsLiveIn = new BitSet(method.getMaxLocals()); - block.localsLiveOut = new BitSet(method.getMaxLocals()); - block.localsLiveGen = new BitSet(method.getMaxLocals()); - block.localsLiveKill = new BitSet(method.getMaxLocals()); - - if (block.startBci < 0 || block.endBci < 0) { - return; + iteration++; + } while (changed); } - stream.setBCI(block.startBci); - while (stream.currentBCI() <= block.endBci) { - switch (stream.currentBC()) { - case LLOAD: - case DLOAD: - loadTwo(block, stream.readLocalIndex()); - break; - case LLOAD_0: - case DLOAD_0: - loadTwo(block, 0); - break; - case LLOAD_1: - case DLOAD_1: - loadTwo(block, 1); - break; - case LLOAD_2: - case DLOAD_2: - loadTwo(block, 2); - break; - case LLOAD_3: - case DLOAD_3: - loadTwo(block, 3); - break; - case ILOAD: - case IINC: - case FLOAD: - case ALOAD: - case RET: - loadOne(block, stream.readLocalIndex()); - break; - case ILOAD_0: - case FLOAD_0: - case ALOAD_0: - loadOne(block, 0); - break; - case ILOAD_1: - case FLOAD_1: - case ALOAD_1: - loadOne(block, 1); - break; - case ILOAD_2: - case FLOAD_2: - case ALOAD_2: - loadOne(block, 2); - break; - case ILOAD_3: - case FLOAD_3: - case ALOAD_3: - loadOne(block, 3); - break; + /** + * Returns whether the local is live at the beginning of the given block. + */ + public abstract boolean localIsLiveIn(Block block, int local); + + /** + * Returns whether the local is live at the end of the given block. + */ + public abstract boolean localIsLiveOut(Block block, int local); + + /** + * Returns a string representation of the liveIn values of the given block. + */ + protected abstract String debugLiveIn(int blockID); + + /** + * Returns a string representation of the liveOut values of the given block. + */ + protected abstract String debugLiveOut(int blockID); + + /** + * Returns a string representation of the liveGen values of the given block. + */ + protected abstract String debugLiveGen(int blockID); + + /** + * Returns a string representation of the liveKill values of the given block. + */ + protected abstract String debugLiveKill(int blockID); + + /** + * Returns the number of live locals at the end of the given block. + */ + protected abstract int liveOutCardinality(int blockID); + + /** + * Adds all locals the are in the liveIn of the successor to the liveOut of the block. + */ + protected abstract void propagateLiveness(int blockID, int successorID); + + /** + * Calculates a new liveIn for the given block from liveOut, liveKill and liveGen. + */ + protected abstract void updateLiveness(int blockID); + + /** + * Adds the local to liveGen if it wasn't already killed in this block. + */ + protected abstract void loadOne(int blockID, int local); + + /** + * Add this local to liveKill if it wasn't already generated in this block. + */ + protected abstract void storeOne(int blockID, int local); - case LSTORE: - case DSTORE: - storeTwo(block, stream.readLocalIndex()); - break; - case LSTORE_0: - case DSTORE_0: - storeTwo(block, 0); - break; - case LSTORE_1: - case DSTORE_1: - storeTwo(block, 1); - break; - case LSTORE_2: - case DSTORE_2: - storeTwo(block, 2); - break; - case LSTORE_3: - case DSTORE_3: - storeTwo(block, 3); - break; - case ISTORE: - case FSTORE: - case ASTORE: - storeOne(block, stream.readLocalIndex()); - break; - case ISTORE_0: - case FSTORE_0: - case ASTORE_0: - storeOne(block, 0); - break; - case ISTORE_1: - case FSTORE_1: - case ASTORE_1: - storeOne(block, 1); - break; - case ISTORE_2: - case FSTORE_2: - case ASTORE_2: - storeOne(block, 2); - break; - case ISTORE_3: - case FSTORE_3: - case ASTORE_3: - storeOne(block, 3); - break; + private void computeLocalLiveness(Block block) { + if (block.startBci < 0 || block.endBci < 0) { + return; } - stream.next(); + int blockID = block.blockID; + stream.setBCI(block.startBci); + while (stream.currentBCI() <= block.endBci) { + switch (stream.currentBC()) { + case LLOAD: + case DLOAD: + loadTwo(blockID, stream.readLocalIndex()); + break; + case LLOAD_0: + case DLOAD_0: + loadTwo(blockID, 0); + break; + case LLOAD_1: + case DLOAD_1: + loadTwo(blockID, 1); + break; + case LLOAD_2: + case DLOAD_2: + loadTwo(blockID, 2); + break; + case LLOAD_3: + case DLOAD_3: + loadTwo(blockID, 3); + break; + case ILOAD: + case IINC: + case FLOAD: + case ALOAD: + case RET: + loadOne(blockID, stream.readLocalIndex()); + break; + case ILOAD_0: + case FLOAD_0: + case ALOAD_0: + loadOne(blockID, 0); + break; + case ILOAD_1: + case FLOAD_1: + case ALOAD_1: + loadOne(blockID, 1); + break; + case ILOAD_2: + case FLOAD_2: + case ALOAD_2: + loadOne(blockID, 2); + break; + case ILOAD_3: + case FLOAD_3: + case ALOAD_3: + loadOne(blockID, 3); + break; + + case LSTORE: + case DSTORE: + storeTwo(blockID, stream.readLocalIndex()); + break; + case LSTORE_0: + case DSTORE_0: + storeTwo(blockID, 0); + break; + case LSTORE_1: + case DSTORE_1: + storeTwo(blockID, 1); + break; + case LSTORE_2: + case DSTORE_2: + storeTwo(blockID, 2); + break; + case LSTORE_3: + case DSTORE_3: + storeTwo(blockID, 3); + break; + case ISTORE: + case FSTORE: + case ASTORE: + storeOne(blockID, stream.readLocalIndex()); + break; + case ISTORE_0: + case FSTORE_0: + case ASTORE_0: + storeOne(blockID, 0); + break; + case ISTORE_1: + case FSTORE_1: + case ASTORE_1: + storeOne(blockID, 1); + break; + case ISTORE_2: + case FSTORE_2: + case ASTORE_2: + storeOne(blockID, 2); + break; + case ISTORE_3: + case FSTORE_3: + case ASTORE_3: + storeOne(blockID, 3); + break; + } + stream.next(); + } + } + + private void loadTwo(int blockID, int local) { + loadOne(blockID, local); + loadOne(blockID, local + 1); + } + + private void storeTwo(int blockID, int local) { + storeOne(blockID, local); + storeOne(blockID, local + 1); } } @@ -889,25 +959,182 @@ return map; } - private static void loadTwo(Block block, int local) { - loadOne(block, local); - loadOne(block, local + 1); - } + public final class SmallLocalLiveness extends LocalLiveness { + /* + * local n is represented by the bit accessible as (1 << n) + */ + + private final long[] localsLiveIn; + private final long[] localsLiveOut; + private final long[] localsLiveGen; + private final long[] localsLiveKill; + + public SmallLocalLiveness() { + localsLiveIn = new long[blocks.size()]; + localsLiveOut = new long[blocks.size()]; + localsLiveGen = new long[blocks.size()]; + localsLiveKill = new long[blocks.size()]; + } + + private String debugString(long value) { + StringBuilder str = new StringBuilder("{"); + long current = value; + for (int i = 0; i < method.getMaxLocals(); i++) { + if ((current & 1L) == 1L) { + if (str.length() > 1) { + str.append(", "); + } + str.append(i); + } + current >>= 1; + } + return str.append('}').toString(); + } + + @Override + protected String debugLiveIn(int blockID) { + return debugString(localsLiveIn[blockID]); + } + + @Override + protected String debugLiveOut(int blockID) { + return debugString(localsLiveOut[blockID]); + } + + @Override + protected String debugLiveGen(int blockID) { + return debugString(localsLiveGen[blockID]); + } - private static void loadOne(Block block, int local) { - if (!block.localsLiveKill.get(local)) { - block.localsLiveGen.set(local); + @Override + protected String debugLiveKill(int blockID) { + return debugString(localsLiveKill[blockID]); + } + + @Override + protected int liveOutCardinality(int blockID) { + return Long.bitCount(localsLiveOut[blockID]); + } + + @Override + protected void propagateLiveness(int blockID, int successorID) { + localsLiveOut[blockID] |= localsLiveIn[successorID]; + } + + @Override + protected void updateLiveness(int blockID) { + localsLiveIn[blockID] = (localsLiveOut[blockID] & ~localsLiveKill[blockID]) | localsLiveGen[blockID]; + } + + @Override + protected void loadOne(int blockID, int local) { + long bit = 1L << local; + if ((localsLiveKill[blockID] & bit) == 0L) { + localsLiveGen[blockID] |= bit; + } + } + + @Override + protected void storeOne(int blockID, int local) { + long bit = 1L << local; + if ((localsLiveGen[blockID] & bit) == 0L) { + localsLiveKill[blockID] |= bit; + } + } + + @Override + public boolean localIsLiveIn(Block block, int local) { + int blockID = block.blockID; + return blockID >= Integer.MAX_VALUE ? false : (localsLiveIn[blockID] & (1L << local)) != 0L; + } + + @Override + public boolean localIsLiveOut(Block block, int local) { + int blockID = block.blockID; + return blockID >= Integer.MAX_VALUE ? false : (localsLiveOut[blockID] & (1L << local)) != 0L; } } - private static void storeTwo(Block block, int local) { - storeOne(block, local); - storeOne(block, local + 1); - } + public final class LargeLocalLiveness extends LocalLiveness { + private BitSet[] localsLiveIn; + private BitSet[] localsLiveOut; + private BitSet[] localsLiveGen; + private BitSet[] localsLiveKill; + + public LargeLocalLiveness() { + localsLiveIn = new BitSet[blocks.size()]; + localsLiveOut = new BitSet[blocks.size()]; + localsLiveGen = new BitSet[blocks.size()]; + localsLiveKill = new BitSet[blocks.size()]; + for (int i = 0; i < blocks.size(); i++) { + localsLiveIn[i] = new BitSet(method.getMaxLocals()); + localsLiveOut[i] = new BitSet(method.getMaxLocals()); + localsLiveGen[i] = new BitSet(method.getMaxLocals()); + localsLiveKill[i] = new BitSet(method.getMaxLocals()); + } + } + + @Override + protected String debugLiveIn(int blockID) { + return localsLiveIn[blockID].toString(); + } + + @Override + protected String debugLiveOut(int blockID) { + return localsLiveOut[blockID].toString(); + } + + @Override + protected String debugLiveGen(int blockID) { + return localsLiveGen[blockID].toString(); + } + + @Override + protected String debugLiveKill(int blockID) { + return localsLiveKill[blockID].toString(); + } - private static void storeOne(Block block, int local) { - if (!block.localsLiveGen.get(local)) { - block.localsLiveKill.set(local); + @Override + protected int liveOutCardinality(int blockID) { + return localsLiveOut[blockID].cardinality(); + } + + @Override + protected void propagateLiveness(int blockID, int successorID) { + localsLiveOut[blockID].or(localsLiveIn[successorID]); + } + + @Override + protected void updateLiveness(int blockID) { + BitSet liveIn = localsLiveIn[blockID]; + liveIn.clear(); + liveIn.or(localsLiveOut[blockID]); + liveIn.andNot(localsLiveKill[blockID]); + liveIn.or(localsLiveGen[blockID]); + } + + @Override + protected void loadOne(int blockID, int local) { + if (!localsLiveKill[blockID].get(local)) { + localsLiveGen[blockID].set(local); + } + } + + @Override + protected void storeOne(int blockID, int local) { + if (!localsLiveGen[blockID].get(local)) { + localsLiveKill[blockID].set(local); + } + } + + @Override + public boolean localIsLiveIn(Block block, int local) { + return block.blockID >= Integer.MAX_VALUE ? true : localsLiveIn[block.blockID].get(local); + } + + @Override + public boolean localIsLiveOut(Block block, int local) { + return block.blockID >= Integer.MAX_VALUE ? true : localsLiveOut[block.blockID].get(local); } } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Fri Mar 14 17:19:52 2014 +0100 @@ -32,6 +32,8 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.Node.Verbosity; +import com.oracle.graal.java.BciBlockMapping.Block; +import com.oracle.graal.java.BciBlockMapping.LocalLiveness; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.java.*; @@ -146,7 +148,7 @@ } public boolean isCompatibleWith(FrameStateBuilder other) { - assert method == other.method && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method"; + assert method.equals(other.method) && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method"; assert lockedObjects.length == monitorIds.length && other.lockedObjects.length == other.monitorIds.length : "mismatch between lockedObjects and monitorIds"; if (stackSize() != other.stackSize()) { @@ -315,13 +317,21 @@ } } - public void clearNonLiveLocals(BitSet liveness) { + public void clearNonLiveLocals(Block block, LocalLiveness liveness, boolean liveIn) { if (liveness == null) { return; } - for (int i = 0; i < locals.length; i++) { - if (!liveness.get(i)) { - locals[i] = null; + if (liveIn) { + for (int i = 0; i < locals.length; i++) { + if (!liveness.localIsLiveIn(block, i)) { + locals[i] = null; + } + } + } else { + for (int i = 0; i < locals.length; i++) { + if (!liveness.localIsLiveOut(block, i)) { + locals[i] = null; + } } } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Fri Mar 14 17:19:52 2014 +0100 @@ -42,6 +42,7 @@ import com.oracle.graal.graph.*; import com.oracle.graal.java.BciBlockMapping.Block; import com.oracle.graal.java.BciBlockMapping.ExceptionDispatchBlock; +import com.oracle.graal.java.BciBlockMapping.LocalLiveness; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.calc.FloatConvertNode.FloatConvert; @@ -159,6 +160,7 @@ } private Block[] loopHeaders; + private LocalLiveness liveness; /** * Gets the current frame state being processed by this builder. @@ -225,6 +227,7 @@ // compute the block map, setup exception handlers and get the entrypoint(s) BciBlockMapping blockMap = BciBlockMapping.create(method); loopHeaders = blockMap.loopHeaders; + liveness = blockMap.liveness; lastInstr = currentGraph.start(); if (isSynchronized(method.getModifiers())) { @@ -233,7 +236,7 @@ methodSynchronizedObject = synchronizedObject(frameState, method); lastInstr = genMonitorEnter(methodSynchronizedObject); } - frameState.clearNonLiveLocals(blockMap.startBlock.localsLiveIn); + frameState.clearNonLiveLocals(blockMap.startBlock, liveness, true); ((StateSplit) lastInstr).setStateAfter(frameState.create(0)); if (graphBuilderConfig.eagerInfopointMode()) { @@ -825,7 +828,7 @@ * calls). Also, interfaces are initialized only under special circumstances, so that * this assertion would often fail for interface calls. */ - assert !graphBuilderConfig.unresolvedIsError() || (result instanceof ResolvedJavaMethod && (opcode != INVOKESTATIC || ((ResolvedJavaMethod) result).getDeclaringClass().isInitialized())); + assert !graphBuilderConfig.unresolvedIsError() || (result instanceof ResolvedJavaMethod && (opcode != INVOKESTATIC || ((ResolvedJavaMethod) result).getDeclaringClass().isInitialized())) : result; return result; } @@ -839,7 +842,7 @@ private Object lookupConstant(int cpi, int opcode) { eagerResolvingForSnippets(cpi, opcode); Object result = constantPool.lookupConstant(cpi); - assert !graphBuilderConfig.eagerResolving() || !(result instanceof JavaType) || (result instanceof ResolvedJavaType); + assert !graphBuilderConfig.eagerResolving() || !(result instanceof JavaType) || (result instanceof ResolvedJavaType) : result; return result; } @@ -1228,7 +1231,7 @@ createInvoke(callTarget, resultType); } else { assert bci() == currentBlock.endBci; - frameState.clearNonLiveLocals(currentBlock.localsLiveOut); + frameState.clearNonLiveLocals(currentBlock, liveness, false); InvokeWithExceptionNode invoke = createInvokeWithException(callTarget, resultType); @@ -1544,7 +1547,7 @@ Target target = checkLoopExit(block.firstInstruction, block, state); FixedNode result = target.fixed; block.entryState = target.state == state ? state.copy() : target.state; - block.entryState.clearNonLiveLocals(block.localsLiveIn); + block.entryState.clearNonLiveLocals(block, liveness, true); Debug.log("createTarget %s: first visit, result: %s", block, block.firstInstruction); return result; @@ -1823,7 +1826,7 @@ bci = stream.currentBCI(); if (bci > block.endBci) { - frameState.clearNonLiveLocals(currentBlock.localsLiveOut); + frameState.clearNonLiveLocals(currentBlock, liveness, false); } if (lastInstr instanceof StateSplit) { if (lastInstr.getClass() == AbstractBeginNode.class) { diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/HIRFrameStateBuilder.java Fri Mar 14 17:19:52 2014 +0100 @@ -32,6 +32,8 @@ import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.Node.Verbosity; +import com.oracle.graal.java.BciBlockMapping.Block; +import com.oracle.graal.java.BciBlockMapping.LocalLiveness; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.calc.*; import com.oracle.graal.nodes.java.*; @@ -139,7 +141,7 @@ } public boolean isCompatibleWith(HIRFrameStateBuilder other) { - assert method == other.method && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method"; + assert method.equals(other.method) && graph == other.graph && localsSize() == other.localsSize() : "Can only compare frame states of the same method"; assert lockedObjects.length == monitorIds.length && other.lockedObjects.length == other.monitorIds.length : "mismatch between lockedObjects and monitorIds"; if (stackSize() != other.stackSize()) { @@ -308,13 +310,21 @@ } } - public void clearNonLiveLocals(BitSet liveness) { + public void clearNonLiveLocals(Block block, LocalLiveness liveness, boolean liveIn) { if (liveness == null) { return; } - for (int i = 0; i < locals.length; i++) { - if (!liveness.get(i)) { - locals[i] = null; + if (liveIn) { + for (int i = 0; i < locals.length; i++) { + if (!liveness.localIsLiveIn(block, i)) { + locals[i] = null; + } + } + } else { + for (int i = 0; i < locals.length; i++) { + if (!liveness.localIsLiveOut(block, i)) { + locals[i] = null; + } } } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java Fri Mar 14 17:19:52 2014 +0100 @@ -100,7 +100,7 @@ } } else if (boxingTypes.contains(holder)) { return method.getName().equals("valueOf"); - } else if (method.getDeclaringClass() == metaAccess.lookupJavaType(Class.class)) { + } else if (method.getDeclaringClass().equals(metaAccess.lookupJavaType(Class.class))) { return method.getName().equals("desiredAssertionStatus"); } else if (method.getDeclaringClass().equals(declaringClass)) { return (method.getName().equals("$jacocoInit")); @@ -113,7 +113,7 @@ for (ValueNode node : graph.getNodes().filter(ValueNode.class)) { if (node instanceof StoreFieldNode) { ResolvedJavaField field = ((StoreFieldNode) node).field(); - verify(field.getDeclaringClass() == declaringClass, node, "store to field " + format("%H.%n", field)); + verify(field.getDeclaringClass().equals(declaringClass), node, "store to field " + format("%H.%n", field)); verify(isStatic(field.getModifiers()), node, "store to field " + format("%H.%n", field)); if (optionValueType.isAssignableFrom((ResolvedJavaType) field.getType())) { verify(isFinal(field.getModifiers()), node, "option field " + format("%H.%n", field) + " not final"); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java Fri Mar 14 17:19:52 2014 +0100 @@ -222,7 +222,8 @@ } } else if (b instanceof InstanceOfNode) { InstanceOfNode instanceOfB = (InstanceOfNode) b; - if (instanceOfA.object() == instanceOfB.object() && !instanceOfA.type().isAssignableFrom(instanceOfB.type()) && !instanceOfB.type().isAssignableFrom(instanceOfA.type())) { + if (instanceOfA.object() == instanceOfB.object() && !instanceOfA.type().isInterface() && !instanceOfB.type().isInterface() && + !instanceOfA.type().isAssignableFrom(instanceOfB.type()) && !instanceOfB.type().isAssignableFrom(instanceOfA.type())) { // Two instanceof on the same value with mutually exclusive types. JavaTypeProfile profileA = instanceOfA.profile(); JavaTypeProfile profileB = instanceOfB.profile(); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Fri Mar 14 17:19:52 2014 +0100 @@ -71,8 +71,6 @@ private static final AtomicLong uniqueGraphIds = new AtomicLong(); - private final Set leafGraphIds = new HashSet<>(4); - private StartNode start; private final ResolvedJavaMethod method; private final long graphId; @@ -162,14 +160,6 @@ this.start = start; } - /** - * @return the {@link Set} that contains the {@link #graphId()} of all graphs that were - * incorporated into this one (e.g. by inlining). - */ - public Set getLeafGraphIds() { - return leafGraphIds; - } - @Override public StructuredGraph copy() { return copy(name); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Fri Mar 14 17:19:52 2014 +0100 @@ -22,6 +22,8 @@ */ package com.oracle.graal.nodes; +import java.util.*; + import com.oracle.graal.api.meta.*; import com.oracle.graal.debug.*; import com.oracle.graal.graph.*; @@ -102,7 +104,7 @@ Debug.log("Profile useless, there is enough static type information available."); return object; } - if (type == lastCheckedType) { + if (Objects.equals(type, lastCheckedType)) { // We have already incorporate the knowledge about this type => abort. return this; } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Fri Mar 14 17:19:52 2014 +0100 @@ -117,7 +117,7 @@ } else if (!xIdentity && !yIdentity) { // both are virtual without identity: check contents assert stateX.getVirtualObject().entryCount() == 1 && stateY.getVirtualObject().entryCount() == 1; - assert stateX.getVirtualObject().type() == stateY.getVirtualObject().type(); + assert stateX.getVirtualObject().type().equals(stateY.getVirtualObject().type()); assert stateX.getVirtualObject().entryKind(0).getStackKind() == Kind.Int || stateX.getVirtualObject().entryKind(0) == Kind.Long; IntegerEqualsNode equals = new IntegerEqualsNode(stateX.getEntry(0), stateY.getEntry(0)); tool.addNode(equals); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Fri Mar 14 17:19:52 2014 +0100 @@ -60,7 +60,7 @@ if (state != null && state.getState() == EscapeState.Virtual) { ResolvedJavaType objectType = state.getVirtualObject().type(); ResolvedJavaType expectedType = tool.getMetaAccessProvider().lookupJavaType(boxingKind.toBoxedJavaClass()); - if (objectType == expectedType) { + if (objectType.equals(expectedType)) { tool.replaceWithValue(state.getEntry(0)); } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Fri Mar 14 17:19:52 2014 +0100 @@ -165,7 +165,7 @@ } if (tool.assumptions() != null && tool.assumptions().useOptimisticAssumptions()) { ResolvedJavaType exactType = type.findUniqueConcreteSubtype(); - if (exactType != null && exactType != type) { + if (exactType != null && !exactType.equals(type)) { // Propagate more precise type information to usages of the checkcast. tool.assumptions().recordConcreteSubtype(type, exactType); return graph().add(new CheckCastNode(exactType, object, profile, forStoreCheck)); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Fri Mar 14 17:19:52 2014 +0100 @@ -165,7 +165,7 @@ public static MethodCallTargetNode find(StructuredGraph graph, ResolvedJavaMethod method) { for (MethodCallTargetNode target : graph.getNodes(MethodCallTargetNode.class)) { - if (target.targetMethod == method) { + if (target.targetMethod.equals(method)) { return target; } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/GraphCache.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/GraphCache.java Thu Mar 13 18:45:17 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.oracle.graal.nodes.spi; - -import com.oracle.graal.api.meta.*; -import com.oracle.graal.nodes.*; - -/** - * A cache for graphs associated with {@linkplain StructuredGraph#method() methods}. - */ -public interface GraphCache { - - /** - * Requests that a graph be added to this cache. - * - * @param hasMatureProfilingInfo indicates that the caller has - * {@linkplain ProfilingInfo#isMature() mature} profiling info for the method - * associated with the graph - * @return true if {@code graph} was added to this cache, false otherwise - */ - boolean put(StructuredGraph graph, boolean hasMatureProfilingInfo); - - /** - * Gets the graph from this cache associated with a given method. - * - * @param method a method for which a cached graph is requested - * @return the graph cached for {@code method} or null if it does not exist - */ - StructuredGraph get(ResolvedJavaMethod method); - - /** - * The cache will remove graphs it considers stale. For example, graphs associated with - * installed code that has subsequently be deoptimized might be considered stale. - */ - void removeStaleGraphs(); -} diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java Fri Mar 14 17:19:52 2014 +0100 @@ -119,14 +119,14 @@ meetAlwaysNull = other.alwaysNull; } else { meetType = meetTypes(type(), other.type()); - meetExactType = meetType == type && meetType == other.type && exactType && other.exactType; + meetExactType = Objects.equals(meetType, type) && Objects.equals(meetType, other.type) && exactType && other.exactType; meetNonNull = nonNull && other.nonNull; meetAlwaysNull = false; } - if (meetType == type && meetExactType == exactType && meetNonNull == nonNull && meetAlwaysNull == alwaysNull) { + if (Objects.equals(meetType, type) && meetExactType == exactType && meetNonNull == nonNull && meetAlwaysNull == alwaysNull) { return this; - } else if (meetType == other.type && meetExactType == other.exactType && meetNonNull == other.nonNull && meetAlwaysNull == other.alwaysNull) { + } else if (Objects.equals(meetType, other.type) && meetExactType == other.exactType && meetNonNull == other.nonNull && meetAlwaysNull == other.alwaysNull) { return other; } else { return new ObjectStamp(meetType, meetExactType, meetNonNull, meetAlwaysNull); @@ -186,7 +186,7 @@ boolean joinAlwaysNull = alwaysNull || other.alwaysNull; boolean joinNonNull = nonNull || other.nonNull; boolean joinExactType = exactType || other.exactType; - if (type == other.type) { + if (Objects.equals(type, other.type)) { joinType = type; } else if (type == null && other.type == null) { joinType = null; @@ -230,9 +230,9 @@ } else if (joinExactType && !isConcreteType(joinType)) { return StampFactory.illegal(Kind.Object); } - if (joinType == type && joinExactType == exactType && joinNonNull == nonNull && joinAlwaysNull == alwaysNull) { + if (Objects.equals(joinType, type) && joinExactType == exactType && joinNonNull == nonNull && joinAlwaysNull == alwaysNull) { return this; - } else if (joinType == other.type && joinExactType == other.exactType && joinNonNull == other.nonNull && joinAlwaysNull == other.alwaysNull) { + } else if (Objects.equals(joinType, other.type) && joinExactType == other.exactType && joinNonNull == other.nonNull && joinAlwaysNull == other.alwaysNull) { return other; } else { return new ObjectStamp(joinType, joinExactType, joinNonNull, joinAlwaysNull); @@ -244,7 +244,7 @@ } private static ResolvedJavaType meetTypes(ResolvedJavaType a, ResolvedJavaType b) { - if (a == b) { + if (Objects.equals(a, b)) { return a; } else if (a == null || b == null) { return null; diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Fri Mar 14 17:19:52 2014 +0100 @@ -240,7 +240,7 @@ assert type.getKind() == Kind.Object; ResolvedJavaType exact = type.asExactType(); if (exact != null) { - assert !exactType || type == exact; + assert !exactType || type.equals(exact); return new ObjectStamp(exact, true, nonNull, false); } else { return new ObjectStamp(type, exactType, nonNull, false); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Fri Mar 14 17:19:52 2014 +0100 @@ -77,7 +77,7 @@ public int fieldIndex(ResolvedJavaField field) { // on average fields.length == ~6, so a linear search is fast enough for (int i = 0; i < fields.length; i++) { - if (fields[i] == field) { + if (fields[i].equals(field)) { return i; } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Fri Mar 14 17:19:52 2014 +0100 @@ -253,7 +253,7 @@ ResolvedJavaType knownType = getNodeType(original); ResolvedJavaType newType = tighten(type, knownType); - if (newType != knownType) { + if (!newType.equals(knownType)) { knownTypes.put(original, newType); metricTypeRegistered.increment(); } @@ -271,7 +271,7 @@ public static ResolvedJavaType widen(ResolvedJavaType a, ResolvedJavaType b) { if (a == null || b == null) { return null; - } else if (a == b) { + } else if (a.equals(b)) { return a; } else { return a.findLeastCommonAncestor(b); @@ -283,7 +283,7 @@ return b; } else if (b == null) { return a; - } else if (a == b) { + } else if (a.equals(b)) { return a; } else if (a.isAssignableFrom(b)) { return b; @@ -623,7 +623,7 @@ ValueNode receiver = callTarget.receiver(); if (receiver != null && (callTarget.invokeKind() == InvokeKind.Interface || callTarget.invokeKind() == InvokeKind.Virtual)) { ResolvedJavaType type = state.getNodeType(receiver); - if (type != ObjectStamp.typeOrNull(receiver)) { + if (!Objects.equals(type, ObjectStamp.typeOrNull(receiver))) { ResolvedJavaMethod method = type.resolveMethod(callTarget.targetMethod()); if (method != null) { if (Modifier.isFinal(method.getModifiers()) || Modifier.isFinal(type.getModifiers())) { @@ -645,7 +645,7 @@ for (Node n : value.usages()) { if (n instanceof InstanceOfNode) { InstanceOfNode instanceOfNode = (InstanceOfNode) n; - if (instanceOfNode.type() == type && state.trueConditions.containsKey(instanceOfNode)) { + if (instanceOfNode.type().equals(type) && state.trueConditions.containsKey(instanceOfNode)) { ValueNode v = state.trueConditions.get(instanceOfNode); if (v instanceof GuardingNode) { return (GuardingNode) v; diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/FrameStateAssignmentPhase.java Fri Mar 14 17:19:52 2014 +0100 @@ -59,8 +59,9 @@ if (node instanceof StateSplit) { StateSplit stateSplit = (StateSplit) node; - if (stateSplit.stateAfter() != null) { - FrameState newState = stateSplit.stateAfter(); + FrameState stateAfter = stateSplit.stateAfter(); + if (stateAfter != null) { + FrameState newState = stateAfter; stateSplit.setStateAfter(null); return newState; } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Fri Mar 14 17:19:52 2014 +0100 @@ -281,7 +281,7 @@ } private static StructuredGraph getCachedGraph(ResolvedJavaMethod method, HighTierContext context) { - if (CacheGraphs.getValue() && context.getGraphCache() != null) { + if (context.getGraphCache() != null) { StructuredGraph cachedGraph = context.getGraphCache().get(method); if (cachedGraph != null) { return cachedGraph; @@ -304,8 +304,8 @@ canonicalizer.apply(newGraph, context); } - if (CacheGraphs.getValue() && context.getGraphCache() != null) { - context.getGraphCache().put(newGraph.copy(), hasMatureProfilingInfo); + if (hasMatureProfilingInfo && context.getGraphCache() != null) { + context.getGraphCache().put(newGraph.method(), newGraph.copy()); } return newGraph; } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Fri Mar 14 17:19:52 2014 +0100 @@ -318,14 +318,9 @@ } protected static void inline(Invoke invoke, ResolvedJavaMethod concrete, Inlineable inlineable, Assumptions assumptions, boolean receiverNullCheck) { - StructuredGraph graph = invoke.asNode().graph(); if (inlineable instanceof InlineableGraph) { StructuredGraph calleeGraph = ((InlineableGraph) inlineable).getGraph(); InliningUtil.inline(invoke, calleeGraph, receiverNullCheck); - - graph.getLeafGraphIds().add(calleeGraph.graphId()); - // we might at some point cache already-inlined graphs, so add recursively: - graph.getLeafGraphIds().addAll(calleeGraph.getLeafGraphIds()); } else { assert inlineable instanceof InlineableMacroNode; @@ -1434,7 +1429,7 @@ } else { // only handle the outermost frame states if (frameState.outerFrameState() == null) { - assert frameState.bci == FrameState.INVALID_FRAMESTATE_BCI || frameState.method() == inlineGraph.method(); + assert frameState.bci == FrameState.INVALID_FRAMESTATE_BCI || frameState.method().equals(inlineGraph.method()); if (outerFrameState == null) { outerFrameState = stateAfter.duplicateModified(invoke.bci(), stateAfter.rethrowException(), invokeNode.kind()); outerFrameState.setDuringCall(true); @@ -1545,7 +1540,7 @@ public static FixedWithNextNode inlineMacroNode(Invoke invoke, ResolvedJavaMethod concrete, Class macroNodeClass) throws GraalInternalError { StructuredGraph graph = invoke.asNode().graph(); - if (((MethodCallTargetNode) invoke.callTarget()).targetMethod() != concrete) { + if (!concrete.equals(((MethodCallTargetNode) invoke.callTarget()).targetMethod())) { assert ((MethodCallTargetNode) invoke.callTarget()).invokeKind() != InvokeKind.Static; InliningUtil.replaceInvokeCallTarget(invoke, graph, InvokeKind.Special, concrete); } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Fri Mar 14 17:19:52 2014 +0100 @@ -92,10 +92,6 @@ // graph caching @Option(help = "") public static final OptionValue CacheGraphs = new OptionValue<>(true); - @Option(help = "") - public static final OptionValue GraphCacheSize = new OptionValue<>(1000); - @Option(help = "") - public static final OptionValue PrintGraphCache = new OptionValue<>(false); //loop transform settings TODO (gd) tune @Option(help = "") diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Fri Mar 14 17:19:52 2014 +0100 @@ -27,15 +27,35 @@ /*** * This phase serves as a verification, in order to check the graph for certain properties. The * {@link #verify(StructuredGraph, Object)} method will be used as an assertion, and implements the - * actual check. Instead of returning false, it is also valid to throw an {@link AssertionError} in - * the implemented {@link #verify(StructuredGraph, Object)} method. + * actual check. Instead of returning false, it is also valid to throw an {@link VerificationError} + * in the implemented {@link #verify(StructuredGraph, Object)} method. */ public abstract class VerifyPhase extends BasePhase { + /** + * Thrown when verification performed by a {@link VerifyPhase} fails. + */ + @SuppressWarnings("serial") + public static class VerificationError extends AssertionError { + + public VerificationError(String message) { + super(message); + } + + public VerificationError(String message, Throwable cause) { + super(message, cause); + } + } + @Override protected final void run(StructuredGraph graph, C context) { assert verify(graph, context); } + /** + * Performs the actual verification. + * + * @throws VerificationError if the verification fails + */ protected abstract boolean verify(StructuredGraph graph, C context); } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/schedule/SchedulePhase.java Fri Mar 14 17:19:52 2014 +0100 @@ -292,7 +292,7 @@ } private void printSchedule(String desc) { - if (Debug.isEnabled()) { + if (Debug.isLogEnabled()) { Debug.printf("=== %s / %s / %s (%s) ===\n", getCFG().getStartBlock().getBeginNode().graph(), selectedStrategy, memsched, desc); for (Block b : getCFG().getBlocks()) { Debug.printf("==== b: %s (loopDepth: %s). ", b, b.getLoopDepth()); @@ -388,8 +388,7 @@ private void assignBlockToNode(ScheduledNode node, SchedulingStrategy strategy) { assert !node.isDeleted(); - Block prevBlock = cfg.getNodeToBlock().get(node); - if (prevBlock != null) { + if (cfg.getNodeToBlock().containsKey(node)) { return; } // PhiNodes, ProxyNodes and FixedNodes should already have been placed in blocks by @@ -418,6 +417,7 @@ block = latestBlock(node, strategy); } if (block == null) { + // handle nodes without usages block = earliestBlock; } else if (strategy == SchedulingStrategy.LATEST_OUT_OF_LOOPS && !(node instanceof VirtualObjectNode)) { // schedule at the latest position possible in the outermost loop possible @@ -752,10 +752,14 @@ if (!(usage instanceof FrameState)) { throw new SchedulingError(usage.toString()); } - // If a FrameState belongs to a BeginNode then it's inputs will be placed at the - // common dominator of all EndNodes. - for (Node pred : unscheduledUsage.cfgPredecessors()) { - closure.apply(cfg.getNodeToBlock().get(pred)); + if (unscheduledUsage instanceof StartNode) { + closure.apply(cfg.getNodeToBlock().get(unscheduledUsage)); + } else { + // If a FrameState belongs to a BeginNode then it's inputs will be placed at + // the common dominator of all EndNodes. + for (Node pred : unscheduledUsage.cfgPredecessors()) { + closure.apply(cfg.getNodeToBlock().get(pred)); + } } } else { // For the time being, FrameStates can only be connected to NodeWithState. diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java Fri Mar 14 17:19:52 2014 +0100 @@ -22,8 +22,11 @@ */ package com.oracle.graal.phases.tiers; +import java.util.*; + import com.oracle.graal.api.code.*; import com.oracle.graal.api.meta.*; +import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.spi.*; import com.oracle.graal.phases.*; import com.oracle.graal.phases.util.*; @@ -32,18 +35,19 @@ private final PhaseSuite graphBuilderSuite; - private final GraphCache cache; + private final Map cache; private final OptimisticOptimizations optimisticOpts; public HighTierContext(MetaAccessProvider metaAccess, ConstantReflectionProvider constantReflection, LoweringProvider lowerer, Replacements replacements, Assumptions assumptions, - GraphCache cache, PhaseSuite graphBuilderSuite, OptimisticOptimizations optimisticOpts) { + Map cache, PhaseSuite graphBuilderSuite, OptimisticOptimizations optimisticOpts) { super(metaAccess, constantReflection, lowerer, replacements, assumptions); this.cache = cache; this.graphBuilderSuite = graphBuilderSuite; this.optimisticOpts = optimisticOpts; } - public HighTierContext(Providers providers, Assumptions assumptions, GraphCache cache, PhaseSuite graphBuilderSuite, OptimisticOptimizations optimisticOpts) { + public HighTierContext(Providers providers, Assumptions assumptions, Map cache, PhaseSuite graphBuilderSuite, + OptimisticOptimizations optimisticOpts) { this(providers.getMetaAccess(), providers.getConstantReflection(), providers.getLowerer(), providers.getReplacements(), assumptions, cache, graphBuilderSuite, optimisticOpts); } @@ -51,7 +55,7 @@ return graphBuilderSuite; } - public GraphCache getGraphCache() { + public Map getGraphCache() { return cache; } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/util/GraphOrder.java Fri Mar 14 17:19:52 2014 +0100 @@ -26,7 +26,12 @@ import com.oracle.graal.graph.*; import com.oracle.graal.nodes.*; +import com.oracle.graal.nodes.VirtualState.NodeClosure; +import com.oracle.graal.nodes.cfg.*; import com.oracle.graal.phases.graph.*; +import com.oracle.graal.phases.graph.ReentrantBlockIterator.*; +import com.oracle.graal.phases.schedule.*; +import com.oracle.graal.phases.schedule.SchedulePhase.*; public final class GraphOrder { @@ -34,9 +39,9 @@ } /** - * Asserts that there are no (invalid) cycles in the given graph. First, an ordered list of all - * nodes in the graph (a total ordering) is created. A second run over this list checks whether - * inputs are scheduled before their usages. + * Quick (and imprecise) assertion that there are no (invalid) cycles in the given graph. First, + * an ordered list of all nodes in the graph (a total ordering) is created. A second run over + * this list checks whether inputs are scheduled before their usages. * * @param graph the graph to be checked. * @throws AssertionError if a cycle was detected. @@ -62,7 +67,6 @@ } visited.mark(node); } - return true; } @@ -80,34 +84,161 @@ } private static void visitForward(ArrayList nodes, NodeBitMap visited, Node node, boolean floatingOnly) { - if (node != null && !visited.isMarked(node)) { - assert !floatingOnly || !(node instanceof FixedNode) : "unexpected reference to fixed node: " + node + " (this indicates an unexpected cycle)"; - visited.mark(node); - FrameState stateAfter = null; - if (node instanceof StateSplit) { - stateAfter = ((StateSplit) node).stateAfter(); - } - for (Node input : node.inputs()) { - if (input != stateAfter) { - visitForward(nodes, visited, input, true); + try { + assert node.isAlive() : node + " not alive"; + if (node != null && !visited.isMarked(node)) { + if (floatingOnly && node instanceof FixedNode) { + throw new GraalInternalError("unexpected reference to fixed node: %s (this indicates an unexpected cycle)", node); + } + visited.mark(node); + FrameState stateAfter = null; + if (node instanceof StateSplit) { + stateAfter = ((StateSplit) node).stateAfter(); + } + for (Node input : node.inputs()) { + if (input != stateAfter) { + visitForward(nodes, visited, input, true); + } + } + if (node instanceof EndNode) { + EndNode end = (EndNode) node; + for (PhiNode phi : end.merge().phis()) { + visitForward(nodes, visited, phi.valueAt(end), true); + } + } + nodes.add(node); + if (node instanceof MergeNode) { + for (PhiNode phi : ((MergeNode) node).phis()) { + visited.mark(phi); + nodes.add(phi); + } + } + if (stateAfter != null) { + visitForward(nodes, visited, stateAfter, true); } } - if (node instanceof EndNode) { - EndNode end = (EndNode) node; - for (PhiNode phi : end.merge().phis()) { - visitForward(nodes, visited, phi.valueAt(end), true); - } - } - nodes.add(node); - if (node instanceof MergeNode) { - for (PhiNode phi : ((MergeNode) node).phis()) { - visited.mark(phi); - nodes.add(phi); - } - } - if (stateAfter != null) { - visitForward(nodes, visited, stateAfter, true); - } + } catch (GraalInternalError e) { + e.addContext(node); + throw e; } } + + /** + * This method schedules the graph and makes sure that, for every node, all inputs are available + * at the position where it is scheduled. This is a very expensive assertion. + * + * Also, this phase assumes ProxyNodes to exist at LoopExitNodes, so that it cannot be run after + * phases that remove loop proxies or move proxies to BeginNodes. + */ + public static boolean assertSchedulableGraph(final StructuredGraph graph) { + try { + final SchedulePhase schedule = new SchedulePhase(SchedulingStrategy.LATEST_OUT_OF_LOOPS, MemoryScheduling.NONE); + final IdentityHashMap loopEntryStates = new IdentityHashMap<>(); + schedule.apply(graph, false); + + BlockIteratorClosure closure = new BlockIteratorClosure() { + + @Override + protected List processLoop(Loop loop, NodeBitMap initialState) { + return ReentrantBlockIterator.processLoop(this, loop, initialState).exitStates; + } + + @Override + protected NodeBitMap processBlock(final Block block, final NodeBitMap currentState) { + final List list = schedule.getBlockToNodesMap().get(block); + + /* + * A stateAfter is not valid directly after its associated state split, but + * right before the next fixed node. Therefore a pending stateAfter is kept that + * will be checked at the correct position. + */ + FrameState pendingStateAfter = null; + for (final ScheduledNode node : list) { + FrameState stateAfter = node instanceof StateSplit ? ((StateSplit) node).stateAfter() : null; + + if (pendingStateAfter != null && node instanceof FixedNode) { + pendingStateAfter.applyToNonVirtual(new NodeClosure() { + public void apply(Node usage, Node nonVirtualNode) { + assert currentState.isMarked(nonVirtualNode) : nonVirtualNode + " not available at virtualstate " + usage + " before " + node + " in block " + block + " \n" + list; + } + }); + pendingStateAfter = null; + } + + if (node instanceof MergeNode) { + // phis aren't scheduled, so they need to be added explicitly + currentState.markAll(((MergeNode) node).phis()); + if (node instanceof LoopBeginNode) { + // remember the state at the loop entry, it's restored at exits + loopEntryStates.put((LoopBeginNode) node, currentState.copy()); + } + } else if (node instanceof ProxyNode) { + for (Node input : node.inputs()) { + if (input != ((ProxyNode) node).proxyPoint()) { + assert currentState.isMarked(input) : input + " not available at " + node + " in block " + block + "\n" + list; + } + } + } else if (node instanceof LoopExitNode) { + // the contents of the loop are only accessible via proxies at the exit + currentState.clearAll(); + currentState.markAll(loopEntryStates.get(((LoopExitNode) node).loopBegin())); + // Loop proxies aren't scheduled, so they need to be added explicitly + currentState.markAll(((LoopExitNode) node).proxies()); + } else { + for (Node input : node.inputs()) { + if (input != stateAfter) { + assert currentState.isMarked(input) : input + " not available at " + node + " in block " + block + "\n" + list; + } + } + } + if (node instanceof AbstractEndNode) { + MergeNode merge = ((AbstractEndNode) node).merge(); + for (PhiNode phi : merge.phis()) { + assert currentState.isMarked(phi.valueAt((AbstractEndNode) node)) : phi.valueAt((AbstractEndNode) node) + " not available at phi " + phi + " / end " + node + + " in block " + block; + } + } + if (stateAfter != null) { + assert pendingStateAfter == null; + pendingStateAfter = stateAfter; + } + currentState.mark(node); + } + if (pendingStateAfter != null) { + pendingStateAfter.applyToNonVirtual(new NodeClosure() { + public void apply(Node usage, Node nonVirtualNode) { + assert currentState.isMarked(nonVirtualNode) : nonVirtualNode + " not available at virtualstate " + usage + " at end of block " + block + " \n" + list; + } + }); + } + return currentState; + } + + @Override + protected NodeBitMap merge(Block merge, List states) { + NodeBitMap result = states.get(0); + for (int i = 1; i < states.size(); i++) { + result.intersect(states.get(i)); + } + return result; + } + + @Override + protected NodeBitMap getInitialState() { + return graph.createNodeBitMap(); + } + + @Override + protected NodeBitMap cloneState(NodeBitMap oldState) { + return oldState.copy(); + } + }; + + ReentrantBlockIterator.apply(closure, schedule.getCFG().getStartBlock()); + + } catch (Throwable t) { + throw new AssertionError("unschedulable graph", t); + } + return true; + } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Fri Mar 14 17:19:52 2014 +0100 @@ -62,18 +62,13 @@ return isAssignableType(x, metaAccess) && !isNullConstant(y); } - private static boolean isEqualsMethod(StructuredGraph graph) { - Signature signature = graph.method().getSignature(); - return graph.method().getName().equals("equals") && signature.getParameterCount(false) == 1 && signature.getParameterKind(0).equals(Kind.Object); - } - @Override protected boolean verify(StructuredGraph graph, PhaseContext context) { for (ObjectEqualsNode cn : graph.getNodes().filter(ObjectEqualsNode.class)) { - if (!isEqualsMethod(graph)) { - // bail out if we compare an object of type klass with == or != (except null checks) - assert !(checkUsage(cn.x(), cn.y(), context.getMetaAccess()) && checkUsage(cn.y(), cn.x(), context.getMetaAccess())) : "Verification of " + klass.getName() + - " usage failed: Comparing " + cn.x() + " and " + cn.y() + " in " + graph.method() + " must use .equals() for object equality, not '==' or '!='"; + // bail out if we compare an object of type klass with == or != (except null checks) + if (checkUsage(cn.x(), cn.y(), context.getMetaAccess()) && checkUsage(cn.y(), cn.x(), context.getMetaAccess())) { + throw new VerificationError("Verification of " + klass.getName() + " usage failed: Comparing " + cn.x() + " and " + cn.y() + " in " + graph.method() + + " must use .equals() for object equality, not '==' or '!='"); } } return true; diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Fri Mar 14 17:19:52 2014 +0100 @@ -202,7 +202,7 @@ for (Object o : Debug.context()) { JavaMethod method = asJavaMethod(o); if (method != null) { - if (lastMethodOrGraph == null || asJavaMethod(lastMethodOrGraph) != method) { + if (lastMethodOrGraph == null || !asJavaMethod(lastMethodOrGraph).equals(method)) { result.add(MetaUtil.format("%H::%n(%p)", method)); } else { // This prevents multiple adjacent method context objects for the same method diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -452,7 +452,7 @@ for (MethodCallTargetNode callTarget : graph.getNodes(MethodCallTargetNode.class)) { ResolvedJavaMethod callee = callTarget.targetMethod(); - if (callee == recursiveEntry) { + if (callee.equals(recursiveEntry)) { if (isInlinableSnippet(substitutedMethod)) { final StructuredGraph originalGraph = buildInitialGraph(substitutedMethod); InliningUtil.inline(callTarget.invoke(), originalGraph, true); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Fri Mar 14 17:19:52 2014 +0100 @@ -340,7 +340,7 @@ return false; } CacheKey other = (CacheKey) obj; - if (method != other.method) { + if (!method.equals(other.method)) { return false; } if (guardsStage != other.guardsStage || loweringStage != other.loweringStage) { diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StringSubstitutions.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StringSubstitutions.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StringSubstitutions.java Fri Mar 14 17:19:52 2014 +0100 @@ -30,8 +30,6 @@ import com.oracle.graal.graph.*; import com.oracle.graal.replacements.nodes.*; -import edu.umd.cs.findbugs.annotations.SuppressFBWarnings; - /** * Substitutions for {@link java.lang.String} methods. */ @@ -53,7 +51,6 @@ } @MethodSubstitution(isStatic = false) - @SuppressFBWarnings(value = "ES_COMPARING_PARAMETER_STRING_WITH_EQ", justification = "reference equality on the receiver is what we want") public static boolean equals(final String thisString, Object obj) { if (thisString == obj) { return true; diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java --- a/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Fri Mar 14 17:19:52 2014 +0100 @@ -169,7 +169,7 @@ protected void replaceSnippetInvokes(StructuredGraph snippetGraph) { for (MethodCallTargetNode call : snippetGraph.getNodes(MethodCallTargetNode.class)) { Invoke invoke = call.invoke(); - if (call.targetMethod() != getTargetMethod()) { + if (!call.targetMethod().equals(getTargetMethod())) { throw new GraalInternalError("unexpected invoke %s in snippet", getClass().getSimpleName()); } assert invoke.stateAfter().bci == FrameState.AFTER_BCI; diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java --- a/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java Fri Mar 14 17:19:52 2014 +0100 @@ -24,11 +24,9 @@ import com.oracle.graal.api.code.*; import com.oracle.graal.compiler.target.*; -import com.oracle.graal.nodes.spi.*; /** - * A runtime supporting a host backend as well, zero or more additional backends and an optional - * {@linkplain GraphCache graph cache}. + * A runtime supporting a host backend as well, zero or more additional backends. */ public interface RuntimeProvider { @@ -43,9 +41,4 @@ * @param arch a specific architecture class */ Backend getBackend(Class arch); - - /** - * Gets the graph cache (if any) maintained by this runtime. - */ - GraphCache getGraphCache(); } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Fri Mar 14 17:19:52 2014 +0100 @@ -51,7 +51,6 @@ import com.oracle.graal.phases.common.CanonicalizerPhase.CustomCanonicalizer; import com.oracle.graal.phases.tiers.*; import com.oracle.graal.phases.util.*; -import com.oracle.graal.runtime.*; import com.oracle.graal.truffle.nodes.asserts.*; import com.oracle.graal.truffle.nodes.frame.*; import com.oracle.graal.truffle.nodes.frame.NewFrameNode.VirtualOnlyInstanceNode; @@ -71,16 +70,14 @@ private final CanonicalizerPhase canonicalizer; private final GraphBuilderConfiguration config; private Set constantReceivers; - private final GraphCache cache; private final TruffleCache truffleCache; private final ResolvedJavaType frameType; - public PartialEvaluator(RuntimeProvider runtime, Providers providers, TruffleCache truffleCache, GraphBuilderConfiguration config) { + public PartialEvaluator(Providers providers, TruffleCache truffleCache, GraphBuilderConfiguration config) { this.providers = providers; CustomCanonicalizer customCanonicalizer = new PartialEvaluatorCanonicalizer(providers.getMetaAccess(), providers.getConstantReflection()); this.canonicalizer = new CanonicalizerPhase(!ImmutableCode.getValue(), customCanonicalizer); this.config = config; - this.cache = runtime.getGraphCache(); this.truffleCache = truffleCache; this.frameType = providers.getMetaAccess().lookupJavaType(FrameWithoutBoxing.class); try { @@ -142,7 +139,11 @@ } canonicalizer.apply(graph, baseContext); - HighTierContext tierContext = new HighTierContext(providers, assumptions, cache, new PhaseSuite(), OptimisticOptimizations.NONE); + Map graphCache = null; + if (CacheGraphs.getValue()) { + graphCache = new HashMap<>(); + } + HighTierContext tierContext = new HighTierContext(providers, assumptions, graphCache, new PhaseSuite(), OptimisticOptimizations.NONE); for (NeverPartOfCompilationNode neverPartOfCompilationNode : graph.getNodes(NeverPartOfCompilationNode.class)) { Throwable exception = new VerificationError(neverPartOfCompilationNode.getMessage()); @@ -241,7 +242,7 @@ } private boolean isFrame(ValueNode receiver) { - return receiver instanceof NewFrameNode || ObjectStamp.typeOrNull(receiver.stamp()) == frameType; + return receiver instanceof NewFrameNode || Objects.equals(ObjectStamp.typeOrNull(receiver.stamp()), frameType); } private StructuredGraph parseGraph(final ResolvedJavaMethod targetMethod, final NodeInputList arguments, final Assumptions assumptions, final PhaseContext phaseContext) { diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Fri Mar 14 17:19:52 2014 +0100 @@ -247,6 +247,7 @@ private boolean shouldInline(final MethodCallTargetNode methodCallTargetNode) { return (methodCallTargetNode.invokeKind() == InvokeKind.Special || methodCallTargetNode.invokeKind() == InvokeKind.Static) && !Modifier.isNative(methodCallTargetNode.targetMethod().getModifiers()) && methodCallTargetNode.targetMethod().getAnnotation(ExplodeLoop.class) == null && - methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null && methodCallTargetNode.targetMethod().getDeclaringClass() != stringBuilderClass; + methodCallTargetNode.targetMethod().getAnnotation(CompilerDirectives.SlowPath.class) == null && + !methodCallTargetNode.targetMethod().getDeclaringClass().equals(stringBuilderClass); } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Fri Mar 14 17:19:52 2014 +0100 @@ -102,7 +102,7 @@ this.config = GraphBuilderConfiguration.getDefault(); this.config.setSkippedExceptionTypes(skippedExceptionTypes); - this.partialEvaluator = new PartialEvaluator(runtime, providers, truffleCache, config); + this.partialEvaluator = new PartialEvaluator(providers, truffleCache, config); if (Debug.isEnabled()) { DebugEnvironment.initialize(System.out); @@ -136,10 +136,6 @@ private InstalledCode compileMethodImpl(final OptimizedCallTarget compilable) { final StructuredGraph graph; - GraphCache graphCache = runtime.getGraphCache(); - if (graphCache != null) { - graphCache.removeStaleGraphs(); - } if (TraceTruffleCompilation.getValue()) { OptimizedCallTarget.logOptimizingStart(compilable); diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java Fri Mar 14 17:19:52 2014 +0100 @@ -54,7 +54,7 @@ return false; } ReadCacheEntry other = (ReadCacheEntry) obj; - return identity == other.identity && object == other.object; + return identity.equals(other.identity) && object == other.object; } @Override @@ -136,7 +136,7 @@ Iterator> iter = readCache.entrySet().iterator(); while (iter.hasNext()) { Map.Entry entry = iter.next(); - if (entry.getKey().identity == identity) { + if (entry.getKey().identity.equals(identity)) { iter.remove(); } } diff -r 10dde0063f5a -r c4219e527b83 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Thu Mar 13 18:45:17 2014 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Fri Mar 14 17:19:52 2014 +0100 @@ -579,7 +579,7 @@ for (int i = 0; i < objStates.length; i++) { ObjectState obj = objStates[i]; boolean hasIdentity = obj.virtual.hasIdentity() && mergedVirtualObjects.contains(obj.virtual); - if (hasIdentity || firstObj.virtual.type() != obj.virtual.type() || firstObj.virtual.entryCount() != obj.virtual.entryCount() || !firstObj.locksEqual(obj)) { + if (hasIdentity || !firstObj.virtual.type().equals(obj.virtual.type()) || firstObj.virtual.entryCount() != obj.virtual.entryCount() || !firstObj.locksEqual(obj)) { compatible = false; break; } diff -r 10dde0063f5a -r c4219e527b83 hotspot/.cproject --- a/hotspot/.cproject Thu Mar 13 18:45:17 2014 +0100 +++ b/hotspot/.cproject Fri Mar 14 17:19:52 2014 +0100 @@ -44,6 +44,7 @@ +