# HG changeset patch # User Christian Wirth # Date 1394787511 -3600 # Node ID 47b775458982c5d000c4ac9a931f3ae39ceabf76 # Parent 5454f6bf50bfbc48ae1ba92dd6d206928e89cc30# Parent 4c9f24b8f002cd4e3887e47960f90a30821e0e58 Merged diff -r 5454f6bf50bf -r 47b775458982 .hgtags --- a/.hgtags Wed Mar 12 11:23:56 2014 +0100 +++ b/.hgtags Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 CHANGELOG.md --- a/CHANGELOG.md Wed Mar 12 11:23:56 2014 +0100 +++ b/CHANGELOG.md Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 THIRD_PARTY_README --- a/THIRD_PARTY_README Wed Mar 12 11:23:56 2014 +0100 +++ b/THIRD_PARTY_README Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/make/Makefile --- a/agent/make/Makefile Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/make/Makefile Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/make/mkinstall --- a/agent/make/mkinstall Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/make/mkinstall Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/make/saenv.sh --- a/agent/make/saenv.sh Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/make/saenv.sh Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/make/saenv64.sh --- a/agent/make/saenv64.sh Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/make/saenv64.sh Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/os/linux/libproc.h --- a/agent/src/os/linux/libproc.h Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/os/linux/libproc.h Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/os/linux/libproc_impl.c --- a/agent/src/os/linux/libproc_impl.c Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/os/linux/libproc_impl.c Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/os/linux/salibelf.c --- a/agent/src/os/linux/salibelf.c Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/os/linux/salibelf.c Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/os/linux/symtab.c --- a/agent/src/os/linux/symtab.c Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/os/linux/symtab.c Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/os/solaris/proc/saproc.cpp --- a/agent/src/os/solaris/proc/saproc.cpp Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/os/solaris/proc/saproc.cpp Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/os/win32/windbg/sawindbg.cpp --- a/agent/src/os/win32/windbg/sawindbg.cpp Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/os/win32/windbg/sawindbg.cpp Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java --- a/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/CLHSDB.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java --- a/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/CommandProcessor.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/HSDB.java --- a/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/HSDB.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java --- a/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/LinuxVtblAccess.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java --- a/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/asm/Disassembler.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java --- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciEnv.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java --- a/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/ci/ciMethod.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java --- a/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/code/NMethod.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java --- a/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/compiler/CompileTask.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdAddress.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/bsd/BsdDebugger.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxAddress.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxCDebugger.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxDebuggerLocal.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/LinuxOopHandle.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/amd64/LinuxAMD64CFrame.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/linux/x86/LinuxX86CFrame.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgCDebugger.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java --- a/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windbg/WindbgDebuggerLocal.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/amd64/WindowsAMD64CFrame.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/debugger/windows/x86/WindowsX86CFrame.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ArrayTypeImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ClassTypeImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/InterfaceTypeImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/JVMTIThreadState.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java --- a/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/jdi/ReferenceTypeImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CMSCollector.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java --- a/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/CompactibleFreeListSpace.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java --- a/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/memory/SymbolTable.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ArrayKlass.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ConstantPool.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/InstanceKlass.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/Klass.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/MethodCounters.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/MethodData.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java --- a/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/oops/ObjectHeap.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/opto/Block.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Block.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/Compile.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/InlineTree.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/JVMState.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java --- a/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/opto/PhaseCFG.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/ThreadLocalAllocBuffer.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java --- a/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/VM.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/runtime/bsd_amd64/BsdAMD64JavaThreadPDAccess.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/ClassLoaderStats.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FinalizerInfo.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/FlagDumper.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapDumper.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/HeapSummary.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JInfo.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JSnap.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/JStack.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/ObjectHistogram.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/PMap.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/StackTrace.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/SysPropsDumper.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/Tool.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/jcore/ByteCodeRewriter.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/soql/JSDB.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java --- a/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/tools/soql/SOQL.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java --- a/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/types/basic/BasicTypeDataBase.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java --- a/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/ui/SAPanel.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/AbstractHeapGraphWriter.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/Hashtable.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapGXLWriter.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/HeapHprofBinWriter.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/JSJavaInstanceKlass.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js --- a/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Wed Mar 12 11:23:56 2014 +0100 +++ b/agent/src/share/classes/sun/jvm/hotspot/utilities/soql/sa.js Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java --- a/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.alloc/src/com/oracle/graal/alloc/ComputeBlockOrder.java Fri Mar 14 09:58:31 2014 +0100 @@ -113,9 +113,8 @@ /** * Initializes the priority queue used for the work list of blocks and adds the start block. */ - @SuppressWarnings("unchecked") private static > PriorityQueue initializeWorklist(T startBlock, BitSet visitedBlocks, NodesToDoubles nodeProbabilities) { - PriorityQueue result = new PriorityQueue<>(INITIAL_WORKLIST_CAPACITY, new BlockOrderComparator(nodeProbabilities)); + PriorityQueue result = new PriorityQueue<>(INITIAL_WORKLIST_CAPACITY, new BlockOrderComparator(nodeProbabilities)); result.add(startBlock); visitedBlocks.set(startBlock.getId()); return result; @@ -233,14 +232,14 @@ * Skip the loop header block if the loop consists of more than one block and it has only a * single loop end block. */ - private static boolean skipLoopHeader(AbstractBlock block) { + private static boolean skipLoopHeader(AbstractBlock block) { return (block.isLoopHeader() && !block.isLoopEnd() && block.getLoop().loopBegin().loopEnds().count() == 1); } /** * Checks that the ordering contains the expected number of blocks. */ - private static boolean checkOrder(List order, int expectedBlockCount) { + private static boolean checkOrder(List> order, int expectedBlockCount) { assert order.size() == expectedBlockCount : String.format("Number of blocks in ordering (%d) does not match expected block count (%d)", order.size(), expectedBlockCount); return true; } diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Assumptions.java Fri Mar 14 09:58:31 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; } @@ -197,9 +197,9 @@ @Override public boolean equals(Object obj) { - if (obj instanceof ConcreteMethod) { - ConcreteMethod other = (ConcreteMethod) obj; - return other.method == method; + if (obj instanceof MethodContents) { + MethodContents other = (MethodContents) obj; + return other.method.equals(method); } return false; } @@ -387,7 +387,7 @@ } } - out.printf("%d assumptions:\n", nonNullList.size()); + out.printf("%d assumptions:%n", nonNullList.size()); for (Assumption a : nonNullList) { out.println(a.toString()); } diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/DebugInfo.java Fri Mar 14 09:58:31 2014 +0100 @@ -22,8 +22,6 @@ */ package com.oracle.graal.api.code; -import java.io.*; - /** * Represents the debugging information for a particular point of execution. This information * includes: @@ -35,9 +33,7 @@ *
  • a map from the registers (in the caller's frame) to the slots where they are saved in the * current frame
  • */ -public class DebugInfo implements Serializable { - - private static final long serialVersionUID = -6047206624915812516L; +public class DebugInfo { private final BytecodePosition bytecodePosition; private final ReferenceMap referenceMap; diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/Register.java Fri Mar 14 09:58:31 2014 +0100 @@ -22,16 +22,12 @@ */ package com.oracle.graal.api.code; -import java.io.*; - import com.oracle.graal.api.meta.*; /** * Represents a target machine register. */ -public final class Register implements Comparable, Serializable { - - private static final long serialVersionUID = -7213269157816016300L; +public final class Register implements Comparable { public static final RegisterCategory SPECIAL = new RegisterCategory("SPECIAL"); diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/VirtualObject.java Fri Mar 14 09:58:31 2014 +0100 @@ -87,7 +87,7 @@ } } else { ResolvedJavaField[] fields = vo.type.getInstanceFields(true); - assert fields.length == vo.values.length : vo.type + ", fields=" + Arrays.toString(fields) + ", values=" + vo.values; + assert fields.length == vo.values.length : vo.type + ", fields=" + Arrays.toString(fields) + ", values=" + Arrays.toString(vo.values); for (int i = 0; i < vo.values.length; i++) { if (i != 0) { buf.append(','); @@ -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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractJavaProfile.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractJavaProfile.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/AbstractJavaProfile.java Fri Mar 14 09:58:31 2014 +0100 @@ -43,7 +43,7 @@ public AbstractJavaProfile(double notRecordedProbability, T[] pitems) { this.pitems = pitems; - assert notRecordedProbability != Double.NaN; + assert !Double.isNaN(notRecordedProbability); this.notRecordedProbability = notRecordedProbability; assert isSorted(); } @@ -124,28 +124,26 @@ } @Override - public boolean equals(Object other) { - if (other == this) { + public boolean equals(Object obj) { + if (obj == this) { return true; } - if (getClass() == other.getClass()) { - AbstractJavaProfile javaTypeProfile = (AbstractJavaProfile) other; - if (javaTypeProfile.notRecordedProbability != notRecordedProbability) { + if (!(obj instanceof AbstractJavaProfile)) { + return false; + } + AbstractJavaProfile that = (AbstractJavaProfile) obj; + if (that.notRecordedProbability != notRecordedProbability) { + return false; + } + if (that.pitems.length != pitems.length) { + return false; + } + for (int i = 0; i < pitems.length; ++i) { + if (!pitems[i].equals(that.pitems[i])) { return false; } - if (javaTypeProfile.pitems.length != pitems.length) { - return false; - } - - for (int i = 0; i < pitems.length; ++i) { - if (!pitems[i].equals(javaTypeProfile.pitems[i])) { - return false; - } - } - - return true; } - return false; + return true; } @Override diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ExceptionHandler.java Fri Mar 14 09:58:31 2014 +0100 @@ -22,6 +22,8 @@ */ package com.oracle.graal.api.meta; +import java.util.*; + /** * Represents an exception handler within the bytecodes. */ @@ -97,14 +99,14 @@ @Override public boolean equals(Object obj) { + if (!(obj instanceof ExceptionHandler)) { + return false; + } ExceptionHandler that = (ExceptionHandler) obj; 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/ResolvedJavaMethod.java Fri Mar 14 09:58:31 2014 +0100 @@ -185,6 +185,9 @@ */ boolean canBeInlined(); + /** + * Returns {@code true} if the inlining of this method should be forced. + */ boolean shouldBeInlined(); /** diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java --- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Value.java Fri Mar 14 09:58:31 2014 +0100 @@ -87,8 +87,8 @@ @Override public boolean equals(Object obj) { if (obj instanceof Value) { - Value other = (Value) obj; - return kind.equals(other.kind) && platformKind.equals(platformKind); + Value that = (Value) obj; + return kind.equals(that.kind) && platformKind.equals(that.platformKind); } return false; } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java --- a/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.asm.ptx/src/com/oracle/graal/asm/ptx/PTXAssembler.java Fri Mar 14 09:58:31 2014 +0100 @@ -698,9 +698,6 @@ @Override public void jmp(Label l) { String str = nameOf(l); - if (l.equals("?")) { - Thread.dumpStack(); - } bra(str); } diff -r 5454f6bf50bf -r 47b775458982 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 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/GraalCompiler.java Fri Mar 14 09:58:31 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(); @@ -294,7 +283,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.lir, installedCodeOwner); @@ -302,7 +291,6 @@ if (!assumptions.isEmpty()) { compilationResult.setAssumptions(assumptions); } - compilationResult.setLeafGraphIds(leafGraphIds); if (Debug.isMeterEnabled()) { List ldp = compilationResult.getDataReferences(); diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScan.java Fri Mar 14 09:58:31 2014 +0100 @@ -104,7 +104,7 @@ /** * List of blocks in linear-scan order. This is only correct as long as the CFG does not change. */ - final List sortedBlocks; + final List> sortedBlocks; /** * Map from {@linkplain #operandNumber(Value) operand numbers} to intervals. @@ -139,7 +139,7 @@ * containing the instruction. Entries should be retrieved with {@link #blockForId(int)} as the * id is not simply an index into this array. */ - Block[] opIdToBlockMap; + AbstractBlock[] opIdToBlockMap; /** * Bit set for each variable that is contained in each loop. @@ -171,13 +171,13 @@ this.blockData = new BlockMap<>(ir.getControlFlowGraph()); } - public int getFirstLirInstructionId(Block block) { + public int getFirstLirInstructionId(AbstractBlock block) { int result = ir.lir(block).get(0).id(); assert result >= 0; return result; } - public int getLastLirInstructionId(Block block) { + public int getLastLirInstructionId(AbstractBlock block) { List instructions = ir.lir(block); int result = instructions.get(instructions.size() - 1).id(); assert result >= 0; @@ -321,7 +321,7 @@ return sortedBlocks.size(); } - Block blockAt(int index) { + AbstractBlock blockAt(int index) { return sortedBlocks.get(index); } @@ -393,7 +393,7 @@ * @param opId an instruction {@linkplain LIRInstruction#id id} * @return the block containing the instruction denoted by {@code opId} */ - Block blockForId(int opId) { + AbstractBlock blockForId(int opId) { assert opIdToBlockMap.length > 0 && opId >= 0 && opId <= maxOpId() + 1 : "opId out of range"; return opIdToBlockMap[opIdToIndex(opId)]; } @@ -516,7 +516,7 @@ } LIRInsertionBuffer insertionBuffer = new LIRInsertionBuffer(); - for (Block block : sortedBlocks) { + for (AbstractBlock block : sortedBlocks) { List instructions = ir.lir(block); int numInst = instructions.size(); @@ -623,7 +623,7 @@ // Assign IDs to LIR nodes and build a mapping, lirOps, from ID to LIRInstruction node. int numInstructions = 0; - for (Block block : sortedBlocks) { + for (AbstractBlock block : sortedBlocks) { numInstructions += ir.lir(block).size(); } @@ -633,7 +633,7 @@ int opId = 0; int index = 0; - for (Block block : sortedBlocks) { + for (AbstractBlock block : sortedBlocks) { blockData.put(block, new BlockData()); List instructions = ir.lir(block); @@ -675,7 +675,7 @@ intervalInLoop = new BitMap2D(operandSize(), numLoops()); // iterate all blocks - for (final Block block : sortedBlocks) { + for (final AbstractBlock block : sortedBlocks) { Indent indent = Debug.logAndIndent("compute local live sets for block %d", block.getId()); final BitSet liveGen = new BitSet(liveSize); @@ -779,7 +779,7 @@ } } - private void verifyInput(Block block, BitSet liveKill, Value operand) { + private void verifyInput(AbstractBlock block, BitSet liveKill, Value operand) { // fixed intervals are never live at block boundaries, so // they need not be processed in live sets. // this is checked by these assertions to be sure about it. @@ -813,7 +813,7 @@ // iterate all blocks in reverse order for (int i = numBlocks - 1; i >= 0; i--) { - Block block = blockAt(i); + AbstractBlock block = blockAt(i); BlockData blockSets = blockData.get(block); changeOccurredInBlock = false; @@ -824,7 +824,7 @@ // block has successors if (n > 0) { liveOut.clear(); - for (Block successor : block.getSuccessors()) { + for (AbstractBlock successor : block.getSuccessors()) { liveOut.or(blockData.get(successor).liveIn); } } else { @@ -914,9 +914,9 @@ Value operand = operandFor(operandNum); final Indent indent2 = Debug.logAndIndent("---- Detailed information for var %d; operand=%s; node=%s ----", operandNum, operand, getValueForOperandFromDebugContext(operand)); - Deque definedIn = new ArrayDeque<>(); - HashSet usedIn = new HashSet<>(); - for (Block block : sortedBlocks) { + Deque> definedIn = new ArrayDeque<>(); + HashSet> usedIn = new HashSet<>(); + for (AbstractBlock block : sortedBlocks) { if (blockData.get(block).liveGen.get(operandNum)) { usedIn.add(block); try (Indent indent3 = Debug.logAndIndent("used in block B%d", block.getId())) { @@ -947,9 +947,9 @@ int[] hitCount = new int[numBlocks]; while (!definedIn.isEmpty()) { - Block block = definedIn.removeFirst(); + AbstractBlock block = definedIn.removeFirst(); usedIn.remove(block); - for (Block successor : block.getSuccessors()) { + for (AbstractBlock successor : block.getSuccessors()) { if (successor.isLoopHeader()) { if (!block.isLoopEnd()) { definedIn.add(successor); @@ -962,7 +962,7 @@ } } try (Indent indent3 = Debug.logAndIndent("**** offending usages are in: ")) { - for (Block block : usedIn) { + for (AbstractBlock block : usedIn) { Debug.log("B%d", block.getId()); } } @@ -975,7 +975,7 @@ private void verifyLiveness() { // check that fixed intervals are not live at block boundaries // (live set must be empty at fixed intervals) - for (Block block : sortedBlocks) { + for (AbstractBlock block : sortedBlocks) { for (int j = 0; j <= maxRegisterNumber(); j++) { assert !blockData.get(block).liveIn.get(j) : "liveIn set of fixed register must be empty"; assert !blockData.get(block).liveOut.get(j) : "liveOut set of fixed register must be empty"; @@ -1158,7 +1158,7 @@ // iterate all blocks in reverse order for (int i = blockCount() - 1; i >= 0; i--) { - Block block = blockAt(i); + AbstractBlock block = blockAt(i); Indent indent2 = Debug.logAndIndent("handle block %d", block.getId()); List instructions = ir.lir(block); @@ -1463,14 +1463,14 @@ throw new BailoutException("LinearScan: interval is null"); } - Interval intervalAtBlockBegin(Block block, Value operand) { + Interval intervalAtBlockBegin(AbstractBlock block, Value operand) { assert isVariable(operand) : "register number out of bounds"; assert intervalFor(operand) != null : "no interval found"; return splitChildAtOpId(intervalFor(operand), getFirstLirInstructionId(block), LIRInstruction.OperandMode.DEF); } - Interval intervalAtBlockEnd(Block block, Value operand) { + Interval intervalAtBlockEnd(AbstractBlock block, Value operand) { assert isVariable(operand) : "register number out of bounds"; assert intervalFor(operand) != null : "no interval found"; @@ -1484,7 +1484,7 @@ return splitChildAtOpId(intervalFor(operand), opId, LIRInstruction.OperandMode.USE); } - void resolveCollectMappings(Block fromBlock, Block toBlock, MoveResolver moveResolver) { + void resolveCollectMappings(AbstractBlock fromBlock, AbstractBlock toBlock, MoveResolver moveResolver) { assert moveResolver.checkEmpty(); int numOperands = operandSize(); @@ -1506,7 +1506,7 @@ } } - void resolveFindInsertPos(Block fromBlock, Block toBlock, MoveResolver moveResolver) { + void resolveFindInsertPos(AbstractBlock fromBlock, AbstractBlock toBlock, MoveResolver moveResolver) { if (fromBlock.getSuccessorCount() <= 1) { Debug.log("inserting moves at end of fromBlock B%d", fromBlock.getId()); @@ -1529,7 +1529,7 @@ // successor edges, blocks which are reached by switch statements // may have be more than one predecessor but it will be guaranteed // that all predecessors will be the same. - for (Block predecessor : toBlock.getPredecessors()) { + for (AbstractBlock predecessor : toBlock.getPredecessors()) { assert fromBlock == predecessor : "all critical edges must be broken"; } } @@ -1550,7 +1550,7 @@ BitSet blockCompleted = new BitSet(numBlocks); BitSet alreadyResolved = new BitSet(numBlocks); - for (Block block : sortedBlocks) { + for (AbstractBlock block : sortedBlocks) { // check if block has only one predecessor and only one successor if (block.getPredecessorCount() == 1 && block.getSuccessorCount() == 1) { @@ -1560,8 +1560,8 @@ // check if block is empty (only label and branch) if (instructions.size() == 2) { - Block pred = block.getFirstPredecessor(); - Block sux = block.getFirstSuccessor(); + AbstractBlock pred = block.getPredecessors().iterator().next(); + AbstractBlock sux = block.getSuccessors().iterator().next(); // prevent optimization of two consecutive blocks if (!blockCompleted.get(pred.getLinearScanNumber()) && !blockCompleted.get(sux.getLinearScanNumber())) { @@ -1581,12 +1581,12 @@ } } - for (Block fromBlock : sortedBlocks) { + for (AbstractBlock fromBlock : sortedBlocks) { if (!blockCompleted.get(fromBlock.getLinearScanNumber())) { alreadyResolved.clear(); alreadyResolved.or(blockCompleted); - for (Block toBlock : fromBlock.getSuccessors()) { + for (AbstractBlock toBlock : fromBlock.getSuccessors()) { // check for duplicate edges between the same blocks (can happen with switch // blocks) @@ -1630,7 +1630,7 @@ if (opId != -1) { if (DetailedAsserts.getValue()) { - Block block = blockForId(opId); + AbstractBlock block = blockForId(opId); if (block.getSuccessorCount() <= 1 && opId == getLastLirInstructionId(block)) { // check if spill moves could have been appended at the end of this block, but // before the branch instruction. So the split child information for this branch @@ -1744,7 +1744,7 @@ public Value doValue(Value operand) { int tempOpId = op.id(); OperandMode mode = OperandMode.USE; - Block block = blockForId(tempOpId); + AbstractBlock block = blockForId(tempOpId); if (block.getSuccessorCount() == 1 && tempOpId == getLastLirInstructionId(block)) { // generating debug information for the last instruction of a block. // if this instruction is a branch, spill moves are inserted before this branch @@ -1755,7 +1755,7 @@ final LIRInstruction instr = ir.lir(block).get(ir.lir(block).size() - 1); if (instr instanceof StandardOp.JumpOp) { if (blockData.get(block).liveOut.get(operandNumber(operand))) { - tempOpId = getFirstLirInstructionId(block.getFirstSuccessor()); + tempOpId = getFirstLirInstructionId(block.getSuccessors().iterator().next()); mode = OperandMode.DEF; } } @@ -1844,7 +1844,7 @@ private void assignLocations() { IntervalWalker iw = initIntervalWalker(IS_STACK_INTERVAL); try (Indent indent = Debug.logAndIndent("assign locations")) { - for (Block block : sortedBlocks) { + for (AbstractBlock block : sortedBlocks) { try (Indent indent2 = Debug.logAndIndent("assign locations in block B%d", block.getId())) { assignLocations(ir.lir(block), iw); } @@ -1921,7 +1921,7 @@ try (Indent indent2 = Debug.logAndIndent("Basic Blocks")) { for (int i = 0; i < blockCount(); i++) { - Block block = blockAt(i); + AbstractBlock block = blockAt(i); Debug.log("B%d [%d, %d, %s] ", block.getId(), getFirstLirInstructionId(block), getLastLirInstructionId(block), block.getLoop()); } } @@ -2059,7 +2059,7 @@ otherIntervals.addRange(Integer.MAX_VALUE - 2, Integer.MAX_VALUE - 1); IntervalWalker iw = new IntervalWalker(this, fixedIntervals, otherIntervals); - for (Block block : sortedBlocks) { + for (AbstractBlock block : sortedBlocks) { List instructions = ir.lir(block); for (int j = 0; j < instructions.size(); j++) { @@ -2097,7 +2097,7 @@ void verifyConstants() { try (Indent indent = Debug.logAndIndent("verifying that unpinned constants are not alive across block boundaries")) { - for (Block block : sortedBlocks) { + for (AbstractBlock block : sortedBlocks) { BitSet liveAtEdge = blockData.get(block).liveIn; // visit all operands where the liveAtEdge bit is set diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/LinearScanWalker.java Fri Mar 14 09:58:31 2014 +0100 @@ -25,6 +25,7 @@ import static com.oracle.graal.api.code.CodeUtil.*; import static com.oracle.graal.api.code.ValueUtil.*; import static com.oracle.graal.lir.LIRValueUtil.*; + import java.util.*; import com.oracle.graal.api.code.*; @@ -57,11 +58,11 @@ return allocator.blockCount(); } - Block blockAt(int idx) { + AbstractBlock blockAt(int idx) { return allocator.blockAt(idx); } - Block blockOfOpWithId(int opId) { + AbstractBlock blockOfOpWithId(int opId) { return allocator.blockForId(opId); } @@ -235,7 +236,7 @@ // optimized away later in assignRegNums int opId = (operandId + 1) & ~1; - Block opBlock = allocator.blockForId(opId); + AbstractBlock opBlock = allocator.blockForId(opId); assert opId > 0 && allocator.blockForId(opId - 2) == opBlock : "cannot insert move at block boundary"; // calculate index of instruction inside instruction list of current block @@ -259,7 +260,7 @@ moveResolver.addMapping(srcIt, dstIt); } - int findOptimalSplitPos(Block minBlock, Block maxBlock, int maxSplitPos) { + int findOptimalSplitPos(AbstractBlock minBlock, AbstractBlock maxBlock, int maxSplitPos) { int fromBlockNr = minBlock.getLinearScanNumber(); int toBlockNr = maxBlock.getLinearScanNumber(); @@ -276,7 +277,7 @@ int minLoopDepth = maxBlock.getLoopDepth(); for (int i = toBlockNr - 1; i >= fromBlockNr; i--) { - Block cur = blockAt(i); + AbstractBlock cur = blockAt(i); if (cur.getLoopDepth() < minLoopDepth) { // block with lower loop-depth found . split at the end of this block @@ -304,13 +305,13 @@ // beginning of a block, then minSplitPos is also a possible split position. // Use the block before as minBlock, because then minBlock.lastLirInstructionId() + 2 == // minSplitPos - Block minBlock = allocator.blockForId(minSplitPos - 1); + AbstractBlock minBlock = allocator.blockForId(minSplitPos - 1); // reason for using maxSplitPos - 1: otherwise there would be an assert on failure // when an interval ends at the end of the last block of the method // (in this case, maxSplitPos == allocator().maxLirOpId() + 2, and there is no // block at this opId) - Block maxBlock = allocator.blockForId(maxSplitPos - 1); + AbstractBlock maxBlock = allocator.blockForId(maxSplitPos - 1); assert minBlock.getLinearScanNumber() <= maxBlock.getLinearScanNumber() : "invalid order"; if (minBlock == maxBlock) { @@ -348,7 +349,7 @@ // Desired result: uses tagged as shouldHaveRegister inside a loop cause // a reloading // of the interval (normally, only mustHaveRegister causes a reloading) - Block loopBlock = allocator.blockForId(loopEndPos); + AbstractBlock loopBlock = allocator.blockForId(loopEndPos); Debug.log("interval is used in loop that ends in block B%d, so trying to move maxBlock back from B%d to B%d", loopBlock.getId(), maxBlock.getId(), loopBlock.getId()); assert loopBlock != minBlock : "loopBlock and minBlock must be different because block boundary is needed between"; @@ -412,8 +413,8 @@ Debug.log("splitting at position %d", optimalSplitPos); - assert allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 1) : "split pos must be odd when not on block boundary"; - assert !allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 0) : "split pos must be even on block boundary"; + assert allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 1) : "split pos must be odd when not on block boundary"; + assert !allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 0) : "split pos must be even on block boundary"; Interval splitPart = interval.split(optimalSplitPos, allocator); @@ -492,8 +493,8 @@ } try (Indent indent2 = Debug.logAndIndent("splitting at position %d", optimalSplitPos)) { - assert allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 1) : "split pos must be odd when not on block boundary"; - assert !allocator.isBlockBegin(optimalSplitPos) || (optimalSplitPos % 2 == 0) : "split pos must be even on block boundary"; + assert allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 1) : "split pos must be odd when not on block boundary"; + assert !allocator.isBlockBegin(optimalSplitPos) || ((optimalSplitPos & 1) == 0) : "split pos must be even on block boundary"; Interval spilledPart = interval.split(optimalSplitPos, allocator); allocator.assignSpillSlot(spilledPart); diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java --- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/alloc/RegisterVerifier.java Fri Mar 14 09:58:31 2014 +0100 @@ -23,6 +23,7 @@ package com.oracle.graal.compiler.alloc; import static com.oracle.graal.api.code.ValueUtil.*; + import java.util.*; import com.oracle.graal.api.code.*; @@ -39,7 +40,7 @@ final class RegisterVerifier { LinearScan allocator; - List workList; // all blocks that must be processed + List> workList; // all blocks that must be processed ArrayMap savedStates; // saved information of previous check // simplified access to methods of LinearScan @@ -53,15 +54,15 @@ } // accessors - Interval[] stateForBlock(Block block) { + Interval[] stateForBlock(AbstractBlock block) { return savedStates.get(block.getId()); } - void setStateForBlock(Block block, Interval[] savedState) { + void setStateForBlock(AbstractBlock block, Interval[] savedState) { savedStates.put(block.getId(), savedState); } - void addToWorkList(Block block) { + void addToWorkList(AbstractBlock block) { if (!workList.contains(block)) { workList.add(block); } @@ -74,7 +75,7 @@ } - void verify(Block start) { + void verify(AbstractBlock start) { // setup input registers (method arguments) for first block Interval[] inputState = new Interval[stateSize()]; setStateForBlock(start, inputState); @@ -82,14 +83,14 @@ // main loop for verification do { - Block block = workList.get(0); + AbstractBlock block = workList.get(0); workList.remove(0); processBlock(block); } while (!workList.isEmpty()); } - private void processBlock(Block block) { + private void processBlock(AbstractBlock block) { try (Indent indent = Debug.logAndIndent("processBlock B%d", block.getId())) { // must copy state because it is modified Interval[] inputState = copy(stateForBlock(block)); @@ -108,13 +109,13 @@ processOperations(allocator.ir.lir(block), inputState); // iterate all successors - for (Block succ : block.getSuccessors()) { + for (AbstractBlock succ : block.getSuccessors()) { processSuccessor(succ, inputState); } } } - private void processSuccessor(Block block, Interval[] inputState) { + private void processSuccessor(AbstractBlock block, Interval[] inputState) { Interval[] savedState = stateForBlock(block); if (savedState != null) { diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/gen/DebugInfoBuilder.java Fri Mar 14 09:58:31 2014 +0100 @@ -56,9 +56,6 @@ FrameState current = topState; do { for (EscapeObjectState state : current.virtualObjectMappings()) { - if (objectStates == null) { - objectStates = new IdentityHashMap<>(); - } if (!objectStates.containsKey(state.object())) { if (!(state instanceof MaterializedObjectState) || ((MaterializedObjectState) state).materializedValue() != state.object()) { objectStates.put(state.object(), state); diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramAsciiPrinter.java --- a/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramAsciiPrinter.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugHistogramAsciiPrinter.java Fri Mar 14 09:58:31 2014 +0100 @@ -62,7 +62,7 @@ public void print(DebugHistogram histogram) { List list = histogram.getValues(); if (list.isEmpty()) { - os.printf("%s is empty.\n", histogram.getName()); + os.printf("%s is empty.%n", histogram.getName()); return; } @@ -73,7 +73,7 @@ } // Print header. - os.printf("%s has %d unique elements and %d total elements:\n", histogram.getName(), list.size(), total); + os.printf("%s has %d unique elements and %d total elements:%n", histogram.getName(), list.size(), total); int max = list.get(0).getCount(); final int lineSize = nameSize + NumberSize + barSize + 10; @@ -96,6 +96,6 @@ private static void printLine(PrintStream printStream, char c, int lineSize) { char[] charArr = new char[lineSize]; Arrays.fill(charArr, c); - printStream.printf("%s\n", new String(charArr)); + printStream.printf("%s%n", new String(charArr)); } } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/Node.java Fri Mar 14 09:58:31 2014 +0100 @@ -535,18 +535,22 @@ } private void maybeNotifyChanged(Node usage) { - assert graph == null || !graph.isFrozen(); - NodeChangedListener listener = graph.inputChangedListener; - if (listener != null) { - listener.nodeChanged(usage); + if (graph != null) { + assert !graph.isFrozen(); + NodeChangedListener listener = graph.inputChangedListener; + if (listener != null) { + listener.nodeChanged(usage); + } } } private void maybeNotifyZeroInputs(Node oldInput) { - assert graph == null || !graph.isFrozen(); - NodeChangedListener listener = graph.usagesDroppedToZeroListener; - if (listener != null) { - listener.nodeChanged(oldInput); + if (graph != null) { + assert !graph.isFrozen(); + NodeChangedListener listener = graph.usagesDroppedToZeroListener; + if (listener != null) { + listener.nodeChanged(oldInput); + } } } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java --- a/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.graph/src/com/oracle/graal/graph/NodeClass.java Fri Mar 14 09:58:31 2014 +0100 @@ -970,8 +970,8 @@ int index = startIndex; while (index < inputOffsets.length) { NodeList list = getNodeList(node, inputOffsets[index]); + assert list != null : clazz; putNodeList(node, inputOffsets[index], updateInputListCopy(list, node, duplicationReplacement)); - assert list != null : clazz; index++; } } @@ -980,8 +980,8 @@ int index = startIndex; while (index < successorOffsets.length) { NodeList list = getNodeList(node, successorOffsets[index]); + assert list != null : clazz; putNodeList(node, successorOffsets[index], updateSuccListCopy(list, node, duplicationReplacement)); - assert list != null : clazz; index++; } } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java --- a/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.hsail/src/com/oracle/graal/hotspot/hsail/ForEachToGraal.java Fri Mar 14 09:58:31 2014 +0100 @@ -82,13 +82,13 @@ NodeIterable calls = graph.getNodes(MethodCallTargetNode.class); assert calls.count() == 1; ResolvedJavaMethod lambdaMethod = calls.first().targetMethod(); - assert lambdaMethod.getName().startsWith("lambda$"); Debug.log("target ... " + lambdaMethod); if (lambdaMethod == null) { Debug.log("Did not find call in accept()"); return null; } + assert lambdaMethod.getName().startsWith("lambda$"); ExternalCompilationResult hsailCode = backend.compileKernel(lambdaMethod, true); return backend.installKernel(lambdaMethod, hsailCode); diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot.ptx/src/com/oracle/graal/hotspot/ptx/PTXHotSpotBackend.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/CompilationTask.java Fri Mar 14 09:58:31 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.*; @@ -130,9 +131,6 @@ try { runCompilation(true); } finally { - if (method.currentTask() == this) { - method.setCurrentTask(null); - } withinEnqueue.set(Boolean.TRUE); status.set(CompilationStatus.Finished); synchronized (this) { @@ -237,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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotBackend.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotGraalRuntime.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotHostBackend.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotReplacementsImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Fri Mar 14 09:58:31 2014 +0100 @@ -60,8 +60,19 @@ } HotSpotVMConfig(CompilerToVM compilerToVm) { + /** These fields are set in {@link CompilerToVM#initializeConfiguration}. */ + gHotSpotVMStructs = 0; + gHotSpotVMTypes = 0; + gHotSpotVMIntConstants = 0; + gHotSpotVMLongConstants = 0; + compilerToVm.initializeConfiguration(this); + assert gHotSpotVMStructs != 0; + assert gHotSpotVMTypes != 0; + assert gHotSpotVMIntConstants != 0; + assert gHotSpotVMLongConstants != 0; + // Fill the VM fields hash map. HashMap vmFields = new HashMap<>(); for (VMFields.Field e : new VMFields(gHotSpotVMStructs)) { diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/VMToCompilerImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/debug/BenchmarkCounters.java diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotConstantPool.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotForeignCallsProviderImpl.java Fri Mar 14 09:58:31 2014 +0100 @@ -134,8 +134,8 @@ public static final LocationIdentity[] NO_LOCATIONS = {}; public HotSpotForeignCallLinkage lookupForeignCall(ForeignCallDescriptor descriptor) { + assert foreignCalls != null : descriptor; HotSpotForeignCallLinkage callTarget = foreignCalls.get(descriptor); - assert foreignCalls != null : descriptor; callTarget.finalizeAddress(runtime.getHostBackend()); return callTarget; } diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +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.*; - -/** - * 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 - public StructuredGraph get(ResolvedJavaMethod method) { - StructuredGraph result = (StructuredGraph) method.getCompilerStorage().get(this); - - if (PrintGraphCache.getValue()) { - if (result == null) { - missCounter++; - } else { - hitCounter++; - } - } - return result; - } - - @Override - 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; - } - } - - 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotMetaAccessProvider.java Fri Mar 14 09:58:31 2014 +0100 @@ -120,8 +120,7 @@ HotSpotResolvedObjectType resolved = (HotSpotResolvedObjectType) holder; return resolved.createField(name, type, offset, modifiers); } else { - // TODO this cast will not succeed - return (ResolvedJavaField) new HotSpotUnresolvedField(holder, name, type); + throw GraalInternalError.shouldNotReachHere("unresolved field " + reflectionField); } } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotNmethod.java Fri Mar 14 09:58:31 2014 +0100 @@ -84,7 +84,7 @@ @Override public String toString() { - return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b, name=]", method, getCodeBlob(), isDefault, name); + return String.format("InstalledNmethod[method=%s, codeBlob=0x%x, isDefault=%b, name=%s]", method, getCodeBlob(), isDefault, name); } @Override diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaField.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaMethod.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedObjectType.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedPrimitiveType.java Fri Mar 14 09:58:31 2014 +0100 @@ -70,7 +70,10 @@ @Override public ResolvedJavaType getArrayClass() { - Class javaArrayMirror = kind == Kind.Void ? null : Array.newInstance(mirror(), 0).getClass(); + if (kind == Kind.Void) { + return null; + } + Class javaArrayMirror = Array.newInstance(mirror(), 0).getClass(); return HotSpotResolvedObjectType.fromClass(javaArrayMirror); } @@ -151,7 +154,7 @@ @Override public boolean isAssignableFrom(ResolvedJavaType other) { assert other != null; - return other == this; + return other.equals(this); } @Override diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/AheadOfTimeVerificationPhase.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java --- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/phases/OnStackReplacementPhase.java Fri Mar 14 09:58:31 2014 +0100 @@ -101,7 +101,7 @@ */ proxy.replaceAndDelete(graph.unique(new OSRLocalNode(i, proxy.stamp().unrestricted()))); } else { - assert value instanceof OSRLocalNode; + assert value == null || value instanceof OSRLocalNode; } } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.java.decompiler/src/com/oracle/graal/java/decompiler/Decompiler.java --- a/graal/com.oracle.graal.java.decompiler/src/com/oracle/graal/java/decompiler/Decompiler.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.java.decompiler/src/com/oracle/graal/java/decompiler/Decompiler.java Fri Mar 14 09:58:31 2014 +0100 @@ -25,6 +25,7 @@ import java.io.*; import java.util.*; +import com.oracle.graal.graph.*; import com.oracle.graal.java.decompiler.block.*; import com.oracle.graal.nodes.*; import com.oracle.graal.nodes.cfg.*; @@ -55,9 +56,9 @@ schedule = new SchedulePhase(); schedule.apply(graph); } catch (Throwable t) { + throw new GraalInternalError(t); } } - cfg = schedule.getCFG(); } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java --- a/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/BytecodeDisassembler.java Fri Mar 14 09:58:31 2014 +0100 @@ -141,7 +141,7 @@ desc = constant.toString(); } if (!multiline) { - desc.replaceAll("\\n", ""); + desc = desc.replaceAll("\\n", ""); } buf.append(String.format("#%-10d // %s", cpi, desc)); break; diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/FrameStateBuilder.java Fri Mar 14 09:58:31 2014 +0100 @@ -146,7 +146,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()) { diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/GraphBuilderPhase.java Fri Mar 14 09:58:31 2014 +0100 @@ -825,7 +825,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 +839,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; } diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.java/src/com/oracle/graal/java/VerifyOptionsPhase.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java --- a/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.lir/src/com/oracle/graal/lir/LIR.java Fri Mar 14 09:58:31 2014 +0100 @@ -94,7 +94,7 @@ return spillMoveFactory; } - public List lir(Block block) { + public List lir(AbstractBlock block) { return lirInstructions.get(block); } diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/StructuredGraph.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/TypeProfileProxyNode.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/CompareNode.java Fri Mar 14 09:58:31 2014 +0100 @@ -54,7 +54,7 @@ * @param y the instruction that produces the second input to this instruction */ public CompareNode(ValueNode x, ValueNode y) { - assert (x == null && y == null) || x.kind() == y.kind(); + assert x != null && y != null && x.kind() == y.kind(); this.x = x; this.y = y; } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/IntegerTestNode.java Fri Mar 14 09:58:31 2014 +0100 @@ -53,7 +53,7 @@ * @param y the instruction that produces the second input to this instruction */ public IntegerTestNode(ValueNode x, ValueNode y) { - assert (x == null && y == null) || x.stamp().isCompatible(y.stamp()); + assert x != null && y != null && x.stamp().isCompatible(y.stamp()); this.x = x; this.y = y; } diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ObjectEqualsNode.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/AbstractBlock.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/AbstractBlock.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/AbstractBlock.java Fri Mar 14 09:58:31 2014 +0100 @@ -24,7 +24,7 @@ import com.oracle.graal.nodes.*; -public interface AbstractBlock { +public interface AbstractBlock> { int getId(); diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/cfg/BlockMap.java Fri Mar 14 09:58:31 2014 +0100 @@ -31,11 +31,11 @@ data = (T[]) new Object[cfg.getBlocks().length]; } - public T get(Block block) { + public T get(AbstractBlock block) { return data[block.getId()]; } - public void put(Block block, T value) { + public void put(AbstractBlock block, T value) { data[block.getId()] = value; } } diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java --- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/ReadNode.java Fri Mar 14 09:58:31 2014 +0100 @@ -76,7 +76,7 @@ } if (tool.canonicalizeReads()) { if (metaAccess != null && object != null && object.isConstant()) { - if ((location.getLocationIdentity() == LocationIdentity.FINAL_LOCATION || location.getLocationIdentity() == LocationIdentity.ARRAY_LENGTH_LOCATION) & + if ((location.getLocationIdentity() == LocationIdentity.FINAL_LOCATION || location.getLocationIdentity() == LocationIdentity.ARRAY_LENGTH_LOCATION) && location instanceof ConstantLocationNode) { long displacement = ((ConstantLocationNode) location).getDisplacement(); Kind kind = location.getValueKind(); diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/extended/UnboxNode.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/CheckCastNode.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/java/MethodCallTargetNode.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/ObjectStamp.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/type/StampFactory.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/virtual/VirtualInstanceNode.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java --- a/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.options/src/com/oracle/graal/options/OptionProcessor.java Fri Mar 14 09:58:31 2014 +0100 @@ -172,7 +172,7 @@ String declaringClass = option.declaringClass; Name fieldName = option.field.getSimpleName(); String comma = i == info.options.size() - 1 ? "" : ","; - out.printf(" new %s(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s\n", desc, name, type, help, declaringClass, fieldName, optionValue, comma); + out.printf(" new %s(\"%s\", %s.class, \"%s\", %s.class, \"%s\", %s)%s%n", desc, name, type, help, declaringClass, fieldName, optionValue, comma); i++; } out.println(" );"); diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ConditionalEliminationPhase.java Fri Mar 14 09:58:31 2014 +0100 @@ -66,7 +66,7 @@ new ConditionalElimination(graph.start(), new State()).apply(); } - public static class State extends MergeableState { + public static class State extends MergeableState implements Cloneable { private IdentityHashMap knownTypes; private HashSet knownNonNull; @@ -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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningPhase.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/InliningUtil.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ValueAnchorCleanupPhase.java --- a/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ValueAnchorCleanupPhase.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases.common/src/com/oracle/graal/phases/common/ValueAnchorCleanupPhase.java Fri Mar 14 09:58:31 2014 +0100 @@ -37,7 +37,7 @@ */ public class ValueAnchorCleanupPhase extends Phase { - private static class State extends MergeableState { + private static class State extends MergeableState implements Cloneable { private final HashSet anchoredValues; diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/GraalOptions.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/VerifyPhase.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/ComputeProbabilityClosure.java Fri Mar 14 09:58:31 2014 +0100 @@ -169,7 +169,7 @@ public final NodeMap> requires; - private double loopFrequency = -1; + private double loopFrequency = -1.0; public boolean ended = false; public LoopInfo(LoopBeginNode loopBegin) { @@ -178,7 +178,8 @@ } public double loopFrequency(NodesToDoubles nodeProbabilities) { - if (loopFrequency == -1 && ended) { + // loopFrequency is initialized with -1.0 + if (loopFrequency < 0.0 && ended) { double backEdgeProb = 0.0; for (LoopEndNode le : loopBegin.loopEnds()) { double factor = 1; @@ -219,7 +220,7 @@ return r; } - private class Probability extends MergeableState { + private class Probability extends MergeableState implements Cloneable { public double probability; public Set loops; @@ -330,7 +331,7 @@ } } - private class LoopCount extends MergeableState { + private class LoopCount extends MergeableState implements Cloneable { public double count; diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java --- a/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/graph/MergeableState.java Fri Mar 14 09:58:31 2014 +0100 @@ -62,7 +62,7 @@ // empty default implementation } - public static final class EmptyState extends MergeableState { + public static final class EmptyState extends MergeableState implements Cloneable { @Override public EmptyState clone() { diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/tiers/HighTierContext.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.phases/src/com/oracle/graal/phases/verify/VerifyUsageWithEquals.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java --- a/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/CFGPrinter.java Fri Mar 14 09:58:31 2014 +0100 @@ -250,20 +250,24 @@ } } - Node cur = block.getBeginNode(); - while (true) { - printNode(cur, false); + // Currently no node printing for lir + if (lir == null) { + Node cur = block.getBeginNode(); + while (true) { + printNode(cur, false); - if (cur == block.getEndNode()) { - for (Map.Entry entry : latestScheduling.entries()) { - if (entry.getValue() == block && !inFixedSchedule(entry.getKey()) && !printedNodes.isMarked(entry.getKey())) { - printNode(entry.getKey(), true); + if (cur == block.getEndNode()) { + for (Map.Entry entry : latestScheduling.entries()) { + if (entry.getValue() == block && !inFixedSchedule(entry.getKey()) && !printedNodes.isMarked(entry.getKey())) { + printNode(entry.getKey(), true); + } } + break; } - break; + assert cur.successors().count() == 1; + cur = cur.successors().first(); } - assert cur.successors().count() == 1; - cur = cur.successors().first(); + } out.enableIndentation(); diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.printer/src/com/oracle/graal/printer/GraphPrinterDumpHandler.java Fri Mar 14 09:58:31 2014 +0100 @@ -86,7 +86,7 @@ // This field must be lazily initialized as this class may be loaded in a version // VM startup phase at which not all required features (such as system properties) // are online. - private static SimpleDateFormat sdf; + private static volatile SimpleDateFormat sdf; private void initializeFilePrinter() { String ext; @@ -98,7 +98,13 @@ if (sdf == null) { sdf = new SimpleDateFormat("YYYY-MM-dd-HHmm"); } - String prefix = "Graphs-" + Thread.currentThread().getName() + "-" + sdf.format(new Date()); + + // DateFormats are inherently unsafe for multi-threaded use. Use a synchronized block. + String prefix; + synchronized (sdf) { + prefix = "Graphs-" + Thread.currentThread().getName() + "-" + sdf.format(new Date()); + } + String num = ""; File file; int i = 0; @@ -196,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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/ReplacementsImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/SnippetTemplate.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/StringSubstitutions.java diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.replacements/src/com/oracle/graal/replacements/nodes/MacroNode.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.runtime/src/com/oracle/graal/runtime/RuntimeProvider.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/PartialEvaluator.java Fri Mar 14 09:58:31 2014 +0100 @@ -43,6 +43,7 @@ import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.java.MethodCallTargetNode.InvokeKind; import com.oracle.graal.nodes.spi.*; +import com.oracle.graal.nodes.type.*; import com.oracle.graal.nodes.util.*; import com.oracle.graal.nodes.virtual.*; import com.oracle.graal.phases.*; @@ -50,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; @@ -70,16 +70,16 @@ 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 { executeHelperMethod = providers.getMetaAccess().lookupJavaMethod(OptimizedCallTarget.class.getDeclaredMethod("executeHelper", PackedFrame.class, Arguments.class)); } catch (NoSuchMethodException ex) { @@ -139,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()); @@ -183,7 +187,7 @@ changed = false; for (MethodCallTargetNode methodCallTargetNode : graph.getNodes(MethodCallTargetNode.class)) { InvokeKind kind = methodCallTargetNode.invokeKind(); - if (kind == InvokeKind.Static || (kind == InvokeKind.Special && (methodCallTargetNode.receiver().isConstant() || methodCallTargetNode.receiver() instanceof NewFrameNode))) { + if (kind == InvokeKind.Static || (kind == InvokeKind.Special && (methodCallTargetNode.receiver().isConstant() || isFrame(methodCallTargetNode.receiver())))) { if (TraceTruffleCompilationHistogram.getValue() && kind == InvokeKind.Special) { ConstantNode constantNode = (ConstantNode) methodCallTargetNode.arguments().first(); constantReceivers.add(constantNode.asConstant()); @@ -237,6 +241,10 @@ } } + private boolean isFrame(ValueNode receiver) { + 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) { StructuredGraph graph = truffleCache.lookup(targetMethod, arguments, assumptions, canonicalizer); diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCache.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleCompilerImpl.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleDebugJavaMethod.java Fri Mar 14 09:58:31 2014 +0100 @@ -59,7 +59,7 @@ @Override public boolean equals(Object obj) { - return obj.getClass() == getClass(); + return obj instanceof TruffleDebugJavaMethod; } @Override diff -r 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleExpansionLogger.java --- a/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleExpansionLogger.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.truffle/src/com/oracle/graal/truffle/TruffleExpansionLogger.java Fri Mar 14 09:58:31 2014 +0100 @@ -168,10 +168,10 @@ if (e.getLineNumber() >= 0) { return String.format("(%s:%d)", e.getFileName(), e.getLineNumber()); } else { - return String.format("(%s)", e.getFileName(), e.getLineNumber()); + return String.format("(%s)", e.getFileName()); } } else { - return String.format("(Unknown Source)", e.getFileName(), e.getLineNumber()); + return String.format("(Unknown Source)"); } } } diff -r 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PEReadEliminationBlockState.java Fri Mar 14 09:58:31 2014 +0100 @@ -50,8 +50,11 @@ @Override public boolean equals(Object obj) { + if (!(obj instanceof ReadCacheEntry)) { + return false; + } ReadCacheEntry other = (ReadCacheEntry) obj; - return identity == other.identity && object == other.object; + return identity.equals(other.identity) && object == other.object; } @Override @@ -133,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 5454f6bf50bf -r 47b775458982 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 Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/PartialEscapeClosure.java Fri Mar 14 09:58:31 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 5454f6bf50bf -r 47b775458982 graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java --- a/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java Wed Mar 12 11:23:56 2014 +0100 +++ b/graal/com.oracle.graal.virtual/src/com/oracle/graal/virtual/phases/ea/ReadEliminationBlockState.java Fri Mar 14 09:58:31 2014 +0100 @@ -52,6 +52,9 @@ @Override public boolean equals(Object obj) { + if (!(obj instanceof CacheEntry)) { + return false; + } CacheEntry other = (CacheEntry) obj; return identity == other.identity && object == other.object; } diff -r 5454f6bf50bf -r 47b775458982 hotspot/.cproject --- a/hotspot/.cproject Wed Mar 12 11:23:56 2014 +0100 +++ b/hotspot/.cproject Fri Mar 14 09:58:31 2014 +0100 @@ -44,6 +44,7 @@ +