Question about exceptions

Jim Duey jim.duey at gmail.com
Thu Apr 26 13:39:50 PDT 2012


Hi all,

I'm reading through BciBlockMapping.java and I came across this:

     private void addExceptionEdges() {
         for (int bci = canTrap.nextSetBit(0); bci >= 0;
                  bci = canTrap.nextSetBit(bci + 1)) {
             Block block = blockMap[bci];

             ArrayList<RiExceptionHandler> handlers = null;
             for (RiExceptionHandler h : this.exceptionHandlers) {
                 if (h.startBCI() <= bci && bci < h.endBCI()) {
                     if (handlers == null) {
                         handlers = new ArrayList<>();
                     }
                     handlers.add(h);
                     if (h.isCatchAll()) {
                         break;
                     }
                 }
             }
             if (handlers != null) {
                 Block dispatch = makeExceptionDispatch(handlers,
                                                        0, bci);
                 block.successors.add(dispatch);
             }
         }
     }

The inner loop builds an array of exception handlers, but the call to 
only seems to make a dispatch for the first element of the array. Is 
that intended? Should dispatches be made for each handler in the array? 
Is there some ordering to the exceptionHandlers list that makes this moot?

Thanks,
Jim


More information about the graal-dev mailing list