< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.virtual/src/org/graalvm/compiler/virtual/phases/ea/EffectsClosure.java

Print this page
rev 56282 : [mq]: graal
   1 /*
   2  * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 340                 doMergeWithoutDead(mergeProcessor, states);
 341 
 342                 debug.log("MergeProcessor New State: %s", mergeProcessor.newState);
 343                 debug.log("===== vs.");
 344                 debug.log("Last Merged State: %s", lastMergedState);
 345 
 346                 if (mergeProcessor.newState.equivalentTo(lastMergedState)) {
 347                     blockEffects.get(loop.getHeader()).insertAll(mergeProcessor.mergeEffects, 0);
 348                     loopMergeEffects.put(loop, mergeProcessor.afterMergeEffects);
 349 
 350                     assert info.exitStates.size() == loop.getLoopExits().size();
 351                     loopEntryStates.put((LoopBeginNode) loop.getHeader().getBeginNode(), loopEntryState);
 352                     assert assertExitStatesNonEmpty(loop, info);
 353 
 354                     processKilledLoopLocations(loop, initialStateRemovedKilledLocations, mergeProcessor.newState);
 355                     return info.exitStates;
 356                 } else {
 357                     lastMergedState = mergeProcessor.newState;
 358                     for (Block block : loop.getBlocks()) {
 359                         blockEffects.get(block).clear();






 360                     }
 361                 }
 362             }
 363         }
 364         throw new GraalError("too many iterations at %s", loop);
 365     }
 366 
 367     @SuppressWarnings("unused")
 368     protected BlockT stripKilledLoopLocations(Loop<Block> loop, BlockT initialState) {
 369         return initialState;
 370     }
 371 
 372     @SuppressWarnings("unused")
 373     protected void processKilledLoopLocations(Loop<Block> loop, BlockT initialState, BlockT mergedStates) {
 374         // nothing to do
 375     }
 376 
 377     @SuppressWarnings("unused")
 378     protected void processInitialLoopState(Loop<Block> loop, BlockT initialState) {
 379         // nothing to do


   1 /*
   2  * Copyright (c) 2011, 2019, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


 340                 doMergeWithoutDead(mergeProcessor, states);
 341 
 342                 debug.log("MergeProcessor New State: %s", mergeProcessor.newState);
 343                 debug.log("===== vs.");
 344                 debug.log("Last Merged State: %s", lastMergedState);
 345 
 346                 if (mergeProcessor.newState.equivalentTo(lastMergedState)) {
 347                     blockEffects.get(loop.getHeader()).insertAll(mergeProcessor.mergeEffects, 0);
 348                     loopMergeEffects.put(loop, mergeProcessor.afterMergeEffects);
 349 
 350                     assert info.exitStates.size() == loop.getLoopExits().size();
 351                     loopEntryStates.put((LoopBeginNode) loop.getHeader().getBeginNode(), loopEntryState);
 352                     assert assertExitStatesNonEmpty(loop, info);
 353 
 354                     processKilledLoopLocations(loop, initialStateRemovedKilledLocations, mergeProcessor.newState);
 355                     return info.exitStates;
 356                 } else {
 357                     lastMergedState = mergeProcessor.newState;
 358                     for (Block block : loop.getBlocks()) {
 359                         blockEffects.get(block).clear();
 360                         if (block.isLoopHeader()) {
 361                             final GraphEffectList loopEffects = loopMergeEffects.get(block.getLoop());
 362                             if (loopEffects != null) {
 363                                 loopEffects.clear();
 364                             }
 365                         }
 366                     }
 367                 }
 368             }
 369         }
 370         throw new GraalError("too many iterations at %s", loop);
 371     }
 372 
 373     @SuppressWarnings("unused")
 374     protected BlockT stripKilledLoopLocations(Loop<Block> loop, BlockT initialState) {
 375         return initialState;
 376     }
 377 
 378     @SuppressWarnings("unused")
 379     protected void processKilledLoopLocations(Loop<Block> loop, BlockT initialState, BlockT mergedStates) {
 380         // nothing to do
 381     }
 382 
 383     @SuppressWarnings("unused")
 384     protected void processInitialLoopState(Loop<Block> loop, BlockT initialState) {
 385         // nothing to do


< prev index next >