6363import com .ibm .wala .util .graph .impl .SlowSparseNumberedGraph ;
6464import com .ibm .wala .util .intset .OrdinalSet ;
6565import java .io .File ;
66+ import java .io .IOException ;
6667import java .util .EnumSet ;
6768import java .util .Iterator ;
6869import java .util .List ;
@@ -653,16 +654,19 @@ private Map<PointsToSetVariable, TensorType> getShapeSourceCalls(
653654 op ,
654655 builder ,
655656 (CGNode src , SSAAbstractInvokeInstruction call ) -> {
656- if (call .getNumberOfUses () > param ) {
657- targets .put (
658- builder
659- .getPropagationSystem ()
660- .findOrCreatePointsToSet (
661- builder
662- .getPointerAnalysis ()
663- .getHeapModel ()
664- .getPointerKeyForLocal (src , call .getDef ())),
665- TensorType .shapeArg (src , call .getUse (param )));
657+ try {
658+ if (call .getNumberOfUses () > param )
659+ targets .put (
660+ builder
661+ .getPropagationSystem ()
662+ .findOrCreatePointsToSet (
663+ builder
664+ .getPointerAnalysis ()
665+ .getHeapModel ()
666+ .getPointerKeyForLocal (src , call .getDef ())),
667+ TensorType .shapeArg (src , call .getUse (param )));
668+ } catch (IOException e ) {
669+ throw new RuntimeException ("Error while processing shape source call: " + call , e );
666670 }
667671 });
668672 return targets ;
@@ -701,9 +705,13 @@ public TensorTypeAnalysis performAnalysis(PropagationCallGraphBuilder builder)
701705
702706 for (PointsToSetVariable v : sources ) init .put (v , getTensorType (v , builder ));
703707
704- Map <PointsToSetVariable , TensorType > placeholders =
705- handleShapeSourceOp (builder , dataflow , placeholder , 2 );
706- logger .fine (() -> "Placeholders: " + placeholders );
708+ Map <PointsToSetVariable , TensorType > placeholders = null ;
709+ try {
710+ placeholders = handleShapeSourceOp (builder , dataflow , placeholder , 2 );
711+ } catch (IOException e ) {
712+ throw new RuntimeException ("Error while processing placeholder calls." , e );
713+ }
714+ logger .fine ("Placeholders: " + placeholders );
707715
708716 for (Map .Entry <PointsToSetVariable , TensorType > e : placeholders .entrySet ())
709717 init .put (e .getKey (), Set .of (e .getValue ()));
@@ -728,7 +736,12 @@ public TensorTypeAnalysis performAnalysis(PropagationCallGraphBuilder builder)
728736 }
729737
730738 Map <PointsToSetVariable , TensorType > shapeOps = HashMapFactory .make ();
731- shapeOps .putAll (handleShapeSourceOp (builder , dataflow , reshape , 2 ));
739+
740+ try {
741+ shapeOps .putAll (handleShapeSourceOp (builder , dataflow , reshape , 2 ));
742+ } catch (IOException e ) {
743+ throw new RuntimeException ("Error while processing reshape calls." , e );
744+ }
732745
733746 Set <PointsToSetVariable > conv2ds = getKeysDefinedByCall (conv2d , builder );
734747
@@ -983,7 +996,8 @@ private Map<PointsToSetVariable, TensorType> handleShapeSourceOp(
983996 PropagationCallGraphBuilder builder ,
984997 Graph <PointsToSetVariable > dataflow ,
985998 MethodReference op ,
986- int shapeSrcOperand ) {
999+ int shapeSrcOperand )
1000+ throws IOException {
9871001 Map <PointsToSetVariable , TensorType > reshapeTypes =
9881002 getShapeSourceCalls (op , builder , shapeSrcOperand );
9891003 for (PointsToSetVariable to : reshapeTypes .keySet ()) {
0 commit comments