< prev index next >

src/share/vm/opto/parse2.cpp

Print this page


   1 /*
   2  * Copyright (c) 1998, 2016, 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  *


2131     // a branch; this pattern then optimizes to the obvious long-compare and
2132     // branch.  However, if the branch is backwards there's a Safepoint
2133     // inserted.  The inserted Safepoint captures the JVM state at the
2134     // pre-branch point, i.e. it captures the 3-way value.  Thus if a
2135     // long-compare is used to control a loop the debug info will force
2136     // computation of the 3-way value, even though the generated code uses a
2137     // long-compare and branch.  We try to rectify the situation by inserting
2138     // a SafePoint here and have it dominate and kill the safepoint added at a
2139     // following backwards branch.  At this point the JVM state merely holds 2
2140     // longs but not the 3-way value.
2141     if( UseLoopSafepoints ) {
2142       switch( iter().next_bc() ) {
2143       case Bytecodes::_ifgt:
2144       case Bytecodes::_iflt:
2145       case Bytecodes::_ifge:
2146       case Bytecodes::_ifle:
2147       case Bytecodes::_ifne:
2148       case Bytecodes::_ifeq:
2149         // If this is a backwards branch in the bytecodes, add Safepoint
2150         maybe_add_safepoint(iter().next_get_dest());


2151       }
2152     }
2153     b = pop_pair();
2154     a = pop_pair();
2155     c = _gvn.transform( new CmpL3Node( a, b ));
2156     push(c);
2157     break;
2158 
2159   case Bytecodes::_lneg:
2160     a = pop_pair();
2161     b = _gvn.transform( new SubLNode(longcon(0),a));
2162     push_pair(b);
2163     break;
2164   case Bytecodes::_l2i:
2165     a = pop_pair();
2166     push( _gvn.transform( new ConvL2INode(a)));
2167     break;
2168   case Bytecodes::_i2l:
2169     a = pop();
2170     b = _gvn.transform( new ConvI2LNode(a));


   1 /*
   2  * Copyright (c) 1998, 2017, 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  *


2131     // a branch; this pattern then optimizes to the obvious long-compare and
2132     // branch.  However, if the branch is backwards there's a Safepoint
2133     // inserted.  The inserted Safepoint captures the JVM state at the
2134     // pre-branch point, i.e. it captures the 3-way value.  Thus if a
2135     // long-compare is used to control a loop the debug info will force
2136     // computation of the 3-way value, even though the generated code uses a
2137     // long-compare and branch.  We try to rectify the situation by inserting
2138     // a SafePoint here and have it dominate and kill the safepoint added at a
2139     // following backwards branch.  At this point the JVM state merely holds 2
2140     // longs but not the 3-way value.
2141     if( UseLoopSafepoints ) {
2142       switch( iter().next_bc() ) {
2143       case Bytecodes::_ifgt:
2144       case Bytecodes::_iflt:
2145       case Bytecodes::_ifge:
2146       case Bytecodes::_ifle:
2147       case Bytecodes::_ifne:
2148       case Bytecodes::_ifeq:
2149         // If this is a backwards branch in the bytecodes, add Safepoint
2150         maybe_add_safepoint(iter().next_get_dest());
2151       default:
2152         break;
2153       }
2154     }
2155     b = pop_pair();
2156     a = pop_pair();
2157     c = _gvn.transform( new CmpL3Node( a, b ));
2158     push(c);
2159     break;
2160 
2161   case Bytecodes::_lneg:
2162     a = pop_pair();
2163     b = _gvn.transform( new SubLNode(longcon(0),a));
2164     push_pair(b);
2165     break;
2166   case Bytecodes::_l2i:
2167     a = pop_pair();
2168     push( _gvn.transform( new ConvL2INode(a)));
2169     break;
2170   case Bytecodes::_i2l:
2171     a = pop();
2172     b = _gvn.transform( new ConvI2LNode(a));


< prev index next >