2362N/A * Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * WARNING: The contents of this source file are not part of any 0N/A * supported API. Code that depends on them does so at its own risk: 0N/A * they are subject to change or removal without notice. 0N/A // Argument 'expr' is either an IdentifierExpression for a declaration of 0N/A // the form 'type x' or an AssignmentExpression for a declaration of the 0N/A // form 'type x = initvalue'. Note that these expressions are treated 0N/A // specially in this context, and don't have much connection to their ordinary 0N/A // Keep in mind that isConstant() only means expressions 0N/A // that are constant according to the JLS. They might 0N/A // not be either constants or evaluable (eg. 1/0). 0N/A // Don't generate code for variable if unused and 0N/A // optimization is on, whether or not debugging is on 0N/A // This code looks like it tests whether a final variable 0N/A // is being initialized by an identifier expression. 0N/A // Then if the identifier is a local of the same method 0N/A // it makes the final variable eligible to be inlined. 0N/A // BUT: why isn't the local also checked to make sure 0N/A // it is itself final? Unknown. 0N/A //System.out.println("FINAL IDENT = " + field + " in " + ctx.field); 0N/A // The two lines below used to elide the declaration 0N/A // of inlineable variables, on the theory that there 0N/A // wouldn't be any references. But this breaks the 0N/A // translation of nested classes, which might refer to 0N/A //System.out.println("FINAL = " + field + " in " + ctx.field); 0N/A // The two lines below used to elide the declaration 0N/A // of inlineable variables, on the theory that there 0N/A // wouldn't be any references. But this breaks the 0N/A // translation of nested classes, which might refer to 0N/A // the variable. Fix for 4073244. 0N/A * Create a copy of the statement for method inlining 0N/A * The cost of inlining this statement 0N/A // The two lines of code directly following this comment used 0N/A // to be in the opposite order. They were switched so that 0N/A // lines like the following: 0N/A // will compile correctly. (Constructions like the above are 0N/A // legal. JLS 14.3.2 says that the scope of a local variable 0N/A // includes its own initializer.) It is important that we 0N/A // declare `field' before we code `expr', because otherwise 0N/A // situations can arise where `field' thinks it is assigned 0N/A // a local variable slot that is, in actuality, assigned to 0N/A // an entirely different variable. (Bug id 4076729) 0N/A // an initial side effect, rather than an initial value