src/share/vm/shark/sharkValue.hpp

Print this page


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









  26 // Items on the stack and in local variables are tracked using
  27 // SharkValue objects.
  28 //
  29 // All SharkValues are one of two core types, SharkNormalValue
  30 // and SharkAddressValue, but no code outside this file should
  31 // ever refer to those directly.  The split is because of the
  32 // way JSRs are handled: the typeflow pass expands them into
  33 // multiple copies, so the return addresses pushed by jsr and
  34 // popped by ret only exist at compile time.  Having separate
  35 // classes for these allows us to check that our jsr handling
  36 // is correct, via assertions.
  37 //
  38 // There is one more type, SharkPHIValue, which is a subclass
  39 // of SharkNormalValue with a couple of extra methods.  Use of
  40 // SharkPHIValue outside of this file is acceptable, so long
  41 // as it is obtained via SharkValue::as_phi().
  42 
  43 class SharkBuilder;
  44 class SharkPHIValue;
  45 


 313                     const char*       name);
 314 };
 315 
 316 // SharkValue methods that can't be declared above
 317 
 318 inline SharkValue* SharkValue::create_generic(ciType*      type,
 319                                               llvm::Value* value,
 320                                               bool         zero_checked) {
 321   return new SharkNormalValue(type, value, zero_checked);
 322 }
 323 
 324 inline SharkValue* SharkValue::create_phi(ciType*              type,
 325                                           llvm::PHINode*       phi,
 326                                           const SharkPHIValue* parent) {
 327   return new SharkPHIValue(type, phi, parent);
 328 }
 329 
 330 inline SharkValue* SharkValue::address_constant(int bci) {
 331   return new SharkAddressValue(bci);
 332 }


   1 /*
   2  * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2008, 2009 Red Hat, Inc.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.
   9  *
  10  * This code is distributed in the hope that it will be useful, but WITHOUT
  11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  *
  24  */
  25 
  26 #ifndef SHARE_VM_SHARK_SHARKVALUE_HPP
  27 #define SHARE_VM_SHARK_SHARKVALUE_HPP
  28 
  29 #include "ci/ciType.hpp"
  30 #include "memory/allocation.hpp"
  31 #include "shark/llvmHeaders.hpp"
  32 #include "shark/llvmValue.hpp"
  33 #include "shark/sharkType.hpp"
  34 
  35 // Items on the stack and in local variables are tracked using
  36 // SharkValue objects.
  37 //
  38 // All SharkValues are one of two core types, SharkNormalValue
  39 // and SharkAddressValue, but no code outside this file should
  40 // ever refer to those directly.  The split is because of the
  41 // way JSRs are handled: the typeflow pass expands them into
  42 // multiple copies, so the return addresses pushed by jsr and
  43 // popped by ret only exist at compile time.  Having separate
  44 // classes for these allows us to check that our jsr handling
  45 // is correct, via assertions.
  46 //
  47 // There is one more type, SharkPHIValue, which is a subclass
  48 // of SharkNormalValue with a couple of extra methods.  Use of
  49 // SharkPHIValue outside of this file is acceptable, so long
  50 // as it is obtained via SharkValue::as_phi().
  51 
  52 class SharkBuilder;
  53 class SharkPHIValue;
  54 


 322                     const char*       name);
 323 };
 324 
 325 // SharkValue methods that can't be declared above
 326 
 327 inline SharkValue* SharkValue::create_generic(ciType*      type,
 328                                               llvm::Value* value,
 329                                               bool         zero_checked) {
 330   return new SharkNormalValue(type, value, zero_checked);
 331 }
 332 
 333 inline SharkValue* SharkValue::create_phi(ciType*              type,
 334                                           llvm::PHINode*       phi,
 335                                           const SharkPHIValue* parent) {
 336   return new SharkPHIValue(type, phi, parent);
 337 }
 338 
 339 inline SharkValue* SharkValue::address_constant(int bci) {
 340   return new SharkAddressValue(bci);
 341 }
 342 
 343 #endif // SHARE_VM_SHARK_SHARKVALUE_HPP