http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/compile/Dag.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/lops/compile/Dag.java b/src/main/java/org/apache/sysml/lops/compile/Dag.java index b777623..f0f74cc 100644 --- a/src/main/java/org/apache/sysml/lops/compile/Dag.java +++ b/src/main/java/org/apache/sysml/lops/compile/Dag.java @@ -19,7 +19,6 @@ package org.apache.sysml.lops.compile; -import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import java.util.Comparator; @@ -240,12 +239,8 @@ public class Dag<N extends Lop> * @param sb statement block * @param config dml configuration * @return list of instructions - * @throws LopsException if LopsException occurs - * @throws IOException if IOException occurs - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public ArrayList<Instruction> getJobs(StatementBlock sb, DMLConfig config) - throws LopsException, DMLRuntimeException { + public ArrayList<Instruction> getJobs(StatementBlock sb, DMLConfig config) { if (config != null) { total_reducers = config.getIntValue(DMLConfig.NUM_REDUCERS); scratch = config.getTextValue(DMLConfig.SCRATCH_SPACE) + "/"; @@ -267,9 +262,7 @@ public class Dag<N extends Lop> } - private static void deleteUpdatedTransientReadVariables(StatementBlock sb, ArrayList<Lop> nodeV, - ArrayList<Instruction> inst) throws DMLRuntimeException { - + private static void deleteUpdatedTransientReadVariables(StatementBlock sb, ArrayList<Lop> nodeV, ArrayList<Instruction> inst) { if ( sb == null ) return; @@ -341,8 +334,7 @@ public class Dag<N extends Lop> } - private static void generateRemoveInstructions(StatementBlock sb, ArrayList<Instruction> deleteInst) - throws DMLRuntimeException { + private static void generateRemoveInstructions(StatementBlock sb, ArrayList<Instruction> deleteInst) { if ( sb == null ) return; @@ -350,7 +342,6 @@ public class Dag<N extends Lop> if( LOG.isTraceEnabled() ) LOG.trace("In generateRemoveInstructions()"); - Instruction inst = null; // RULE 1: if in IN and not in OUT, then there should be an rmvar or rmfilevar inst // (currently required for specific cases of external functions) @@ -384,9 +375,7 @@ public class Dag<N extends Lop> } } - private static boolean isCompatible(ArrayList<Lop> nodes, JobType jt, int from, int to) - throws LopsException - { + private static boolean isCompatible(ArrayList<Lop> nodes, JobType jt, int from, int to) { int base = jt.getBase(); for ( Lop node : nodes ) { if ((node.getCompatibleJobs() & base) == 0) { @@ -427,7 +416,7 @@ public class Dag<N extends Lop> * Add node, and its relevant children to job-specific node vectors. */ private void addNodeByJobType(Lop node, ArrayList<ArrayList<Lop>> arr, - ArrayList<Lop> execNodes, boolean eliminate) throws LopsException { + ArrayList<Lop> execNodes, boolean eliminate) { if (!eliminate) { // Check if this lop defines a MR job. @@ -534,11 +523,10 @@ public class Dag<N extends Lop> * @param execNodes list of exec low-level operators * @param jobNodes list of job low-level operators * @param finishedNodes list of finished low-level operators - * @throws LopsException if LopsException occurs */ private void handleSingleOutputJobs(ArrayList<Lop> execNodes, ArrayList<ArrayList<Lop>> jobNodes, ArrayList<Lop> finishedNodes) - throws LopsException { + { /* * If the input of a MMCJ/MMRJ job (must have executed in a Mapper) is used * by multiple lops then we should mark it as not-finished. @@ -635,11 +623,8 @@ public class Dag<N extends Lop> * * @param nodes_v list of nodes * @param inst list of instructions - * @throws LopsException if LopsException occurs - * @throws IOException if IOException occurs */ - private static void generateInstructionsForInputVariables(ArrayList<Lop> nodes_v, ArrayList<Instruction> inst) - throws LopsException { + private static void generateInstructionsForInputVariables(ArrayList<Lop> nodes_v, ArrayList<Instruction> inst) { for(Lop n : nodes_v) { if (n.getExecLocation() == ExecLocation.Data && !((Data) n).isTransient() && ((Data) n).getOperationType() == OperationTypes.READ @@ -767,12 +752,8 @@ public class Dag<N extends Lop> * @param sb statement block * @param node_v list of low-level operators * @return list of instructions - * @throws LopsException if LopsException occurs - * @throws IOException if IOException occurs - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private ArrayList<Instruction> doGreedyGrouping(StatementBlock sb, ArrayList<Lop> node_v) - throws LopsException, DMLRuntimeException { if( LOG.isTraceEnabled() ) LOG.trace("Grouping DAG ============"); @@ -1246,9 +1227,8 @@ public class Dag<N extends Lop> * @param node low-level operator * @param inst list of instructions * @param delteInst list of instructions - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - private static void processConsumersForInputs(Lop node, ArrayList<Instruction> inst, ArrayList<Instruction> delteInst) throws DMLRuntimeException { + private static void processConsumersForInputs(Lop node, ArrayList<Instruction> inst, ArrayList<Instruction> delteInst) { // reduce the consumer count for all input lops // if the count becomes zero, then then variable associated w/ input can be removed for(Lop in : node.getInputs() ) { @@ -1261,7 +1241,7 @@ public class Dag<N extends Lop> } } - private static void processConsumers(Lop node, ArrayList<Instruction> inst, ArrayList<Instruction> deleteInst, Lop locationInfo) throws DMLRuntimeException { + private static void processConsumers(Lop node, ArrayList<Instruction> inst, ArrayList<Instruction> deleteInst, Lop locationInfo) { // reduce the consumer count for all input lops // if the count becomes zero, then then variable associated w/ input can be removed if ( node.removeConsumer() == 0 ) { @@ -1290,11 +1270,9 @@ public class Dag<N extends Lop> * @param inst list of instructions * @param writeInst list of write instructions * @param deleteInst list of delete instructions - * @throws LopsException if LopsException occurs - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private void generateControlProgramJobs(ArrayList<Lop> execNodes, - ArrayList<Instruction> inst, ArrayList<Instruction> writeInst, ArrayList<Instruction> deleteInst) throws LopsException, DMLRuntimeException { + ArrayList<Instruction> inst, ArrayList<Instruction> writeInst, ArrayList<Instruction> deleteInst) { // nodes to be deleted from execnodes ArrayList<Lop> markedNodes = new ArrayList<>(); @@ -1569,11 +1547,10 @@ public class Dag<N extends Lop> * @param execNodes list of exec nodes * @param queuedNodes list of queued nodes * @param jobvec list of lists of low-level operators - * @throws LopsException if LopsException occurs */ private void removeNodesForNextIteration(Lop node, ArrayList<Lop> finishedNodes, ArrayList<Lop> execNodes, ArrayList<Lop> queuedNodes, - ArrayList<ArrayList<Lop>> jobvec) throws LopsException { + ArrayList<ArrayList<Lop>> jobvec) { // only queued nodes with multiple inputs need to be handled. if (node.getInputs().size() == 1) @@ -1900,9 +1877,8 @@ public class Dag<N extends Lop> * @param lops low-level operator * @param jobvec list of lists of low-level operators * @return job index for a low-level operator - * @throws LopsException if LopsException occurs */ - private static int jobType(Lop lops, ArrayList<ArrayList<Lop>> jobvec) throws LopsException { + private static int jobType(Lop lops, ArrayList<ArrayList<Lop>> jobvec) { for ( JobType jt : JobType.values()) { int i = jt.getId(); if (i > 0 && jobvec.get(i) != null && jobvec.get(i).contains(lops)) { @@ -1969,10 +1945,8 @@ public class Dag<N extends Lop> * Method to print the lops grouped by job type * * @param jobNodes list of lists of low-level operators - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private static void printJobNodes(ArrayList<ArrayList<Lop>> jobNodes) - throws DMLRuntimeException { if (LOG.isTraceEnabled()){ for ( JobType jt : JobType.values() ) { @@ -2063,14 +2037,11 @@ public class Dag<N extends Lop> * @param writeinst list of write instructions * @param deleteinst list of delete instructions * @param jobNodes list of list of low-level operators - * @throws LopsException if LopsException occurs - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private void generateMRJobs(ArrayList<Lop> execNodes, ArrayList<Instruction> inst, ArrayList<Instruction> writeinst, ArrayList<Instruction> deleteinst, ArrayList<ArrayList<Lop>> jobNodes) - throws LopsException, DMLRuntimeException { printJobNodes(jobNodes); @@ -2195,10 +2166,8 @@ public class Dag<N extends Lop> * @param node low-level operator * @param cellModeOverride override mode * @return output info - * @throws LopsException if LopsException occurs */ - private static OutputInfo getOutputInfo(Lop node, boolean cellModeOverride) - throws LopsException + private static OutputInfo getOutputInfo(Lop node, boolean cellModeOverride) { if ( (node.getDataType() == DataType.SCALAR && node.getExecType() == ExecType.CP) || node instanceof FunctionCallCP ) @@ -2290,11 +2259,8 @@ public class Dag<N extends Lop> * @param cellModeOverride override mode * @param copyTWrite ? * @return node output - * @throws DMLRuntimeException if DMLRuntimeException occurs - * @throws LopsException if LopsException occurs */ - private NodeOutput setupNodeOutputs(Lop node, ExecType et, boolean cellModeOverride, boolean copyTWrite) - throws DMLRuntimeException, LopsException { + private NodeOutput setupNodeOutputs(Lop node, ExecType et, boolean cellModeOverride, boolean copyTWrite) { OutputParameters oparams = node.getOutputParameters(); NodeOutput out = new NodeOutput(); @@ -2656,12 +2622,10 @@ public class Dag<N extends Lop> * @param deleteinst list of delete instructions * @param rmvarinst list of rmvar instructions * @param jt job type - * @throws LopsException if LopsException occurs - * @throws DMLRuntimeException if DMLRuntimeException occurs */ private void generateMapReduceInstructions(ArrayList<Lop> execNodes, ArrayList<Instruction> inst, ArrayList<Instruction> writeinst, ArrayList<Instruction> deleteinst, ArrayList<Instruction> rmvarinst, - JobType jt) throws LopsException, DMLRuntimeException + JobType jt) { ArrayList<Byte> resultIndices = new ArrayList<>(); ArrayList<String> inputs = new ArrayList<>(); @@ -2936,7 +2900,6 @@ public class Dag<N extends Lop> * @param inputLops list of input lops * @param MRJobLineNumbers MR job line numbers * @return -1 if problem - * @throws LopsException if LopsException occurs */ private int getAggAndOtherInstructions(Lop node, ArrayList<Lop> execNodes, ArrayList<String> shuffleInstructions, @@ -2944,7 +2907,7 @@ public class Dag<N extends Lop> ArrayList<String> otherInstructionsReducer, HashMap<Lop, Integer> nodeIndexMapping, int[] start_index, ArrayList<String> inputLabels, ArrayList<Lop> inputLops, - ArrayList<Integer> MRJobLineNumbers) throws LopsException + ArrayList<Integer> MRJobLineNumbers) { int ret_val = -1; @@ -3193,14 +3156,13 @@ public class Dag<N extends Lop> * @param inputLops list of input lops * @param MRJobLineNumbers MR job line numbers * @return -1 if problem - * @throws LopsException if LopsException occurs */ private static int getRecordReaderInstructions(Lop node, ArrayList<Lop> execNodes, ArrayList<String> inputStrings, ArrayList<String> recordReaderInstructions, HashMap<Lop, Integer> nodeIndexMapping, int[] start_index, ArrayList<String> inputLabels, ArrayList<Lop> inputLops, - ArrayList<Integer> MRJobLineNumbers) throws LopsException + ArrayList<Integer> MRJobLineNumbers) { // if input source, return index if (nodeIndexMapping.containsKey(node)) @@ -3294,14 +3256,13 @@ public class Dag<N extends Lop> * @param inputLabels input labels * @param MRJoblineNumbers MR job line numbers * @return -1 if problem - * @throws LopsException if LopsException occurs */ private int getMapperInstructions(Lop node, ArrayList<Lop> execNodes, ArrayList<String> inputStrings, ArrayList<String> instructionsInMapper, HashMap<Lop, Integer> nodeIndexMapping, int[] start_index, ArrayList<String> inputLabels, ArrayList<Lop> inputLops, - ArrayList<Integer> MRJobLineNumbers) throws LopsException + ArrayList<Integer> MRJobLineNumbers) { // if input source, return index if (nodeIndexMapping.containsKey(node)) @@ -3436,8 +3397,7 @@ public class Dag<N extends Lop> ArrayList<Long> numRows, ArrayList<Long> numCols, ArrayList<Long> numRowsPerBlock, ArrayList<Long> numColsPerBlock, HashMap<Lop, Integer> nodeIndexMapping, ArrayList<String> inputLabels, - ArrayList<Lop> inputLops, ArrayList<Integer> MRJobLineNumbers) - throws LopsException { + ArrayList<Lop> inputLops, ArrayList<Integer> MRJobLineNumbers) { // treat rand as an input. if (node.getType() == Type.DataGen && execNodes.contains(node) && !nodeIndexMapping.containsKey(node)) { @@ -3836,11 +3796,8 @@ public class Dag<N extends Lop> * * @param insts list of instructions * @return new list of potentially modified instructions - * @throws DMLRuntimeException in case of instruction parsing errors */ - private static ArrayList<Instruction> cleanupInstructions(ArrayList<Instruction> insts) - throws DMLRuntimeException - { + private static ArrayList<Instruction> cleanupInstructions(ArrayList<Instruction> insts) { //step 1: create mvvar instructions: assignvar s1 s2, rmvar s1 -> mvvar s1 s2 ArrayList<Instruction> tmp1 = collapseAssignvarAndRmvarInstructions(insts); @@ -3850,9 +3807,7 @@ public class Dag<N extends Lop> return tmp2; } - private static ArrayList<Instruction> collapseAssignvarAndRmvarInstructions(ArrayList<Instruction> insts) - throws DMLRuntimeException - { + private static ArrayList<Instruction> collapseAssignvarAndRmvarInstructions(ArrayList<Instruction> insts) { ArrayList<Instruction> ret = new ArrayList<>(); Iterator<Instruction> iter = insts.iterator(); while( iter.hasNext() ) { @@ -3880,9 +3835,7 @@ public class Dag<N extends Lop> return ret; } - private static ArrayList<Instruction> createPackedRmvarInstructions(ArrayList<Instruction> insts) - throws DMLRuntimeException - { + private static ArrayList<Instruction> createPackedRmvarInstructions(ArrayList<Instruction> insts) { ArrayList<Instruction> ret = new ArrayList<>(); ArrayList<String> currRmVar = new ArrayList<>(); for( Instruction inst : insts ) {
http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/compile/JobType.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/lops/compile/JobType.java b/src/main/java/org/apache/sysml/lops/compile/JobType.java index 2f55088..44502ab 100644 --- a/src/main/java/org/apache/sysml/lops/compile/JobType.java +++ b/src/main/java/org/apache/sysml/lops/compile/JobType.java @@ -128,7 +128,7 @@ public enum JobType return allowsNoOtherInstructions; } - public Lop.Type getShuffleLopType() throws DMLRuntimeException { + public Lop.Type getShuffleLopType() { if ( !allowsSingleShuffleInstruction ) throw new DMLRuntimeException("Shuffle Lop Type is not defined for a job (" + getName() + ") with allowsSingleShuffleInstruction=false."); else { @@ -187,8 +187,7 @@ public enum JobType } } - public boolean isCompatibleWithParentNodes() - throws DMLRuntimeException + public boolean isCompatibleWithParentNodes() { if ( !allowsSingleShuffleInstruction ) throw new DMLRuntimeException("isCompatibleWithParentNodes() can not be invoked for a job (" + getName() + ") with allowsSingleShuffleInstruction=false."); http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java b/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java index 2c04425..3c395de 100644 --- a/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java +++ b/src/main/java/org/apache/sysml/lops/runtime/RunMRJobs.java @@ -86,10 +86,8 @@ public class RunMRJobs * @param inst instruction * @param ec execution context * @return job status - * @throws DMLRuntimeException if DMLRuntimeException occurs */ public static JobReturn prepareAndSubmitJob( MRJobInstruction inst, ExecutionContext ec ) - throws DMLRuntimeException { // Obtain references to all input matrices MatrixObject[] inputMatrices = inst.extractInputMatrices(ec); @@ -105,7 +103,7 @@ public class RunMRJobs } //check input files - checkEmptyInputs( inst, inputMatrices ); + checkEmptyInputs( inst, inputMatrices ); } // Obtain references to all output matrices @@ -154,12 +152,10 @@ public class RunMRJobs * * @param inst instruction * @return job status - * @throws DMLRuntimeException if DMLRuntimeException occurs */ public static JobReturn submitJob(MRJobInstruction inst ) - throws DMLRuntimeException { - JobReturn ret = new JobReturn(); + JobReturn ret = new JobReturn(); MatrixObject[] inputMatrices = inst.getInputMatrices(); MatrixObject[] outputMatrices = inst.getOutputMatrices(); boolean execCP = false; @@ -385,9 +381,8 @@ public class RunMRJobs * @param varName variable name * @param map local variable map * @return string variable name - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - private static String getVarNameReplacement(String inst, String varName, LocalVariableMap map) throws DMLRuntimeException { + private static String getVarNameReplacement(String inst, String varName, LocalVariableMap map) { Data val = map.get(varName); if ( val != null ) { String replacement = null; @@ -410,9 +405,8 @@ public class RunMRJobs * @param inst string instruction * @param map local variable map * @return string instruction after replacement - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - private static String updateInstLabels(String inst, LocalVariableMap map) throws DMLRuntimeException { + private static String updateInstLabels(String inst, LocalVariableMap map) { if ( inst.contains(Lop.VARIABLE_NAME_PLACEHOLDER) ) { int skip = Lop.VARIABLE_NAME_PLACEHOLDER.toString().length(); while ( inst.contains(Lop.VARIABLE_NAME_PLACEHOLDER) ) { @@ -432,9 +426,8 @@ public class RunMRJobs * @param instList instruction list as string * @param labelValueMapping local variable map * @return instruction list after replacement - * @throws DMLRuntimeException if DMLRuntimeException occurs */ - public static String updateLabels (String instList, LocalVariableMap labelValueMapping) throws DMLRuntimeException { + public static String updateLabels (String instList, LocalVariableMap labelValueMapping) { if ( !instList.contains(Lop.VARIABLE_NAME_PLACEHOLDER) ) return instList; http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/AssignmentStatement.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/AssignmentStatement.java b/src/main/java/org/apache/sysml/parser/AssignmentStatement.java index 7746fb3..72b2ce8 100644 --- a/src/main/java/org/apache/sysml/parser/AssignmentStatement.java +++ b/src/main/java/org/apache/sysml/parser/AssignmentStatement.java @@ -34,7 +34,7 @@ public class AssignmentStatement extends Statement // rewrites statement to support function inlining (creates deep copy) @Override - public Statement rewriteStatement(String prefix) throws LanguageException { + public Statement rewriteStatement(String prefix) { // rewrite target (deep copy) DataIdentifier newTarget = (DataIdentifier) _targetList.get(0).rewriteExpression(prefix); // rewrite source (deep copy) @@ -55,12 +55,12 @@ public class AssignmentStatement extends Statement setParseInfo(parseInfo); } - public AssignmentStatement(ParserRuleContext ctx, DataIdentifier di, Expression exp) throws LanguageException { + public AssignmentStatement(ParserRuleContext ctx, DataIdentifier di, Expression exp) { this(di, exp); setCtxValues(ctx); } - public AssignmentStatement(ParserRuleContext ctx, DataIdentifier di, Expression exp, String filename) throws LanguageException { + public AssignmentStatement(ParserRuleContext ctx, DataIdentifier di, Expression exp, String filename) { this(ctx, di, exp); setFilename(filename); } http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/BinaryExpression.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/BinaryExpression.java b/src/main/java/org/apache/sysml/parser/BinaryExpression.java index c4f23ea..83dc3d0 100644 --- a/src/main/java/org/apache/sysml/parser/BinaryExpression.java +++ b/src/main/java/org/apache/sysml/parser/BinaryExpression.java @@ -29,7 +29,7 @@ public class BinaryExpression extends Expression private BinaryOp _opcode; @Override - public Expression rewriteExpression(String prefix) throws LanguageException{ + public Expression rewriteExpression(String prefix) { BinaryExpression newExpr = new BinaryExpression(this._opcode, this); newExpr.setLeft(_left.rewriteExpression(prefix)); newExpr.setRight(_right.rewriteExpression(prefix)); @@ -87,12 +87,10 @@ public class BinaryExpression extends Expression * Validate parse tree : Process Binary Expression in an assignment * statement * - * @throws LanguageException if LanguageException occurs */ @Override public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) - throws LanguageException - { + { //recursive validate if (_left instanceof FunctionCallIdentifier || _right instanceof FunctionCallIdentifier) { raiseValidateError("User-defined function calls not supported in binary expressions.", false, @@ -146,8 +144,7 @@ public class BinaryExpression extends Expression this.setOutput(output); } - private void checkAndSetDimensions(DataIdentifier output, boolean conditional) - throws LanguageException { + private void checkAndSetDimensions(DataIdentifier output, boolean conditional) { Identifier left = this.getLeft().getOutput(); Identifier right = this.getRight().getOutput(); Identifier pivot = null; http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/BooleanExpression.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/BooleanExpression.java b/src/main/java/org/apache/sysml/parser/BooleanExpression.java index 31d7b1f..688cc64 100644 --- a/src/main/java/org/apache/sysml/parser/BooleanExpression.java +++ b/src/main/java/org/apache/sysml/parser/BooleanExpression.java @@ -76,7 +76,7 @@ public class BooleanExpression extends Expression } @Override - public Expression rewriteExpression(String prefix) throws LanguageException{ + public Expression rewriteExpression(String prefix) { BooleanExpression newExpr = new BooleanExpression(this._opcode, this); newExpr.setLeft(_left.rewriteExpression(prefix)); if (_right != null) @@ -88,7 +88,7 @@ public class BooleanExpression extends Expression * Validate parse tree : Process Boolean Expression */ @Override - public void validateExpression(HashMap<String,DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) throws LanguageException{ + public void validateExpression(HashMap<String,DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) { //recursive validate getLeft().validateExpression(ids, constVars, conditional); if (_left instanceof FunctionCallIdentifier){ http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java b/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java index 60836cd..d6d63b5 100644 --- a/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java +++ b/src/main/java/org/apache/sysml/parser/BooleanIdentifier.java @@ -53,7 +53,7 @@ public class BooleanIdentifier extends ConstIdentifier } @Override - public Expression rewriteExpression(String prefix) throws LanguageException{ + public Expression rewriteExpression(String prefix) { return this; } http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java index 2da1f23..b597dd0 100644 --- a/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java +++ b/src/main/java/org/apache/sysml/parser/BuiltinFunctionExpression.java @@ -64,7 +64,7 @@ public class BuiltinFunctionExpression extends DataIdentifier } @Override - public Expression rewriteExpression(String prefix) throws LanguageException { + public Expression rewriteExpression(String prefix) { Expression[] newArgs = new Expression[_args.length]; for (int i = 0; i < _args.length; i++) { newArgs[i] = _args[i].rewriteExpression(prefix); @@ -99,7 +99,6 @@ public class BuiltinFunctionExpression extends DataIdentifier @Override public void validateExpression(MultiAssignmentStatement stmt, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) - throws LanguageException { if (this.getFirstExpr() instanceof FunctionCallIdentifier){ raiseValidateError("UDF function call not supported as parameter to built-in function call", false); @@ -251,8 +250,7 @@ public class BuiltinFunctionExpression extends DataIdentifier } } - private static ArrayList<ParameterExpression> orderConvolutionParams(ArrayList<ParameterExpression> paramExpression, - int skip) throws LanguageException { + private static ArrayList<ParameterExpression> orderConvolutionParams(ArrayList<ParameterExpression> paramExpression, int skip) { ArrayList<ParameterExpression> newParams = new ArrayList<>(); for(int i = 0; i < skip; i++) @@ -280,7 +278,7 @@ public class BuiltinFunctionExpression extends DataIdentifier } private static ArrayList<ParameterExpression> replaceListParams(ArrayList<ParameterExpression> paramExpression, - String inputVarName, String outputVarName, int startIndex) throws LanguageException { + String inputVarName, String outputVarName, int startIndex) { ArrayList<ParameterExpression> newParamExpression = new ArrayList<>(); int i = startIndex; int j = 1; // Assumption: sequential ordering pool_size1, pool_size2 @@ -297,7 +295,7 @@ public class BuiltinFunctionExpression extends DataIdentifier } private static ArrayList<ParameterExpression> expandListParams(ArrayList<ParameterExpression> paramExpression, - HashSet<String> paramsToExpand) throws LanguageException { + HashSet<String> paramsToExpand) { ArrayList<ParameterExpression> newParamExpressions = new ArrayList<>(); for(ParameterExpression expr : paramExpression) { if(paramsToExpand.contains(expr.getName())) { @@ -351,13 +349,10 @@ public class BuiltinFunctionExpression extends DataIdentifier /** * Validate parse tree : Process BuiltinFunction Expression in an assignment * statement - * - * @throws LanguageException if LanguageException occurs */ @Override - public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) - throws LanguageException { - + public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) + { for(int i=0; i < _args.length; i++ ) { if (_args[i] instanceof FunctionCallIdentifier){ @@ -1289,7 +1284,7 @@ public class BuiltinFunctionExpression extends DataIdentifier } } - private void setBinaryOutputProperties(DataIdentifier output) throws LanguageException { + private void setBinaryOutputProperties(DataIdentifier output) { DataType dt1 = getFirstExpr().getOutput().getDataType(); DataType dt2 = getSecondExpr().getOutput().getDataType(); DataType dtOut = (dt1==DataType.MATRIX || dt2==DataType.MATRIX) ? @@ -1304,7 +1299,7 @@ public class BuiltinFunctionExpression extends DataIdentifier output.setBlockDimensions (dims.getRowsPerBlock(), dims.getColsPerBlock()); } - private void setTernaryOutputProperties(DataIdentifier output, boolean conditional) throws LanguageException { + private void setTernaryOutputProperties(DataIdentifier output, boolean conditional) { DataType dt1 = getFirstExpr().getOutput().getDataType(); DataType dt2 = getSecondExpr().getOutput().getDataType(); DataType dt3 = getThirdExpr().getOutput().getDataType(); @@ -1354,9 +1349,7 @@ public class BuiltinFunctionExpression extends DataIdentifier return ( expr != null && expr instanceof ConstIdentifier ); } - private static double getDoubleValue(Expression expr) - throws LanguageException - { + private static double getDoubleValue(Expression expr) { if ( expr instanceof DoubleIdentifier ) return ((DoubleIdentifier)expr).getValue(); else if ( expr instanceof IntIdentifier) @@ -1397,7 +1390,7 @@ public class BuiltinFunctionExpression extends DataIdentifier } } - private void checkMathFunctionParam() throws LanguageException { + private void checkMathFunctionParam() { switch (this.getOpCode()) { case COS: case SIN: @@ -1466,9 +1459,7 @@ public class BuiltinFunctionExpression extends DataIdentifier return result; } - protected void checkNumParameters(int count) //always unconditional - throws LanguageException - { + protected void checkNumParameters(int count) { //always unconditional if (getFirstExpr() == null) { raiseValidateError("Missing argument for function " + this.getOpCode(), false, LanguageErrorCodes.INVALID_PARAMETERS); @@ -1485,7 +1476,7 @@ public class BuiltinFunctionExpression extends DataIdentifier } } - protected void checkMatrixParam(Expression e) throws LanguageException { + protected void checkMatrixParam(Expression e) { if (e.getOutput().getDataType() != DataType.MATRIX) { raiseValidateError( "Expecting matrix argument for function " + this.getOpCode().toString().toLowerCase() + "().", @@ -1493,41 +1484,31 @@ public class BuiltinFunctionExpression extends DataIdentifier } } - protected void checkMatrixFrameParam(Expression e) //always unconditional - throws LanguageException - { + protected void checkMatrixFrameParam(Expression e) { //always unconditional if (e.getOutput().getDataType() != DataType.MATRIX && e.getOutput().getDataType() != DataType.FRAME) { raiseValidateError("Expecting matrix or frame parameter for function "+ getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS); } } - protected void checkMatrixScalarParam(Expression e) //always unconditional - throws LanguageException - { + protected void checkMatrixScalarParam(Expression e) { //always unconditional if (e.getOutput().getDataType() != DataType.MATRIX && e.getOutput().getDataType() != DataType.SCALAR) { raiseValidateError("Expecting matrix or scalar parameter for function "+ getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS); } } - private void checkScalarParam(Expression e) //always unconditional - throws LanguageException - { + private void checkScalarParam(Expression e) { //always unconditional if (e.getOutput().getDataType() != DataType.SCALAR) { raiseValidateError("Expecting scalar parameter for function " + this.getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS); } } - private void checkScalarFrameParam(Expression e) //always unconditional - throws LanguageException - { + private void checkScalarFrameParam(Expression e) { //always unconditional if (e.getOutput().getDataType() != DataType.SCALAR && e.getOutput().getDataType() != DataType.FRAME) { raiseValidateError("Expecting scalar parameter for function " + this.getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS); } } - private void checkValueTypeParam(Expression e, ValueType vt) //always unconditional - throws LanguageException - { + private void checkValueTypeParam(Expression e, ValueType vt) { //always unconditional if (e.getOutput().getValueType() != vt) { raiseValidateError("Expecting parameter of different value type " + this.getOpCode(), false, LanguageErrorCodes.UNSUPPORTED_PARAMETERS); } @@ -1541,9 +1522,7 @@ public class BuiltinFunctionExpression extends DataIdentifier return (e.getOutput().getDim1() != -1 && e.getOutput().getDim2() != -1); } - private void check1DMatrixParam(Expression e) //always unconditional - throws LanguageException - { + private void check1DMatrixParam(Expression e) { //always unconditional checkMatrixParam(e); // throw an exception, when e's output is NOT a one-dimensional matrix @@ -1554,16 +1533,15 @@ public class BuiltinFunctionExpression extends DataIdentifier } } - private void checkMatchingDimensions(Expression expr1, Expression expr2) throws LanguageException { + private void checkMatchingDimensions(Expression expr1, Expression expr2) { checkMatchingDimensions(expr1, expr2, false); } - private void checkMatchingDimensions(Expression expr1, Expression expr2, boolean allowsMV) throws LanguageException { + private void checkMatchingDimensions(Expression expr1, Expression expr2, boolean allowsMV) { checkMatchingDimensions(expr1, expr2, allowsMV, false); } private void checkMatchingDimensions(Expression expr1, Expression expr2, boolean allowsMV, boolean conditional) - throws LanguageException { if (expr1 != null && expr2 != null) { @@ -1585,7 +1563,6 @@ public class BuiltinFunctionExpression extends DataIdentifier } private void checkMatchingDimensionsQuantile() - throws LanguageException { if (getFirstExpr().getOutput().getDim1() != getSecondExpr().getOutput().getDim1()) { raiseValidateError("Mismatch in matrix dimensions for " @@ -1817,11 +1794,8 @@ public class BuiltinFunctionExpression extends DataIdentifier * @param vt Value type ({@code ValueType.DOUBLE}, {@code ValueType.INT}, or {@code ValueType.BOOLEAN}). * @return Built-in function operator ({@code BuiltinFunctionOp.AS_DOUBLE}, * {@code BuiltinFunctionOp.AS_INT}, or {@code BuiltinFunctionOp.AS_BOOLEAN}). - * @throws LanguageException thrown if ValueType not accepted */ - public static BuiltinFunctionOp getValueTypeCastOperator( ValueType vt ) - throws LanguageException - { + public static BuiltinFunctionOp getValueTypeCastOperator( ValueType vt ) { switch( vt ) { case DOUBLE: http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ConstIdentifier.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/ConstIdentifier.java b/src/main/java/org/apache/sysml/parser/ConstIdentifier.java index 4d7ffb1..3809969 100644 --- a/src/main/java/org/apache/sysml/parser/ConstIdentifier.java +++ b/src/main/java/org/apache/sysml/parser/ConstIdentifier.java @@ -21,11 +21,9 @@ package org.apache.sysml.parser; public abstract class ConstIdentifier extends Identifier { - public ConstIdentifier(){ super(); } - public abstract long getLongValue() - throws LanguageException; + public abstract long getLongValue(); } http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DMLProgram.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/DMLProgram.java b/src/main/java/org/apache/sysml/parser/DMLProgram.java index 6bc5847..c5f94ed 100644 --- a/src/main/java/org/apache/sysml/parser/DMLProgram.java +++ b/src/main/java/org/apache/sysml/parser/DMLProgram.java @@ -76,7 +76,7 @@ public class DMLProgram return retVal; } - public HashMap<String, FunctionStatementBlock> getFunctionStatementBlocks(String namespaceKey) throws LanguageException{ + public HashMap<String, FunctionStatementBlock> getFunctionStatementBlocks(String namespaceKey) { DMLProgram namespaceProgram = this.getNamespaces().get(namespaceKey); if (namespaceProgram == null){ LOG.error("ERROR: namespace " + namespaceKey + " is undefined"); @@ -94,9 +94,7 @@ public class DMLProgram return ret; } - public ArrayList<FunctionStatementBlock> getFunctionStatementBlocks() - throws LanguageException - { + public ArrayList<FunctionStatementBlock> getFunctionStatementBlocks() { ArrayList<FunctionStatementBlock> ret = new ArrayList<>(); for( DMLProgram nsProg : _namespaces.values() ) @@ -105,9 +103,7 @@ public class DMLProgram return ret; } - public void addFunctionStatementBlock( String namespace, String fname, FunctionStatementBlock fsb ) - throws LanguageException - { + public void addFunctionStatementBlock( String namespace, String fname, FunctionStatementBlock fsb ) { DMLProgram namespaceProgram = this.getNamespaces().get(namespace); if (namespaceProgram == null) throw new LanguageException( "Namespace does not exist." ); http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DMLTranslator.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/DMLTranslator.java b/src/main/java/org/apache/sysml/parser/DMLTranslator.java index 8a0c5df..b0b1938 100644 --- a/src/main/java/org/apache/sysml/parser/DMLTranslator.java +++ b/src/main/java/org/apache/sysml/parser/DMLTranslator.java @@ -109,12 +109,8 @@ public class DMLTranslator * Validate parse tree * * @param dmlp dml program - * @throws LanguageException if LanguageException occurs - * @throws ParseException if ParseException occurs - * @throws IOException if IOException occurs */ public void validateParseTree(DMLProgram dmlp) - throws LanguageException, ParseException, IOException { //STEP1: Pre-processing steps for validate - e.g., prepare read-after-write meta data boolean fWriteRead = prepareReadAfterWrite(dmlp, new HashMap<String, DataIdentifier>()); @@ -168,7 +164,7 @@ public class DMLTranslator } } - public void liveVariableAnalysis(DMLProgram dmlp) throws LanguageException { + public void liveVariableAnalysis(DMLProgram dmlp) { // for each namespace, handle function program blocks -- forward direction for (String namespaceKey : dmlp.getNamespaces().keySet()) { @@ -235,12 +231,8 @@ public class DMLTranslator * Construct Hops from parse tree * * @param dmlp dml program - * @throws ParseException if ParseException occurs - * @throws LanguageException if LanguageException occurs */ - public void constructHops(DMLProgram dmlp) - throws ParseException, LanguageException - { + public void constructHops(DMLProgram dmlp) { // Step 1: construct hops for all functions // for each namespace, handle function program blocks for (String namespaceKey : dmlp.getNamespaces().keySet()){ @@ -259,7 +251,6 @@ public class DMLTranslator } public void rewriteHopsDAG(DMLProgram dmlp) - throws ParseException, LanguageException, HopsException, DMLRuntimeException { //apply hop rewrites (static rewrites) ProgramRewriter rewriter = new ProgramRewriter(true, false); @@ -298,25 +289,19 @@ public class DMLTranslator } } - public void codgenHopsDAG(DMLProgram dmlp) - throws LanguageException, HopsException, DMLRuntimeException - { + public void codgenHopsDAG(DMLProgram dmlp) { SpoofCompiler.generateCode(dmlp); } - public void codgenHopsDAG(Program rtprog) - throws LanguageException, HopsException, DMLRuntimeException, LopsException, IOException - { + public void codgenHopsDAG(Program rtprog) { SpoofCompiler.generateCode(rtprog); } - public void codgenHopsDAG(ProgramBlock pb) - throws HopsException, DMLRuntimeException, LopsException, IOException - { + public void codgenHopsDAG(ProgramBlock pb) { SpoofCompiler.generateCodeFromProgramBlock(pb); } - public void constructLops(DMLProgram dmlp) throws ParseException, LanguageException, HopsException, LopsException { + public void constructLops(DMLProgram dmlp) { // for each namespace, handle function program blocks handle function for( String namespaceKey : dmlp.getNamespaces().keySet() ) for( FunctionStatementBlock fsb : dmlp.getFunctionStatementBlocks(namespaceKey).values() ) @@ -328,7 +313,6 @@ public class DMLTranslator } public boolean constructLops(StatementBlock sb) - throws HopsException, LopsException { boolean ret = false; @@ -456,9 +440,7 @@ public class DMLTranslator return rtprog ; } - public ProgramBlock createRuntimeProgramBlock(Program prog, StatementBlock sb, DMLConfig config) - throws IOException, LopsException, DMLRuntimeException - { + public ProgramBlock createRuntimeProgramBlock(Program prog, StatementBlock sb, DMLConfig config) { Dag<Lop> dag = null; Dag<Lop> pred_dag = null; @@ -711,7 +693,7 @@ public class DMLTranslator return retPB; } - public void printLops(DMLProgram dmlp) throws ParseException, LanguageException, HopsException, LopsException { + public void printLops(DMLProgram dmlp) { if (LOG.isDebugEnabled()){ // for each namespace, handle function program blocks for (String namespaceKey : dmlp.getNamespaces().keySet()){ @@ -728,7 +710,7 @@ public class DMLTranslator } } - public void printLops(StatementBlock current) throws ParseException, HopsException, LopsException { + public void printLops(StatementBlock current) { if (LOG.isDebugEnabled()){ ArrayList<Lop> lopsDAG = current.getLops(); @@ -842,7 +824,7 @@ public class DMLTranslator } } - public void refreshMemEstimates(DMLProgram dmlp) throws ParseException, LanguageException, HopsException { + public void refreshMemEstimates(DMLProgram dmlp) { // for each namespace, handle function program blocks -- forward direction for (String namespaceKey : dmlp.getNamespaces().keySet()){ @@ -859,7 +841,7 @@ public class DMLTranslator } } - public void refreshMemEstimates(StatementBlock current) throws ParseException, HopsException { + public void refreshMemEstimates(StatementBlock current) { MemoTable memo = new MemoTable(); @@ -926,7 +908,7 @@ public class DMLTranslator } } - public static void resetHopsDAGVisitStatus(DMLProgram dmlp) throws ParseException, LanguageException, HopsException { + public static void resetHopsDAGVisitStatus(DMLProgram dmlp) { // for each namespace, handle function program blocks -- forward direction for (String namespaceKey : dmlp.getNamespaces().keySet()){ @@ -943,7 +925,7 @@ public class DMLTranslator } } - public static void resetHopsDAGVisitStatus(StatementBlock current) throws ParseException, HopsException { + public static void resetHopsDAGVisitStatus(StatementBlock current) { if( HopRewriteUtils.isLastLevelStatementBlock(current) ) { ArrayList<Hop> hopsDAG = current.getHops(); @@ -998,7 +980,7 @@ public class DMLTranslator } } - public void resetLopsDAGVisitStatus(DMLProgram dmlp) throws HopsException, LanguageException { + public void resetLopsDAGVisitStatus(DMLProgram dmlp) { // for each namespace, handle function program blocks for (String namespaceKey : dmlp.getNamespaces().keySet()){ @@ -1014,7 +996,7 @@ public class DMLTranslator } } - public void resetLopsDAGVisitStatus(StatementBlock current) throws HopsException { + public void resetLopsDAGVisitStatus(StatementBlock current) { ArrayList<Hop> hopsDAG = current.getHops(); @@ -1085,9 +1067,7 @@ public class DMLTranslator } - public void constructHops(StatementBlock sb) - throws ParseException, LanguageException { - + public void constructHops(StatementBlock sb) { if (sb instanceof WhileStatementBlock) { constructHopsForWhileControlBlock((WhileStatementBlock) sb); return; @@ -1419,8 +1399,7 @@ public class DMLTranslator } - public void constructHopsForIfControlBlock(IfStatementBlock sb) throws ParseException, LanguageException { - + public void constructHopsForIfControlBlock(IfStatementBlock sb) { IfStatement ifsb = (IfStatement) sb.getStatement(0); ArrayList<StatementBlock> ifBody = ifsb.getIfBody(); ArrayList<StatementBlock> elseBody = ifsb.getElseBody(); @@ -1443,48 +1422,30 @@ public class DMLTranslator * Constructs Hops for a given ForStatementBlock or ParForStatementBlock, respectively. * * @param sb for statement block - * @throws ParseException if ParseException occurs - * @throws LanguageException if LanguageException occurs */ - public void constructHopsForForControlBlock(ForStatementBlock sb) - throws ParseException, LanguageException - { - + public void constructHopsForForControlBlock(ForStatementBlock sb) { ForStatement fs = (ForStatement) sb.getStatement(0); ArrayList<StatementBlock> body = fs.getBody(); - - // construct hops for iterable predicate constructHopsForIterablePredicate(sb); - - for( StatementBlock current : body ) { + for( StatementBlock current : body ) constructHops(current); - } } - public void constructHopsForFunctionControlBlock(FunctionStatementBlock fsb) throws ParseException, LanguageException { - + public void constructHopsForFunctionControlBlock(FunctionStatementBlock fsb) { ArrayList<StatementBlock> body = ((FunctionStatement)fsb.getStatement(0)).getBody(); - - for( StatementBlock current : body ) { + for( StatementBlock current : body ) constructHops(current); - } } - public void constructHopsForWhileControlBlock(WhileStatementBlock sb) - throws ParseException, LanguageException { - + public void constructHopsForWhileControlBlock(WhileStatementBlock sb) { ArrayList<StatementBlock> body = ((WhileStatement)sb.getStatement(0)).getBody(); - - // construct hops for while predicate constructHopsForConditionalPredicate(sb); - - for( StatementBlock current : body ) { + for( StatementBlock current : body ) constructHops(current); - } } - public void constructHopsForConditionalPredicate(StatementBlock passedSB) throws ParseException { + public void constructHopsForConditionalPredicate(StatementBlock passedSB) { HashMap<String, Hop> _ids = new HashMap<>(); @@ -1582,10 +1543,8 @@ public class DMLTranslator * Method used for both ForStatementBlock and ParForStatementBlock. * * @param fsb for statement block - * @throws ParseException if ParseException occurs */ public void constructHopsForIterablePredicate(ForStatementBlock fsb) - throws ParseException { HashMap<String, Hop> _ids = new HashMap<>(); @@ -1643,10 +1602,9 @@ public class DMLTranslator * @param target data identifier * @param hops map of high-level operators * @return high-level operator - * @throws ParseException if ParseException occurs */ - private Hop processExpression(Expression source, DataIdentifier target, HashMap<String, Hop> hops) throws ParseException { - try { + private Hop processExpression(Expression source, DataIdentifier target, HashMap<String, Hop> hops) { + try { if( source instanceof BinaryExpression ) return processBinaryExpression((BinaryExpression) source, target, hops); else if( source instanceof RelationalExpression ) @@ -1724,25 +1682,20 @@ public class DMLTranslator * * @param source source expression * @param hops map of high-level operators - * @return high-level operator - * @throws ParseException if ParseException occurs + * @return high-level operatos */ - private Hop processTempIntExpression( Expression source, HashMap<String, Hop> hops ) - throws ParseException - { + private Hop processTempIntExpression( Expression source, HashMap<String, Hop> hops ) { if( source == null ) return null; - - DataIdentifier tmpOut = createTarget(); + DataIdentifier tmpOut = createTarget(); tmpOut.setDataType(DataType.SCALAR); - tmpOut.setValueType(ValueType.INT); + tmpOut.setValueType(ValueType.INT); source.setOutput(tmpOut); - return processExpression(source, tmpOut, hops ); + return processExpression(source, tmpOut, hops ); } private Hop processLeftIndexedExpression(Expression source, IndexedIdentifier target, HashMap<String, Hop> hops) - throws ParseException { - + { // process target indexed expressions Hop rowLowerHops = null, rowUpperHops = null, colLowerHops = null, colUpperHops = null; @@ -1804,9 +1757,7 @@ public class DMLTranslator } - private Hop processIndexingExpression(IndexedIdentifier source, DataIdentifier target, HashMap<String, Hop> hops) - throws ParseException { - + private Hop processIndexingExpression(IndexedIdentifier source, DataIdentifier target, HashMap<String, Hop> hops) { // process Hops for indexes (for source) Hop rowLowerHops = null, rowUpperHops = null, colLowerHops = null, colUpperHops = null; @@ -1867,10 +1818,8 @@ public class DMLTranslator * @param target data identifier * @param hops map of high-level operators * @return high-level operator - * @throws ParseException if ParseException occurs */ private Hop processBinaryExpression(BinaryExpression source, DataIdentifier target, HashMap<String, Hop> hops) - throws ParseException { Hop left = processExpression(source.getLeft(), null, hops); Hop right = processExpression(source.getRight(), null, hops); @@ -1915,8 +1864,7 @@ public class DMLTranslator } - private Hop processRelationalExpression(RelationalExpression source, DataIdentifier target, - HashMap<String, Hop> hops) throws ParseException { + private Hop processRelationalExpression(RelationalExpression source, DataIdentifier target, HashMap<String, Hop> hops) { Hop left = processExpression(source.getLeft(), null, hops); Hop right = processExpression(source.getRight(), null, hops); @@ -1959,7 +1907,6 @@ public class DMLTranslator } private Hop processBooleanExpression(BooleanExpression source, DataIdentifier target, HashMap<String, Hop> hops) - throws ParseException { // Boolean Not has a single parameter boolean constLeft = (source.getLeft().getOutput() instanceof ConstIdentifier); @@ -2010,7 +1957,7 @@ public class DMLTranslator } } - private static Hop constructDfHop(String name, DataType dt, ValueType vt, ParameterizedBuiltinFunctionOp op, HashMap<String,Hop> paramHops) throws HopsException { + private static Hop constructDfHop(String name, DataType dt, ValueType vt, ParameterizedBuiltinFunctionOp op, HashMap<String,Hop> paramHops) { // Add a hop to paramHops to store distribution information. // Distribution parameter hops would have been already present in paramHops. @@ -2051,7 +1998,7 @@ public class DMLTranslator } private Hop processMultipleReturnParameterizedBuiltinFunctionExpression(ParameterizedBuiltinFunctionExpression source, ArrayList<DataIdentifier> targetList, - HashMap<String, Hop> hops) throws ParseException + HashMap<String, Hop> hops) { FunctionType ftype = FunctionType.MULTIRETURN_BUILTIN; String nameSpace = DMLProgram.INTERNAL_NAMESPACE; @@ -2098,11 +2045,9 @@ public class DMLTranslator * @param target data identifier * @param hops map of high-level operators * @return high-level operator - * @throws ParseException if ParseException occurs - * @throws HopsException if HopsException occurs */ private Hop processParameterizedBuiltinFunctionExpression(ParameterizedBuiltinFunctionExpression source, DataIdentifier target, - HashMap<String, Hop> hops) throws ParseException, HopsException { + HashMap<String, Hop> hops) { // this expression has multiple "named" parameters HashMap<String, Hop> paramHops = new HashMap<>(); @@ -2215,11 +2160,9 @@ public class DMLTranslator * @param target data identifier * @param hops map of high-level operators * @return high-level operator - * @throws ParseException if ParseException occurs - * @throws HopsException if HopsException occurs */ private Hop processDataExpression(DataExpression source, DataIdentifier target, - HashMap<String, Hop> hops) throws ParseException, HopsException { + HashMap<String, Hop> hops) { // this expression has multiple "named" parameters HashMap<String, Hop> paramHops = new HashMap<>(); @@ -2295,10 +2238,9 @@ public class DMLTranslator * @param targetList list of data identifiers * @param hops map of high-level operators * @return high-level operator - * @throws ParseException if ParseException occurs */ private Hop processMultipleReturnBuiltinFunctionExpression(BuiltinFunctionExpression source, ArrayList<DataIdentifier> targetList, - HashMap<String, Hop> hops) throws ParseException { + HashMap<String, Hop> hops) { // Construct Hops for all inputs ArrayList<Hop> inputs = new ArrayList<>(); @@ -2359,11 +2301,9 @@ public class DMLTranslator * @param target data identifier * @param hops map of high-level operators * @return high-level operator - * @throws ParseException if ParseException occurs - * @throws HopsException if HopsException occurs */ private Hop processBuiltinFunctionExpression(BuiltinFunctionExpression source, DataIdentifier target, - HashMap<String, Hop> hops) throws ParseException, HopsException { + HashMap<String, Hop> hops) { Hop expr = processExpression(source.getFirstExpr(), null, hops); Hop expr2 = null; if (source.getSecondExpr() != null) { @@ -3077,7 +3017,7 @@ public class DMLTranslator return currBuiltinOp; } - private Hop[] processAllExpressions(Expression[] expr, HashMap<String, Hop> hops) throws ParseException { + private Hop[] processAllExpressions(Expression[] expr, HashMap<String, Hop> hops) { Hop[] ret = new Hop[expr.length]; for(int i=0; i<expr.length; i++) ret[i] = processExpression(expr[i], null, hops); @@ -3090,7 +3030,7 @@ public class DMLTranslator HopRewriteUtils.copyLineNumbers(in, out); } - private ArrayList<Hop> getALHopsForConvOpPoolingCOL2IM(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) throws ParseException { + private ArrayList<Hop> getALHopsForConvOpPoolingCOL2IM(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) { ArrayList<Hop> ret = new ArrayList<>(); ret.add(first); Expression[] allExpr = source.getAllExpr(); @@ -3105,7 +3045,7 @@ public class DMLTranslator return ret; } - private ArrayList<Hop> getALHopsForPoolingForwardIM2COL(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) throws ParseException { + private ArrayList<Hop> getALHopsForPoolingForwardIM2COL(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) { ArrayList<Hop> ret = new ArrayList<>(); ret.add(first); Expression[] allExpr = source.getAllExpr(); @@ -3126,7 +3066,7 @@ public class DMLTranslator } @SuppressWarnings("unused") //TODO remove if not used - private ArrayList<Hop> getALHopsForConvOpPoolingIM2COL(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) throws ParseException { + private ArrayList<Hop> getALHopsForConvOpPoolingIM2COL(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) { ArrayList<Hop> ret = new ArrayList<Hop>(); ret.add(first); Expression[] allExpr = source.getAllExpr(); @@ -3157,7 +3097,7 @@ public class DMLTranslator return ret; } - private ArrayList<Hop> getALHopsForConvOp(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) throws ParseException { + private ArrayList<Hop> getALHopsForConvOp(Hop first, BuiltinFunctionExpression source, int skip, HashMap<String, Hop> hops) { ArrayList<Hop> ret = new ArrayList<>(); ret.add(first); Expression[] allExpr = source.getAllExpr(); @@ -3178,9 +3118,7 @@ public class DMLTranslator h.setColsInBlock(id.getColumnsInBlock()); } - private boolean prepareReadAfterWrite( DMLProgram prog, HashMap<String, DataIdentifier> pWrites ) - throws LanguageException - { + private boolean prepareReadAfterWrite( DMLProgram prog, HashMap<String, DataIdentifier> pWrites ) { boolean ret = false; //process functions http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DataExpression.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/DataExpression.java b/src/main/java/org/apache/sysml/parser/DataExpression.java index fa762f5..46757f4 100644 --- a/src/main/java/org/apache/sysml/parser/DataExpression.java +++ b/src/main/java/org/apache/sysml/parser/DataExpression.java @@ -137,14 +137,13 @@ public class DataExpression extends DataIdentifier } public static DataExpression getDataExpression(ParserRuleContext ctx, String functionName, - ArrayList<ParameterExpression> passedParamExprs, String filename, CustomErrorListener errorListener) - throws LanguageException { + ArrayList<ParameterExpression> passedParamExprs, String filename, CustomErrorListener errorListener) { ParseInfo pi = ParseInfo.ctxAndFilenameToParseInfo(ctx, filename); return getDataExpression(functionName, passedParamExprs, pi, errorListener); } public static DataExpression getDataExpression(String functionName, ArrayList<ParameterExpression> passedParamExprs, - ParseInfo parseInfo, CustomErrorListener errorListener) throws LanguageException { + ParseInfo parseInfo, CustomErrorListener errorListener) { if (functionName == null || passedParamExprs == null) return null; @@ -296,7 +295,6 @@ public class DataExpression extends DataIdentifier } // end method getBuiltinFunctionExpression public void addRandExprParam(String paramName, Expression paramValue) - throws LanguageException { if (DMLScript.VALIDATOR_IGNORE_ISSUES && (paramValue == null)) { return; @@ -334,7 +332,6 @@ public class DataExpression extends DataIdentifier } public void addMatrixExprParam(String paramName, Expression paramValue) - throws LanguageException { // check name is valid boolean found = false; @@ -381,7 +378,7 @@ public class DataExpression extends DataIdentifier } @Override - public Expression rewriteExpression(String prefix) throws LanguageException { + public Expression rewriteExpression(String prefix) { HashMap<String,Expression> newVarParams = new HashMap<>(); for( Entry<String, Expression> e : _varParams.entrySet() ){ @@ -480,9 +477,7 @@ public class DataExpression extends DataIdentifier _varParams.remove(name); } - private String getInputFileName(HashMap<String, ConstIdentifier> currConstVars, boolean conditional) - throws LanguageException - { + private String getInputFileName(HashMap<String, ConstIdentifier> currConstVars, boolean conditional) { String filename = null; Expression fileNameExpr = getVarParam(IO_FILENAME); @@ -513,7 +508,7 @@ public class DataExpression extends DataIdentifier return filename; } - public static String getMTDFileName(String inputFileName) throws LanguageException { + public static String getMTDFileName(String inputFileName) { return inputFileName + ".mtd"; } @@ -523,8 +518,7 @@ public class DataExpression extends DataIdentifier */ @Override public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional) - throws LanguageException - { + { // validate all input parameters for ( Entry<String,Expression> e : getVarParams().entrySet() ) { String s = e.getKey(); @@ -1603,7 +1597,6 @@ public class DataExpression extends DataIdentifier private String fileNameCat(BinaryExpression expr, HashMap<String, ConstIdentifier> currConstVars, String filename, boolean conditional) - throws LanguageException { // Processing the left node first if (expr.getLeft() instanceof BinaryExpression @@ -1693,7 +1686,6 @@ public class DataExpression extends DataIdentifier @SuppressWarnings("unchecked") private void parseMetaDataFileParameters(String mtdFileName, JSONObject configObject, boolean conditional) - throws LanguageException { for( Object obj : configObject.entrySet() ){ Entry<Object,Object> e = (Entry<Object, Object>) obj; @@ -1781,7 +1773,6 @@ public class DataExpression extends DataIdentifier } public JSONObject readMetadataFile(String filename, boolean conditional) - throws LanguageException { JSONObject retVal = null; boolean exists = MapReduceTool.existsFileOnHDFS(filename); @@ -1838,7 +1829,6 @@ public class DataExpression extends DataIdentifier } public String[] readMatrixMarketFile(String filename, boolean conditional) - throws LanguageException { String[] retVal = new String[2]; retVal[0] = new String(""); @@ -1887,7 +1877,6 @@ public class DataExpression extends DataIdentifier } public boolean checkHasMatrixMarketFormat(String inputFileName, String mtdFileName, boolean conditional) - throws LanguageException { // Check the MTD file exists. if there is an MTD file, return false. JSONObject mtdObject = readMetadataFile(mtdFileName, conditional); @@ -1918,9 +1907,7 @@ public class DataExpression extends DataIdentifier return false; } - public boolean checkHasDelimitedFormat(String filename, boolean conditional) - throws LanguageException - { + public boolean checkHasDelimitedFormat(String filename, boolean conditional) { // if the MTD file exists, check the format is not binary JSONObject mtdObject = readMetadataFile(filename + ".mtd", conditional); if (mtdObject != null) { http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DataIdentifier.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/DataIdentifier.java b/src/main/java/org/apache/sysml/parser/DataIdentifier.java index 34caf4e..8d8c749 100644 --- a/src/main/java/org/apache/sysml/parser/DataIdentifier.java +++ b/src/main/java/org/apache/sysml/parser/DataIdentifier.java @@ -35,7 +35,7 @@ public class DataIdentifier extends Identifier } @Override - public Expression rewriteExpression(String prefix) throws LanguageException{ + public Expression rewriteExpression(String prefix) { DataIdentifier newId = new DataIdentifier(this); String newIdName = prefix + _name; newId.setName(newIdName); @@ -81,9 +81,8 @@ public class DataIdentifier extends Identifier * This method must be overridden by all child classes. * * @return true if expression returns multiple outputs - * @throws LanguageException if LanguageException occurs */ - public boolean multipleReturns() throws LanguageException { + public boolean multipleReturns() { throw new LanguageException("multipleReturns() must be overridden in the subclass."); } http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java b/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java index 9e620a8..71c88a0 100644 --- a/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java +++ b/src/main/java/org/apache/sysml/parser/DoubleIdentifier.java @@ -62,7 +62,7 @@ public class DoubleIdentifier extends ConstIdentifier } @Override - public Expression rewriteExpression(String prefix) throws LanguageException{ + public Expression rewriteExpression(String prefix) { return this; } http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/Expression.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/Expression.java b/src/main/java/org/apache/sysml/parser/Expression.java index 2a6503d..431e21d 100644 --- a/src/main/java/org/apache/sysml/parser/Expression.java +++ b/src/main/java/org/apache/sysml/parser/Expression.java @@ -213,7 +213,7 @@ public abstract class Expression implements ParseInfo _outputs = null; } - public abstract Expression rewriteExpression(String prefix) throws LanguageException; + public abstract Expression rewriteExpression(String prefix); public void setOutput(Identifier output) { if ( _outputs == null) { @@ -242,15 +242,11 @@ public abstract class Expression implements ParseInfo return _outputs; } - public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional) - throws LanguageException - { + public void validateExpression(HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional) { raiseValidateError("Should never be invoked in Baseclass 'Expression'", false); } - public void validateExpression(MultiAssignmentStatement mas, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional) - throws LanguageException - { + public void validateExpression(MultiAssignmentStatement mas, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> currConstVars, boolean conditional) { raiseValidateError("Should never be invoked in Baseclass 'Expression'", false); } @@ -384,9 +380,8 @@ public abstract class Expression implements ParseInfo * @param expression2 Second expression * @param cast Whether a cast should potentially be performed * @return The data type ({@link DataType}) - * @throws LanguageException if LanguageException occurs */ - public static DataType computeDataType(Expression expression1, Expression expression2, boolean cast) throws LanguageException { + public static DataType computeDataType(Expression expression1, Expression expression2, boolean cast) { return computeDataType(expression1.getOutput(), expression2.getOutput(), cast); } @@ -399,9 +394,8 @@ public abstract class Expression implements ParseInfo * @param identifier2 Second identifier * @param cast Whether a cast should potentially be performed * @return The data type ({@link DataType}) - * @throws LanguageException if LanguageException occurs */ - public static DataType computeDataType(Identifier identifier1, Identifier identifier2, boolean cast) throws LanguageException { + public static DataType computeDataType(Identifier identifier1, Identifier identifier2, boolean cast) { DataType d1 = identifier1.getDataType(); DataType d2 = identifier2.getDataType(); @@ -432,9 +426,8 @@ public abstract class Expression implements ParseInfo * @param expression2 Second expression * @param cast Whether a cast should potentially be performed * @return The value type ({@link ValueType}) - * @throws LanguageException if LanguageException occurs */ - public static ValueType computeValueType(Expression expression1, Expression expression2, boolean cast) throws LanguageException { + public static ValueType computeValueType(Expression expression1, Expression expression2, boolean cast) { return computeValueType(expression1.getOutput(), expression2.getOutput(), cast); } @@ -448,9 +441,8 @@ public abstract class Expression implements ParseInfo * @param identifier2 Second identifier * @param cast Whether a cast should potentially be performed * @return The value type ({@link ValueType}) - * @throws LanguageException if LanguageException occurs */ - public static ValueType computeValueType(Identifier identifier1, Identifier identifier2, boolean cast) throws LanguageException { + public static ValueType computeValueType(Identifier identifier1, Identifier identifier2, boolean cast) { ValueType v1 = identifier1.getValueType(); ValueType v2 = identifier2.getValueType(); @@ -506,9 +498,8 @@ public abstract class Expression implements ParseInfo * Throw a LanguageException with the message. * * @param message the error message - * @throws LanguageException if LanguageException occurs */ - public void raiseValidateError( String message ) throws LanguageException { + public void raiseValidateError( String message ) { raiseValidateError(message, false, null); } @@ -519,9 +510,8 @@ public abstract class Expression implements ParseInfo * @param message the error (or warning) message * @param conditional if {@code true}, display log warning message. Otherwise, the message * will be thrown as a LanguageException - * @throws LanguageException thrown if conditional is {@code false}. */ - public void raiseValidateError( String message, boolean conditional ) throws LanguageException { + public void raiseValidateError( String message, boolean conditional ) { raiseValidateError(message, conditional, null); } @@ -533,9 +523,8 @@ public abstract class Expression implements ParseInfo * @param conditional if {@code true}, display log warning message. Otherwise, the message (and optional * error code) will be thrown as a LanguageException * @param errorCode optional error code - * @throws LanguageException thrown if conditional is {@code false}. */ - public void raiseValidateError(String msg, boolean conditional, String errorCode) throws LanguageException { + public void raiseValidateError(String msg, boolean conditional, String errorCode) { if (conditional) {// warning if conditional String fullMsg = this.printWarningLocation() + msg; LOG.warn(fullMsg); http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ExpressionList.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/ExpressionList.java b/src/main/java/org/apache/sysml/parser/ExpressionList.java index 653293c..0382c73 100644 --- a/src/main/java/org/apache/sysml/parser/ExpressionList.java +++ b/src/main/java/org/apache/sysml/parser/ExpressionList.java @@ -45,7 +45,7 @@ public class ExpressionList extends Expression { } @Override - public Expression rewriteExpression(String prefix) throws LanguageException { + public Expression rewriteExpression(String prefix) { throw new LanguageException("ExpressionList should not be exposed beyond parser layer."); } @Override http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java b/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java index c3e9a68..1a87ebc 100644 --- a/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java +++ b/src/main/java/org/apache/sysml/parser/ExternalFunctionStatement.java @@ -63,12 +63,9 @@ public class ExternalFunctionStatement extends FunctionStatement * Validates all attributes and attribute values. * * @param sb statement block - * @throws LanguageException if LanguageException occurs */ public void validateParameters(StatementBlock sb) //always unconditional - throws LanguageException { - //warnings for all not defined attributes for( String varName : _otherParams.keySet() ) if( !(varName.equals(CLASS_NAME) || varName.equals(EXEC_TYPE) @@ -144,13 +141,13 @@ public class ExternalFunctionStatement extends FunctionStatement } @Override - public void initializeforwardLV(VariableSet activeIn) throws LanguageException{ + public void initializeforwardLV(VariableSet activeIn) { LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for ExternalFunctionStatement"); throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for ExternalFunctionStatement"); } @Override - public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{ + public VariableSet initializebackwardLV(VariableSet lo) { LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for ExternalFunctionStatement"); throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for ExternalFunctionStatement"); http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ForStatement.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/ForStatement.java b/src/main/java/org/apache/sysml/parser/ForStatement.java index 7309739..54f2428 100644 --- a/src/main/java/org/apache/sysml/parser/ForStatement.java +++ b/src/main/java/org/apache/sysml/parser/ForStatement.java @@ -29,7 +29,7 @@ public class ForStatement extends Statement protected ArrayList<StatementBlock> _body; @Override - public Statement rewriteStatement(String prefix) throws LanguageException{ + public Statement rewriteStatement(String prefix) { LOG.error(this.printErrorLocation() + "should not call rewriteStatement for ForStatement"); throw new LanguageException(this.printErrorLocation() + "should not call rewriteStatement for ForStatement"); } @@ -84,13 +84,13 @@ public class ForStatement extends Statement } @Override - public void initializeforwardLV(VariableSet activeIn) throws LanguageException{ + public void initializeforwardLV(VariableSet activeIn) { LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for ForStatement"); throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for ForStatement"); } @Override - public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{ + public VariableSet initializebackwardLV(VariableSet lo) { LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for ForStatement"); throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for ForStatement"); http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/ForStatementBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/ForStatementBlock.java b/src/main/java/org/apache/sysml/parser/ForStatementBlock.java index ae1aa75..9f0ff84 100644 --- a/src/main/java/org/apache/sysml/parser/ForStatementBlock.java +++ b/src/main/java/org/apache/sysml/parser/ForStatementBlock.java @@ -19,13 +19,11 @@ package org.apache.sysml.parser; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import org.apache.sysml.conf.ConfigurationManager; import org.apache.sysml.hops.Hop; -import org.apache.sysml.hops.HopsException; import org.apache.sysml.hops.recompile.Recompiler; import org.apache.sysml.lops.Lop; import org.apache.sysml.runtime.instructions.cp.BooleanObject; @@ -54,8 +52,7 @@ public class ForStatementBlock extends StatementBlock @Override public VariableSet validate(DMLProgram dmlProg, VariableSet ids, HashMap<String,ConstIdentifier> constVars, boolean conditional) - throws LanguageException, ParseException, IOException - { + { if (_statements.size() > 1){ raiseValidateError("ForStatementBlock should have only 1 statement (for statement)", conditional); } @@ -183,7 +180,7 @@ public class ForStatementBlock extends StatementBlock } @Override - public VariableSet initializeforwardLV(VariableSet activeInPassed) throws LanguageException { + public VariableSet initializeforwardLV(VariableSet activeInPassed) { ForStatement fstmt = (ForStatement)_statements.get(0); if (_statements.size() > 1){ @@ -247,7 +244,7 @@ public class ForStatementBlock extends StatementBlock } @Override - public VariableSet initializebackwardLV(VariableSet loPassed) throws LanguageException{ + public VariableSet initializebackwardLV(VariableSet loPassed) { ForStatement fstmt = (ForStatement)_statements.get(0); @@ -285,7 +282,7 @@ public class ForStatementBlock extends StatementBlock public Lop getIncrementLops() { return _incrementLops; } @Override - public VariableSet analyze(VariableSet loPassed) throws LanguageException{ + public VariableSet analyze(VariableSet loPassed) { VariableSet predVars = new VariableSet(); IterablePredicate ip = ((ForStatement)_statements.get(0)).getIterablePredicate(); @@ -339,9 +336,7 @@ public class ForStatementBlock extends StatementBlock } - public void performConstantPropagation(HashMap<String, ConstIdentifier> currConstVars) - throws LanguageException - { + public void performConstantPropagation(HashMap<String, ConstIdentifier> currConstVars) { IterablePredicate ip = getIterPredicate(); // handle replacement in from expression @@ -401,7 +396,7 @@ public class ForStatementBlock extends StatementBlock // materialized hops recompilation flags //// - public boolean updatePredicateRecompilationFlags() throws HopsException { + public boolean updatePredicateRecompilationFlags() { if( ConfigurationManager.isDynamicRecompilation() ) { _requiresFromRecompile = Recompiler.requiresRecompilation(getFromHops()); _requiresToRecompile = Recompiler.requiresRecompilation(getToHops()); http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java b/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java index 420e5a6..2f2e618 100644 --- a/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java +++ b/src/main/java/org/apache/sysml/parser/FunctionCallIdentifier.java @@ -21,7 +21,6 @@ package org.apache.sysml.parser; import java.util.ArrayList; import java.util.HashMap; -import java.io.IOException; public class FunctionCallIdentifier extends DataIdentifier @@ -53,7 +52,7 @@ public class FunctionCallIdentifier extends DataIdentifier } @Override - public Expression rewriteExpression(String prefix) throws LanguageException { + public Expression rewriteExpression(String prefix) { ArrayList<ParameterExpression> newParameterExpressions = new ArrayList<>(); for (ParameterExpression paramExpr : _paramExprs) newParameterExpressions.add(new ParameterExpression(paramExpr.getName(), paramExpr.getExpr().rewriteExpression(prefix))); @@ -88,11 +87,8 @@ public class FunctionCallIdentifier extends DataIdentifier * @param constVars map of constant identifiers * @param conditional if true, display warning for 'raiseValidateError'; if false, throw LanguageException * for 'raiseValidateError' - * @throws LanguageException if LanguageException occurs - * @throws IOException if IOException occurs */ public void validateExpression(DMLProgram dmlp, HashMap<String, DataIdentifier> ids, HashMap<String, ConstIdentifier> constVars, boolean conditional) - throws LanguageException, IOException { // Step 1: check the namespace exists, and that function is defined in the namespace if (dmlp.getNamespaces().get(_namespace) == null){ http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/FunctionStatement.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/FunctionStatement.java b/src/main/java/org/apache/sysml/parser/FunctionStatement.java index 3d7960a..5149997 100644 --- a/src/main/java/org/apache/sysml/parser/FunctionStatement.java +++ b/src/main/java/org/apache/sysml/parser/FunctionStatement.java @@ -31,7 +31,7 @@ public class FunctionStatement extends Statement protected ArrayList <DataIdentifier> _outputParams; @Override - public Statement rewriteStatement(String prefix) throws LanguageException{ + public Statement rewriteStatement(String prefix) { LOG.error(this.printErrorLocation() + "should not call rewriteStatement for FunctionStatement"); throw new LanguageException(this.printErrorLocation() + "should not call rewriteStatement for FunctionStatement"); } @@ -113,13 +113,13 @@ public class FunctionStatement extends Statement } @Override - public void initializeforwardLV(VariableSet activeIn) throws LanguageException{ + public void initializeforwardLV(VariableSet activeIn) { LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for FunctionStatement"); throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for FunctionStatement"); } @Override - public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{ + public VariableSet initializebackwardLV(VariableSet lo) { LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for FunctionStatement"); throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for FunctionStatement"); } http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java b/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java index 35ec6d4..2d7543f 100644 --- a/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java +++ b/src/main/java/org/apache/sysml/parser/FunctionStatementBlock.java @@ -19,7 +19,6 @@ package org.apache.sysml.parser; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -44,9 +43,7 @@ public class FunctionStatementBlock extends StatementBlock */ @Override public VariableSet validate(DMLProgram dmlProg, VariableSet ids, HashMap<String,ConstIdentifier> constVars, boolean conditional) - throws LanguageException, ParseException, IOException { - if (_statements.size() > 1){ LOG.error(this.printBlockErrorLocation() + "FunctionStatementBlock should have only 1 statement (FunctionStatement)"); throw new LanguageException(this.printBlockErrorLocation() + "FunctionStatementBlock should have only 1 statement (FunctionStatement)"); @@ -201,7 +198,7 @@ public class FunctionStatementBlock extends StatementBlock } @Override - public VariableSet initializeforwardLV(VariableSet activeInPassed) throws LanguageException { + public VariableSet initializeforwardLV(VariableSet activeInPassed) { FunctionStatement fstmt = (FunctionStatement)_statements.get(0); if (_statements.size() > 1){ LOG.error(this.printBlockErrorLocation() + "FunctionStatementBlock should have only 1 statement (while statement)"); @@ -245,7 +242,7 @@ public class FunctionStatementBlock extends StatementBlock } @Override - public VariableSet initializebackwardLV(VariableSet loPassed) throws LanguageException{ + public VariableSet initializebackwardLV(VariableSet loPassed) { FunctionStatement wstmt = (FunctionStatement)_statements.get(0); @@ -265,12 +262,12 @@ public class FunctionStatementBlock extends StatementBlock } @Override - public VariableSet analyze(VariableSet loPassed) throws LanguageException{ + public VariableSet analyze(VariableSet loPassed) { LOG.error(this.printBlockErrorLocation() + "Both liveIn and liveOut variables need to be specified for liveness analysis for FunctionStatementBlock"); throw new LanguageException(this.printBlockErrorLocation() + "Both liveIn and liveOut variables need to be specified for liveness analysis for FunctionStatementBlock"); } - public VariableSet analyze(VariableSet liPassed, VariableSet loPassed) throws LanguageException{ + public VariableSet analyze(VariableSet liPassed, VariableSet loPassed) { VariableSet candidateLO = new VariableSet(); candidateLO.addVariables(loPassed); http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/Identifier.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/Identifier.java b/src/main/java/org/apache/sysml/parser/Identifier.java index 3c44452..ffb455b 100644 --- a/src/main/java/org/apache/sysml/parser/Identifier.java +++ b/src/main/java/org/apache/sysml/parser/Identifier.java @@ -140,7 +140,6 @@ public abstract class Identifier extends Expression @Override public void validateExpression(HashMap<String,DataIdentifier> ids, HashMap<String,ConstIdentifier> constVars, boolean conditional) - throws LanguageException { if( getOutput() instanceof DataIdentifier ) { http://git-wip-us.apache.org/repos/asf/systemml/blob/215a1cc6/src/main/java/org/apache/sysml/parser/IfStatement.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/sysml/parser/IfStatement.java b/src/main/java/org/apache/sysml/parser/IfStatement.java index 1448e8a..7352b22 100644 --- a/src/main/java/org/apache/sysml/parser/IfStatement.java +++ b/src/main/java/org/apache/sysml/parser/IfStatement.java @@ -30,7 +30,7 @@ public class IfStatement extends Statement private ArrayList<StatementBlock> _elseBody; @Override - public Statement rewriteStatement(String prefix) throws LanguageException{ + public Statement rewriteStatement(String prefix) { LOG.error(this.printErrorLocation() + "should not call rewriteStatement for IfStatement"); throw new LanguageException(this.printErrorLocation() + "should not call rewriteStatement for IfStatement"); } @@ -81,14 +81,12 @@ public class IfStatement extends Statement } @Override - public void initializeforwardLV(VariableSet activeIn) throws LanguageException{ - LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for IfStatement"); + public void initializeforwardLV(VariableSet activeIn) { throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for IfStatement"); } @Override - public VariableSet initializebackwardLV(VariableSet lo) throws LanguageException{ - LOG.error(this.printErrorLocation() + "should never call initializeforwardLV for IfStatement"); + public VariableSet initializebackwardLV(VariableSet lo) { throw new LanguageException(this.printErrorLocation() + "should never call initializeforwardLV for IfStatement"); }
