< prev index next >

src/hotspot/share/c1/c1_ValueStack.cpp

Print this page


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


 165   }
 166   return num_locks;
 167 }
 168 
 169 int ValueStack::lock(Value obj) {
 170   if (_locks == NULL) {
 171     _locks = new Values();
 172   }
 173   _locks->push(obj);
 174   int num_locks = total_locks_size();
 175   scope()->set_min_number_of_locks(num_locks);
 176   return num_locks - 1;
 177 }
 178 
 179 
 180 int ValueStack::unlock() {
 181   assert(locks_size() > 0, "sanity");
 182   _locks->pop();
 183   return total_locks_size();
 184 }
 185 
 186 
 187 void ValueStack::setup_phi_for_stack(BlockBegin* b, int index) {
 188   assert(stack_at(index)->as_Phi() == NULL || stack_at(index)->as_Phi()->block() != b, "phi function already created");
 189 
 190   ValueType* t = stack_at(index)->type();
 191   Value phi = new Phi(t, b, -index - 1);
 192   _stack.at_put(index, phi);
 193 
 194   assert(!t->is_double_word() || _stack.at(index + 1) == NULL, "hi-word of doubleword value must be NULL");
 195 }
 196 
 197 void ValueStack::setup_phi_for_local(BlockBegin* b, int index) {
 198   assert(local_at(index)->as_Phi() == NULL || local_at(index)->as_Phi()->block() != b, "phi function already created");
 199 
 200   ValueType* t = local_at(index)->type();
 201   Value phi = new Phi(t, b, index);
 202   store_local(index, phi);
 203 }
 204 
 205 #ifndef PRODUCT


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


 165   }
 166   return num_locks;
 167 }
 168 
 169 int ValueStack::lock(Value obj) {
 170   if (_locks == NULL) {
 171     _locks = new Values();
 172   }
 173   _locks->push(obj);
 174   int num_locks = total_locks_size();
 175   scope()->set_min_number_of_locks(num_locks);
 176   return num_locks - 1;
 177 }
 178 
 179 
 180 int ValueStack::unlock() {
 181   assert(locks_size() > 0, "sanity");
 182   _locks->pop();
 183   return total_locks_size();
 184 }

 185 
 186 void ValueStack::setup_phi_for_stack(BlockBegin* b, int index) {
 187   assert(stack_at(index)->as_Phi() == NULL || stack_at(index)->as_Phi()->block() != b, "phi function already created");
 188 
 189   ValueType* t = stack_at(index)->type();
 190   Value phi = new Phi(t, b, -index - 1);
 191   _stack.at_put(index, phi);
 192 
 193   assert(!t->is_double_word() || _stack.at(index + 1) == NULL, "hi-word of doubleword value must be NULL");
 194 }
 195 
 196 void ValueStack::setup_phi_for_local(BlockBegin* b, int index) {
 197   assert(local_at(index)->as_Phi() == NULL || local_at(index)->as_Phi()->block() != b, "phi function already created");
 198 
 199   ValueType* t = local_at(index)->type();
 200   Value phi = new Phi(t, b, index);
 201   store_local(index, phi);
 202 }
 203 
 204 #ifndef PRODUCT


< prev index next >