forstmt.java
来自「JDK1.4编译器后端」· Java 代码 · 共 954 行 · 第 1/3 页
JAVA
954 行
boolean isFinal = this.is$Final(); canCompleteNormally_value = canCompleteNormally_compute(); if(isFinal && num == boundariesCrossed) canCompleteNormally_computed = true; return canCompleteNormally_value; } private boolean canCompleteNormally_compute() { return reachable() && hasCondition() && (!getCondition().isConstant() || !getCondition().isTrue()) || reachableBreak(); } protected java.util.Map variableScopeEndLabel_CodeGeneration_values; // Declared in CodeGeneration.jrag at line 45 @SuppressWarnings({"unchecked", "cast"}) public int variableScopeEndLabel(CodeGeneration gen) { Object _parameters = gen;if(variableScopeEndLabel_CodeGeneration_values == null) variableScopeEndLabel_CodeGeneration_values = new java.util.HashMap(4); if(variableScopeEndLabel_CodeGeneration_values.containsKey(_parameters)) return ((Integer)variableScopeEndLabel_CodeGeneration_values.get(_parameters)).intValue(); int num = boundariesCrossed; boolean isFinal = this.is$Final(); int variableScopeEndLabel_CodeGeneration_value = variableScopeEndLabel_compute(gen); if(isFinal && num == boundariesCrossed) variableScopeEndLabel_CodeGeneration_values.put(_parameters, new Integer(variableScopeEndLabel_CodeGeneration_value)); return variableScopeEndLabel_CodeGeneration_value; } private int variableScopeEndLabel_compute(CodeGeneration gen) { return gen.variableScopeLabel(); } // Declared in CreateBCode.jrag at line 940 @SuppressWarnings({"unchecked", "cast"}) public boolean definesLabel() { boolean definesLabel_value = definesLabel_compute(); return definesLabel_value; } private boolean definesLabel_compute() { return true; } protected boolean cond_label_computed = false; protected int cond_label_value; // Declared in CreateBCode.jrag at line 1352 @SuppressWarnings({"unchecked", "cast"}) public int cond_label() { if(cond_label_computed) return cond_label_value; int num = boundariesCrossed; boolean isFinal = this.is$Final(); cond_label_value = cond_label_compute(); if(isFinal && num == boundariesCrossed) cond_label_computed = true; return cond_label_value; } private int cond_label_compute() { return hostType().constantPool().newLabel(); } protected boolean begin_label_computed = false; protected int begin_label_value; // Declared in CreateBCode.jrag at line 1353 @SuppressWarnings({"unchecked", "cast"}) public int begin_label() { if(begin_label_computed) return begin_label_value; int num = boundariesCrossed; boolean isFinal = this.is$Final(); begin_label_value = begin_label_compute(); if(isFinal && num == boundariesCrossed) begin_label_computed = true; return begin_label_value; } private int begin_label_compute() { return hostType().constantPool().newLabel(); } protected boolean update_label_computed = false; protected int update_label_value; // Declared in CreateBCode.jrag at line 1354 @SuppressWarnings({"unchecked", "cast"}) public int update_label() { if(update_label_computed) return update_label_value; int num = boundariesCrossed; boolean isFinal = this.is$Final(); update_label_value = update_label_compute(); if(isFinal && num == boundariesCrossed) update_label_computed = true; return update_label_value; } private int update_label_compute() { return hostType().constantPool().newLabel(); } protected boolean end_label_computed = false; protected int end_label_value; // Declared in CreateBCode.jrag at line 1355 @SuppressWarnings({"unchecked", "cast"}) public int end_label() { if(end_label_computed) return end_label_value; int num = boundariesCrossed; boolean isFinal = this.is$Final(); end_label_value = end_label_compute(); if(isFinal && num == boundariesCrossed) end_label_computed = true; return end_label_value; } private int end_label_compute() { return hostType().constantPool().newLabel(); } // Declared in CreateBCode.jrag at line 1381 @SuppressWarnings({"unchecked", "cast"}) public int break_label() { int break_label_value = break_label_compute(); return break_label_value; } private int break_label_compute() { return end_label(); } // Declared in CreateBCode.jrag at line 1400 @SuppressWarnings({"unchecked", "cast"}) public int continue_label() { int continue_label_value = continue_label_compute(); return continue_label_value; } private int continue_label_compute() { return update_label(); } protected java.util.Map lookupVariable_String_values; // Declared in LookupVariable.jrag at line 18 @SuppressWarnings({"unchecked", "cast"}) public SimpleSet lookupVariable(String name) { Object _parameters = name;if(lookupVariable_String_values == null) lookupVariable_String_values = new java.util.HashMap(4); if(lookupVariable_String_values.containsKey(_parameters)) return (SimpleSet)lookupVariable_String_values.get(_parameters); int num = boundariesCrossed; boolean isFinal = this.is$Final(); SimpleSet lookupVariable_String_value = getParent().Define_SimpleSet_lookupVariable(this, null, name); if(isFinal && num == boundariesCrossed) lookupVariable_String_values.put(_parameters, lookupVariable_String_value); return lookupVariable_String_value; } // Declared in NameCheck.jrag at line 365 public boolean Define_boolean_insideLoop(ASTNode caller, ASTNode child) { if(caller == getStmtNoTransform()) { return true; } return getParent().Define_boolean_insideLoop(this, caller); } // Declared in CreateBCode.jrag at line 950 public int Define_int_condition_true_label(ASTNode caller, ASTNode child) { if(caller == getConditionOptNoTransform()) { return begin_label(); } return getParent().Define_int_condition_true_label(this, caller); } // Declared in CreateBCode.jrag at line 949 public int Define_int_condition_false_label(ASTNode caller, ASTNode child) { if(caller == getConditionOptNoTransform()) { return end_label(); } return getParent().Define_int_condition_false_label(this, caller); } // Declared in LocalNum.jrag at line 102 public int Define_int_localNum(ASTNode caller, ASTNode child) { if(caller == getInitStmtListNoTransform()) { int index = caller.getIndexOfChild(child);{ if(index == 0) return localNum(); if(getInitStmt(index-1) instanceof VariableDeclaration) return getInitStmt(index-1).localNum() + ((VariableDeclaration)getInitStmt(index-1)).type().variableSize(); return getInitStmt(index-1).localNum(); }} if(caller == getStmtNoTransform()){ if(getNumInitStmt() == 0) return localNum(); if(getInitStmt(getNumInitStmt()-1) instanceof VariableDeclaration) return getInitStmt(getNumInitStmt()-1).localNum() + ((VariableDeclaration)getInitStmt(getNumInitStmt()-1)).type().variableSize(); return getInitStmt(getNumInitStmt()-1).localNum(); } return getParent().Define_int_localNum(this, caller); } // Declared in LookupVariable.jrag at line 90 public SimpleSet Define_SimpleSet_lookupVariable(ASTNode caller, ASTNode child, String name) { if(caller == getStmtNoTransform()) { return localLookup(name); } if(caller == getUpdateStmtListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return localLookup(name); } if(caller == getConditionOptNoTransform()) { return localLookup(name); } if(caller == getInitStmtListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return localLookup(name); } return getParent().Define_SimpleSet_lookupVariable(this, caller, name); } // Declared in CodeGeneration.jrag at line 46 public int Define_int_variableScopeEndLabel(ASTNode caller, ASTNode child, CodeGeneration gen) { if(caller == getInitStmtListNoTransform()) { int i = caller.getIndexOfChild(child); return variableScopeEndLabel(gen); } return getParent().Define_int_variableScopeEndLabel(this, caller, gen); } // Declared in UnreachableStatements.jrag at line 149 public boolean Define_boolean_reportUnreachable(ASTNode caller, ASTNode child) { if(caller == getStmtNoTransform()) { return reachable(); } return getParent().Define_boolean_reportUnreachable(this, caller); } // Declared in UnreachableStatements.jrag at line 103 public boolean Define_boolean_reachable(ASTNode caller, ASTNode child) { if(caller == getStmtNoTransform()) { return reachable() && (!hasCondition() || (!getCondition().isConstant() || !getCondition().isFalse())); } return getParent().Define_boolean_reachable(this, caller); } // Declared in NameCheck.jrag at line 294 public VariableScope Define_VariableScope_outerScope(ASTNode caller, ASTNode child) { if(caller == getStmtNoTransform()) { return this; } if(caller == getInitStmtListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return this; } return getParent().Define_VariableScope_outerScope(this, caller); } // Declared in DefiniteAssignment.jrag at line 637 public boolean Define_boolean_isDAbefore(ASTNode caller, ASTNode child, Variable v) { if(caller == getUpdateStmtListNoTransform()) { int childIndex = caller.getIndexOfChild(child);{ if(!getStmt().isDAafter(v)) return false; for(Iterator iter = targetContinues().iterator(); iter.hasNext(); ) { ContinueStmt stmt = (ContinueStmt)iter.next(); if(!stmt.isDAafterReachedFinallyBlocks(v)) return false; } return true; }} if(caller == getStmtNoTransform()){ if(hasCondition() && getCondition().isDAafterTrue(v)) return true; if(!hasCondition() && isDAafterInitialization(v)) return true; return false; } if(caller == getConditionOptNoTransform()) { return isDAafterInitialization(v); } if(caller == getInitStmtListNoTransform()) { int i = caller.getIndexOfChild(child); return i == 0 ? isDAbefore(v) : getInitStmt(i-1).isDAafter(v); } return getParent().Define_boolean_isDAbefore(this, caller, v); } // Declared in DefiniteAssignment.jrag at line 1149 public boolean Define_boolean_isDUbefore(ASTNode caller, ASTNode child, Variable v) { if(caller == getUpdateStmtListNoTransform()) { int i = caller.getIndexOfChild(child);{ if(!isDUbeforeCondition(v)) // start a circular evaluation here return false; if(i == 0) { if(!getStmt().isDUafter(v)) return false; for(Iterator iter = targetContinues().iterator(); iter.hasNext(); ) { ContinueStmt stmt = (ContinueStmt)iter.next(); if(!stmt.isDUafterReachedFinallyBlocks(v)) return false; } return true; } else return getUpdateStmt(i-1).isDUafter(v); }} if(caller == getStmtNoTransform()) { return isDUbeforeCondition(v) && (hasCondition() ? getCondition().isDUafterTrue(v) : isDUafterInit(v)); } if(caller == getConditionOptNoTransform()) { return isDUbeforeCondition(v); } if(caller == getInitStmtListNoTransform()) { int childIndex = caller.getIndexOfChild(child); return childIndex == 0 ? isDUbefore(v) : getInitStmt(childIndex-1).isDUafter(v); } return getParent().Define_boolean_isDUbefore(this, caller, v); }public ASTNode rewriteTo() { // Declared in DefiniteAssignment.jrag at line 1167 if(!hasCondition()) { duringDefiniteAssignment++; ASTNode result = rewriteRule0(); duringDefiniteAssignment--; return result; } return super.rewriteTo();} // Declared in DefiniteAssignment.jrag at line 1167 private ForStmt rewriteRule0() {{ setCondition(new BooleanLiteral("true")); return this; } }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?