974 975 // The expected type of every return statement in this method 976 // is the method's return type. 977 this.pt = tree.sym.erasure(types).getReturnType(); 978 979 checkDimension(tree.pos(), tree.sym.erasure(types)); 980 genMethod(tree, localEnv, false); 981 } 982 //where 983 /** Generate code for a method. 984 * @param tree The tree representing the method definition. 985 * @param env The environment current for the method body. 986 * @param fatcode A flag that indicates whether all jumps are 987 * within 32K. We first invoke this method under 988 * the assumption that fatcode == false, i.e. all 989 * jumps are within 32K. If this fails, fatcode 990 * is set to true and we try again. 991 */ 992 void genMethod(JCMethodDecl tree, Env<GenContext> env, boolean fatcode) { 993 MethodSymbol meth = tree.sym; 994 // System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG 995 if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) + 996 (((tree.mods.flags & STATIC) == 0 || meth.isConstructor()) ? 1 : 0) > 997 ClassFile.MAX_PARAMETERS) { 998 log.error(tree.pos(), "limit.parameters"); 999 nerrs++; 1000 } 1001 1002 else if (tree.body != null) { 1003 // Create a new code structure and initialize it. 1004 int startpcCrt = initCode(tree, env, fatcode); 1005 1006 try { 1007 genStat(tree.body, env); 1008 } catch (CodeSizeOverflow e) { 1009 // Failed due to code limit, try again with jsr/ret 1010 startpcCrt = initCode(tree, env, fatcode); 1011 genStat(tree.body, env); 1012 } 1013 1014 if (code.state.stacksize != 0) { 1015 log.error(tree.body.pos(), "stack.sim.error", tree); 1016 throw new AssertionError(); | 974 975 // The expected type of every return statement in this method 976 // is the method's return type. 977 this.pt = tree.sym.erasure(types).getReturnType(); 978 979 checkDimension(tree.pos(), tree.sym.erasure(types)); 980 genMethod(tree, localEnv, false); 981 } 982 //where 983 /** Generate code for a method. 984 * @param tree The tree representing the method definition. 985 * @param env The environment current for the method body. 986 * @param fatcode A flag that indicates whether all jumps are 987 * within 32K. We first invoke this method under 988 * the assumption that fatcode == false, i.e. all 989 * jumps are within 32K. If this fails, fatcode 990 * is set to true and we try again. 991 */ 992 void genMethod(JCMethodDecl tree, Env<GenContext> env, boolean fatcode) { 993 MethodSymbol meth = tree.sym; 994 int extras = 0; 995 // Count up extra parameters 996 if (meth.isConstructor()) { 997 extras++; 998 if (meth.enclClass().isInner() && 999 !meth.enclClass().isStatic()) { 1000 extras++; 1001 } 1002 } else if ((tree.mods.flags & STATIC) == 0) { 1003 extras++; 1004 } 1005 // System.err.println("Generating " + meth + " in " + meth.owner); //DEBUG 1006 if (Code.width(types.erasure(env.enclMethod.sym.type).getParameterTypes()) + extras > 1007 ClassFile.MAX_PARAMETERS) { 1008 log.error(tree.pos(), "limit.parameters"); 1009 nerrs++; 1010 } 1011 1012 else if (tree.body != null) { 1013 // Create a new code structure and initialize it. 1014 int startpcCrt = initCode(tree, env, fatcode); 1015 1016 try { 1017 genStat(tree.body, env); 1018 } catch (CodeSizeOverflow e) { 1019 // Failed due to code limit, try again with jsr/ret 1020 startpcCrt = initCode(tree, env, fatcode); 1021 genStat(tree.body, env); 1022 } 1023 1024 if (code.state.stacksize != 0) { 1025 log.error(tree.body.pos(), "stack.sim.error", tree); 1026 throw new AssertionError(); |