Mercurial > hg > release > icedtea-1.9
view ports/hotspot/src/share/vm/shark/sharkBlock.hpp @ 1732:5caf65dd9bd3
2009-03-11 Gary Benson <gbenson@redhat.com>
* ports/hotspot/src/share/vm/shark/sharkIntrinsics.hpp: New file.
* ports/hotspot/src/share/vm/shark/sharkIntrinsics.cpp: Likewise.
* ports/hotspot/src/share/vm/shark/shark_globals.hpp
(SharkPerformanceWarnings): New flag.
* ports/hotspot/src/share/vm/shark/sharkBuilder.hpp
(SharkBuilder::_llvm_cmpxchg_int_fn): New field.
(SharkBuilder::_llvm_sin_fn): Likewise.
(SharkBuilder::_llvm_cos_fn): Likewise.
(SharkBuilder::_llvm_sqrt_fn): Likewise.
(SharkBuilder::_llvm_log_fn): Likewise.
(SharkBuilder::_llvm_log10_fn): Likewise.
(SharkBuilder::_llvm_pow_fn): Likewise.
(SharkBuilder::_llvm_exp_fn): Likewise.
(SharkBuilder::set_llvm_cmpxchg_int_fn): New method.
(SharkBuilder::set_llvm_sin_fn): Likewise.
(SharkBuilder::set_llvm_cos_fn): Likewise.
(SharkBuilder::set_llvm_sqrt_fn): Likewise.
(SharkBuilder::set_llvm_log_fn): Likewise.
(SharkBuilder::set_llvm_log10_fn): Likewise.
(SharkBuilder::set_llvm_pow_fn): Likewise.
(SharkBuilder::set_llvm_exp_fn): Likewise.
(SharkBuilder::llvm_cmpxchg_int_fn): Likewise.
(SharkBuilder::llvm_sin_fn): Likewise.
(SharkBuilder::llvm_cos_fn): Likewise.
(SharkBuilder::llvm_sqrt_fn): Likewise.
(SharkBuilder::llvm_log_fn): Likewise.
(SharkBuilder::llvm_log10_fn): Likewise.
(SharkBuilder::llvm_pow_fn): Likewise.
(SharkBuilder::llvm_exp_fn): Likewise.
(SharkBuilder::CreateCmpxchgInt): Likewise.
* ports/hotspot/src/share/vm/shark/sharkBuilder.cpp
(SharkBuilder::init_external_functions): Initialize new fields.
(SharkBuilder::CreateCmpxchgInt): New method.
* ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
(SharkRuntime::_current_time_millis): New field.
(SharkRuntime::_fabs): Likewise.
(SharkRuntime::_tan): Likewise.
(SharkRuntime::_atan2): Likewise.
(SharkRuntime::_unsafe_field_offset_to_byte_offset): Likewise.
(SharkRuntime::current_time_millis): New method.
(SharkRuntime::fabs): Likewise.
(SharkRuntime::tan): Likewise.
(SharkRuntime::atan2): Likewise.
(SharkRuntime::unsafe_field_offset_to_byte_offset): Likewise.
* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
(SharkRuntime::_current_time_millis): New field.
(SharkRuntime::_fabs): Likewise.
(SharkRuntime::_tan): Likewise.
(SharkRuntime::_atan2): Likewise.
(SharkRuntime::_unsafe_field_offset_to_byte_offset): Likewise.
(SharkRuntime::initialize): Initialize the above.
* ports/hotspot/src/share/vm/shark/sharkBlock.hpp
(SharkBlock::SharkBlock): New thread argument.
(SharkBlock::_thread): New field.
(SharkBlock::thread): New method.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.hpp
(SharkTopLevelBlock::SharkTopLevelBlock): Pass thread to super.
(SharkTopLevelBlock::thread): Removed method.
* ports/hotspot/src/share/vm/shark/sharkTopLevelBlock.cpp
(SharkTopLevelBlock::do_call): Pass thread to inliner.
* ports/hotspot/src/share/vm/shark/sharkFunction.cpp
(SharkFunction::initialize): Do the arguments before creating blocks.
* ports/hotspot/src/share/vm/shark/sharkInliner.hpp
(SharkInliner::attempt_inline): New thread argument.
* ports/hotspot/src/share/vm/shark/sharkInliner.cpp
(SharkInlineBlock::SharkInlineBlock): Pass thread to super.
(SharkInlinerHelper::SharkInlinerHelper): New thread argument.
(SharkInlinerHelper::_thread): New field.
(SharkInlinerHelper::thread): New method.
(SharkInlinerHelper::do_inline): Pass thread to block constructor.
(SharkInliner::attempt_inline): Attempt to inline intrinsics.
* ports/hotspot/src/share/vm/includeDB_shark: Updated.
(transplanted from 1eeb14582f5a679354df249e23e10b2f61b423e8)
author | Gary Benson <gbenson@redhat.com> |
---|---|
date | Wed, 11 Mar 2009 09:03:27 -0400 |
parents | c8fd76f04b59 |
children | 96d1de001c8d |
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. * */ class SharkState; class SharkBlock : public ResourceObj { public: SharkBlock(SharkBuilder* builder, ciMethod* target, ciBytecodeStream* iter, llvm::Value* thread) : _builder(builder), _target(target), _iter(iter), _current_state(NULL), _thread(thread) {} private: SharkBuilder* _builder; ciMethod* _target; ciBytecodeStream* _iter; SharkState* _current_state; llvm::Value* _thread; public: SharkBuilder* builder() const { return _builder; } ciMethod* target() const { return _target; } ciBytecodeStream* iter() const { return _iter; } llvm::Value* thread() const { return _thread; } // Target properties public: int max_locals() const { return target()->max_locals(); } int max_stack() const { return target()->max_stack(); } // Bytecode stream public: Bytecodes::Code bc() const { return iter()->cur_bc(); } int bci() const { return iter()->cur_bci(); } // Entry state protected: virtual SharkState* entry_state(); // Current state private: SharkState* initial_current_state(); public: SharkState* current_state() { if (_current_state == NULL) set_current_state(initial_current_state()); return _current_state; } protected: void set_current_state(SharkState* current_state) { _current_state = current_state; } // Local variables protected: SharkValue* local(int index) { SharkValue *value = current_state()->local(index); assert(value != NULL, "shouldn't be"); assert(value->is_one_word() || (index + 1 < max_locals() && current_state()->local(index + 1) == NULL), "should be"); return value; } void set_local(int index, SharkValue* value) { assert(value != NULL, "shouldn't be"); current_state()->set_local(index, value); if (value->is_two_word()) current_state()->set_local(index + 1, NULL); } // Expression stack (raw) protected: void xpush(SharkValue* value) { current_state()->push(value); } SharkValue* xpop() { return current_state()->pop(); } SharkValue* xstack(int slot) { SharkValue *value = current_state()->stack(slot); assert(value != NULL, "shouldn't be"); assert(value->is_one_word() || (slot > 0 && current_state()->stack(slot - 1) == NULL), "should be"); return value; } int xstack_depth() { return current_state()->stack_depth(); } // Expression stack (cooked) protected: void push(SharkValue* value) { assert(value != NULL, "shouldn't be"); xpush(value); if (value->is_two_word()) xpush(NULL); } SharkValue* pop() { int size = current_state()->stack(0) == NULL ? 2 : 1; if (size == 2) xpop(); SharkValue *value = xpop(); assert(value && value->size() == size, "should be"); return value; } SharkValue* pop_result(BasicType type) { SharkValue *result = pop(); #ifdef ASSERT switch (result->basic_type()) { case T_BOOLEAN: case T_BYTE: case T_CHAR: case T_SHORT: assert(type == T_INT, "type mismatch"); break; case T_ARRAY: assert(type == T_OBJECT, "type mismatch"); break; default: assert(result->basic_type() == type, "type mismatch"); } #endif // ASSERT return result; } // Code generation public: virtual void emit_IR(); protected: void parse_bytecode(int start, int limit); // Helpers protected: virtual void do_zero_check(SharkValue* value); virtual llvm::Value* lookup_for_ldc(); virtual llvm::Value* lookup_for_field_access(); // Leaf calls protected: llvm::CallInst* call_vm_leaf(llvm::Constant* callee, llvm::Value* arg1) { return builder()->CreateCall(callee, arg1); } // Zero checking protected: void check_null(SharkValue* object) { zero_check(object); } void check_divide_by_zero(SharkValue* value) { zero_check(value); } private: void zero_check(SharkValue* value) { if (!value->zero_checked()) do_zero_check(value); } // Safepoints protected: virtual void add_safepoint(); // ldc* private: void do_ldc() { SharkValue *value = SharkValue::from_ciConstant(iter()->get_constant()); if (value == NULL) value = SharkValue::create_jobject(lookup_for_ldc()); push(value); } // arraylength protected: virtual void do_arraylength(); // *aload and *astore protected: virtual void do_aload(BasicType basic_type); virtual void do_astore(BasicType basic_type); // *div and *rem private: void do_idiv() { do_div_or_rem(false, false); } void do_irem() { do_div_or_rem(false, true); } void do_ldiv() { do_div_or_rem(true, false); } void do_lrem() { do_div_or_rem(true, true); } void do_div_or_rem(bool is_long, bool is_rem); // get* and put* private: void do_getstatic() { do_field_access(true, false); } void do_getfield() { do_field_access(true, true); } void do_putstatic() { do_field_access(false, false); } void do_putfield() { do_field_access(false, true); } void do_field_access(bool is_get, bool is_field); // lcmp and [fd]cmp[lg] private: void do_lcmp(); void do_fcmp(bool is_double, bool unordered_is_greater); // *return and athrow protected: virtual void do_return(BasicType type); virtual void do_athrow(); // goto* protected: virtual void do_goto(); // jsr* and ret protected: virtual void do_jsr(); virtual void do_ret(); // if* protected: virtual void do_if(llvm::ICmpInst::Predicate p, SharkValue* b, SharkValue* a); // *switch protected: int switch_default_dest(); int switch_table_length(); int switch_key(int i); int switch_dest(int i); virtual void do_switch(); // invoke* protected: virtual void do_call(); // checkcast and instanceof protected: virtual void do_instance_check(); // new and *newarray protected: virtual void do_new(); virtual void do_newarray(); virtual void do_anewarray(); virtual void do_multianewarray(); // monitorenter and monitorexit protected: virtual void do_monitorenter(); virtual void do_monitorexit(); };