Mercurial > hg > release > icedtea-1.9
view ports/hotspot/src/share/vm/shark/sharkValue.hpp @ 1757:96d1de001c8d
2009-03-13 Gary Benson <gbenson@redhat.com>
* ports/hotspot/src/share/vm/shark/sharkValue.hpp
(SharkValue::create_generic): Make zero_checked argument mandatory.
(SharkValue::create_jint): Fixups for the above.
(SharkValue::create_jlong): Likewise.
(SharkValue::create_jfloat): Likewise.
(SharkValue::create_jdouble): Likewise.
(SharkValue::create_jobject): Likewise.
(SharkValue::jint_constant): Likewise.
(SharkValue::jlong_constant): Likewise.
(SharkValue::null): Likewise.
* ports/hotspot/src/share/vm/shark/sharkState.cpp
(SharkState::merge): Likewise.
(SharkState::cache_after_Java_call): Likewise.
(SharkEntryState::SharkEntryState): Likewise.
(SharkPHIState::SharkPHIState): Likewise.
* ports/hotspot/src/share/vm/shark/sharkBlock.hpp
(SharkBlock::do_ldc): Likewise.
* ports/hotspot/src/share/vm/shark/sharkBlock.cpp
(SharkBlock::parse_bytecode): Likewise.
(SharkBlock::do_div_or_rem): Likewise.
(SharkBlock::do_field_access): Likewise.
(SharkBlock::do_lcmp): Likewise.
(SharkBlock::do_fcmp): Likewise.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
(SharkTopLevelBlock::handle_exception): Likewise.
(SharkTopLevelBlock::do_arraylength): Likewise.
(SharkTopLevelBlock::do_aload): Likewise.
(SharkTopLevelBlock::do_instance_check): Likewise.
(SharkTopLevelBlock::do_new): Likewise.
(SharkTopLevelBlock::do_newarray): Likewise.
(SharkTopLevelBlock::do_anewarray): Likewise.
(SharkTopLevelBlock::do_multianewarray): Likewise.
* ports/hotspot/src/share/vm/shark/sharkCacheDecache.cpp
(SharkCacher::process_stack_slot): Likewise.
(SharkCacher::process_local_slot): Likewise.
* ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp
(SharkIntrinsics::do_Math_minmax): Likewise.
(SharkIntrinsics::do_Object_getClass): Likewise.
(SharkIntrinsics::do_System_currentTimeMillis): Likewise.
(SharkIntrinsics::do_Thread_currentThread): Likewise.
(SharkIntrinsics::do_Unsafe_compareAndSwapInt): Likewise.
author | Gary Benson <gbenson@redhat.com> |
---|---|
date | Fri, 13 Mar 2009 09:55:22 -0400 |
parents | 3ef3b5ede304 |
children |
line wrap: on
line source
/* * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. * Copyright 2008, 2009 Red Hat, Inc. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * */ // Items on the stack and in local variables are tracked using // SharkValue objects. There are two types, SharkNormalValue // and SharkAddressValue, but no code outside this file should // ever refer to those directly. The split is because of the // way JSRs are handled: the typeflow pass expands them into // multiple copies, so the return addresses pushed by jsr and // popped by ret only exist at compile time. Having separate // classes for these allows us to check that our jsr handling // is correct, via assertions. class SharkBuilder; class SharkValue : public ResourceObj { protected: SharkValue() {} // Cloning public: virtual SharkValue* clone() const = 0; // Comparison public: virtual bool equal_to(SharkValue* other) const = 0; // Type access public: virtual BasicType basic_type() const = 0; virtual ciType* type() const; virtual bool is_jint() const; virtual bool is_jlong() const; virtual bool is_jfloat() const; virtual bool is_jdouble() const; virtual bool is_jobject() const; virtual bool is_jarray() const; virtual bool is_address() const; virtual int size() const = 0; bool is_one_word() const { return size() == 1; } bool is_two_word() const { return size() == 2; } // Typed conversion from SharkValues public: virtual llvm::Value* jint_value() const; virtual llvm::Value* jlong_value() const; virtual llvm::Value* jfloat_value() const; virtual llvm::Value* jdouble_value() const; virtual llvm::Value* jobject_value() const; virtual llvm::Value* jarray_value() const; virtual int address_value() const; // Typed conversion to SharkValues public: static SharkValue* create_jint(llvm::Value* value, bool zero_checked) { assert(value->getType() == SharkType::jint_type(), "should be"); return create_generic(ciType::make(T_INT), value, zero_checked); } static SharkValue* create_jlong(llvm::Value* value, bool zero_checked) { assert(value->getType() == SharkType::jlong_type(), "should be"); return create_generic(ciType::make(T_LONG), value, zero_checked); } static SharkValue* create_jfloat(llvm::Value* value) { assert(value->getType() == SharkType::jfloat_type(), "should be"); return create_generic(ciType::make(T_FLOAT), value, false); } static SharkValue* create_jdouble(llvm::Value* value) { assert(value->getType() == SharkType::jdouble_type(), "should be"); return create_generic(ciType::make(T_DOUBLE), value, false); } static SharkValue* create_jobject(llvm::Value* value, bool zero_checked) { assert(value->getType() == SharkType::jobject_type(), "should be"); return create_generic(ciType::make(T_OBJECT), value, zero_checked); } // Typed conversion from constants of various types public: static SharkValue* jint_constant(jint value) { return create_jint(LLVMValue::jint_constant(value), value != 0); } static SharkValue* jlong_constant(jlong value) { return create_jlong(LLVMValue::jlong_constant(value), value != 0); } static SharkValue* jfloat_constant(jfloat value) { return create_jfloat(LLVMValue::jfloat_constant(value)); } static SharkValue* jdouble_constant(jdouble value) { return create_jdouble(LLVMValue::jdouble_constant(value)); } static SharkValue* null() { return create_jobject(LLVMValue::null(), false); } static inline SharkValue* address_constant(int bci); // Typed conversion from HotSpot ciConstants public: static SharkValue* from_ciConstant(ciConstant value) { switch (value.basic_type()) { case T_BOOLEAN: return SharkValue::jint_constant(value.as_boolean()); case T_BYTE: return SharkValue::jint_constant(value.as_byte()); case T_CHAR: return SharkValue::jint_constant(value.as_char()); case T_SHORT: return SharkValue::jint_constant(value.as_short()); case T_INT: return SharkValue::jint_constant(value.as_int()); case T_LONG: return SharkValue::jlong_constant(value.as_long()); case T_FLOAT: return SharkValue::jfloat_constant(value.as_float()); case T_DOUBLE: return SharkValue::jdouble_constant(value.as_double()); case T_OBJECT: case T_ARRAY: return NULL; default: tty->print_cr("Unhandled type %s", type2name(value.basic_type())); ShouldNotReachHere(); } } // Type-losing conversions -- use with care! public: virtual llvm::Value* generic_value() const = 0; virtual llvm::Value* intptr_value(SharkBuilder* builder) const; static inline SharkValue* create_generic(ciType* type, llvm::Value* value, bool zero_checked); // Phi-style stuff public: virtual void addIncoming(SharkValue *value, llvm::BasicBlock* block) = 0; // Repeated null and divide-by-zero check removal public: virtual bool zero_checked() const; virtual void set_zero_checked(bool zero_checked); }; class SharkNormalValue : public SharkValue { friend class SharkValue; protected: SharkNormalValue(ciType* type, llvm::Value* value, bool zero_checked) : _type(type), _llvm_value(value), _zero_checked(zero_checked) {} private: ciType* _type; llvm::Value* _llvm_value; bool _zero_checked; private: llvm::Value* llvm_value() const { return _llvm_value; } // Cloning public: SharkValue* clone() const; // Comparison public: bool equal_to(SharkValue* other) const; // Type access public: ciType* type() const; BasicType basic_type() const; int size() const; public: bool is_jint() const; bool is_jlong() const; bool is_jfloat() const; bool is_jdouble() const; bool is_jobject() const; bool is_jarray() const; // Typed conversions to LLVM values public: llvm::Value* jint_value() const; llvm::Value* jlong_value() const; llvm::Value* jfloat_value() const; llvm::Value* jdouble_value() const; llvm::Value* jobject_value() const; llvm::Value* jarray_value() const; // Type-losing conversions, use with care public: llvm::Value* generic_value() const; llvm::Value* intptr_value(SharkBuilder* builder) const; // Wrapped PHINodes public: void addIncoming(SharkValue *value, llvm::BasicBlock* block); // Repeated null and divide-by-zero check removal public: bool zero_checked() const; void set_zero_checked(bool zero_checked); }; inline SharkValue* SharkValue::create_generic(ciType* type, llvm::Value* value, bool zero_checked) { return new SharkNormalValue(type, value, zero_checked); } class SharkAddressValue : public SharkValue { friend class SharkValue; protected: SharkAddressValue(int bci) : _bci(bci) {} private: int _bci; // Cloning public: SharkValue* clone() const; // Comparison public: bool equal_to(SharkValue* other) const; // Type access public: BasicType basic_type() const; int size() const; bool is_address() const; // Typed conversion from SharkValues public: int address_value() const; // Type-losing conversion -- use with care! public: llvm::Value* generic_value() const; // Phi-style stuff public: void addIncoming(SharkValue *value, llvm::BasicBlock* block); }; inline SharkValue* SharkValue::address_constant(int bci) { return new SharkAddressValue(bci); }