Tue, 23 Nov 2010 13:22:55 -0800
6989984: Use standard include model for Hospot
Summary: Replaced MakeDeps and the includeDB files with more standardized solutions.
Reviewed-by: coleenp, kvn, kamg
twisti@2047 | 1 | /* |
stefank@2314 | 2 | * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. |
twisti@2047 | 3 | * Copyright 2008, 2009 Red Hat, Inc. |
twisti@2047 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
twisti@2047 | 5 | * |
twisti@2047 | 6 | * This code is free software; you can redistribute it and/or modify it |
twisti@2047 | 7 | * under the terms of the GNU General Public License version 2 only, as |
twisti@2047 | 8 | * published by the Free Software Foundation. |
twisti@2047 | 9 | * |
twisti@2047 | 10 | * This code is distributed in the hope that it will be useful, but WITHOUT |
twisti@2047 | 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
twisti@2047 | 12 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
twisti@2047 | 13 | * version 2 for more details (a copy is included in the LICENSE file that |
twisti@2047 | 14 | * accompanied this code). |
twisti@2047 | 15 | * |
twisti@2047 | 16 | * You should have received a copy of the GNU General Public License version |
twisti@2047 | 17 | * 2 along with this work; if not, write to the Free Software Foundation, |
twisti@2047 | 18 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
twisti@2047 | 19 | * |
twisti@2047 | 20 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
twisti@2047 | 21 | * or visit www.oracle.com if you need additional information or have any |
twisti@2047 | 22 | * questions. |
twisti@2047 | 23 | * |
twisti@2047 | 24 | */ |
twisti@2047 | 25 | |
stefank@2314 | 26 | #ifndef SHARE_VM_SHARK_SHARKFUNCTION_HPP |
stefank@2314 | 27 | #define SHARE_VM_SHARK_SHARKFUNCTION_HPP |
stefank@2314 | 28 | |
stefank@2314 | 29 | #include "ci/ciEnv.hpp" |
stefank@2314 | 30 | #include "ci/ciStreams.hpp" |
stefank@2314 | 31 | #include "ci/ciTypeFlow.hpp" |
stefank@2314 | 32 | #include "memory/allocation.hpp" |
stefank@2314 | 33 | #include "shark/llvmHeaders.hpp" |
stefank@2314 | 34 | #include "shark/llvmValue.hpp" |
stefank@2314 | 35 | #include "shark/sharkBuilder.hpp" |
stefank@2314 | 36 | #include "shark/sharkContext.hpp" |
stefank@2314 | 37 | #include "shark/sharkInvariants.hpp" |
stefank@2314 | 38 | #include "shark/sharkStack.hpp" |
stefank@2314 | 39 | |
twisti@2047 | 40 | class SharkTopLevelBlock; |
twisti@2047 | 41 | class DeferredZeroCheck; |
twisti@2047 | 42 | |
twisti@2047 | 43 | class SharkFunction : public SharkTargetInvariants { |
twisti@2047 | 44 | friend class SharkStackWithNormalFrame; |
twisti@2047 | 45 | |
twisti@2047 | 46 | public: |
twisti@2047 | 47 | static llvm::Function* build(ciEnv* env, |
twisti@2047 | 48 | SharkBuilder* builder, |
twisti@2047 | 49 | ciTypeFlow* flow, |
twisti@2047 | 50 | const char* name) { |
twisti@2047 | 51 | SharkFunction function(env, builder, flow, name); |
twisti@2047 | 52 | return function.function(); |
twisti@2047 | 53 | } |
twisti@2047 | 54 | |
twisti@2047 | 55 | private: |
twisti@2047 | 56 | SharkFunction(ciEnv* env, |
twisti@2047 | 57 | SharkBuilder* builder, |
twisti@2047 | 58 | ciTypeFlow* flow, |
twisti@2047 | 59 | const char* name) |
twisti@2047 | 60 | : SharkTargetInvariants(env, builder, flow) { initialize(name); } |
twisti@2047 | 61 | |
twisti@2047 | 62 | private: |
twisti@2047 | 63 | void initialize(const char* name); |
twisti@2047 | 64 | |
twisti@2047 | 65 | private: |
twisti@2047 | 66 | llvm::Function* _function; |
twisti@2047 | 67 | SharkTopLevelBlock** _blocks; |
twisti@2047 | 68 | GrowableArray<DeferredZeroCheck*> _deferred_zero_checks; |
twisti@2047 | 69 | SharkStack* _stack; |
twisti@2047 | 70 | |
twisti@2047 | 71 | public: |
twisti@2047 | 72 | llvm::Function* function() const { |
twisti@2047 | 73 | return _function; |
twisti@2047 | 74 | } |
twisti@2047 | 75 | int block_count() const { |
twisti@2047 | 76 | return flow()->block_count(); |
twisti@2047 | 77 | } |
twisti@2047 | 78 | SharkTopLevelBlock* block(int i) const { |
twisti@2047 | 79 | assert(i < block_count(), "should be"); |
twisti@2047 | 80 | return _blocks[i]; |
twisti@2047 | 81 | } |
twisti@2047 | 82 | GrowableArray<DeferredZeroCheck*>* deferred_zero_checks() { |
twisti@2047 | 83 | return &_deferred_zero_checks; |
twisti@2047 | 84 | } |
twisti@2047 | 85 | SharkStack* stack() const { |
twisti@2047 | 86 | return _stack; |
twisti@2047 | 87 | } |
twisti@2047 | 88 | |
twisti@2047 | 89 | // On-stack replacement |
twisti@2047 | 90 | private: |
twisti@2047 | 91 | bool is_osr() const { |
twisti@2047 | 92 | return flow()->is_osr_flow(); |
twisti@2047 | 93 | } |
twisti@2047 | 94 | const llvm::FunctionType* entry_point_type() const { |
twisti@2047 | 95 | if (is_osr()) |
twisti@2047 | 96 | return SharkType::osr_entry_point_type(); |
twisti@2047 | 97 | else |
twisti@2047 | 98 | return SharkType::entry_point_type(); |
twisti@2047 | 99 | } |
twisti@2047 | 100 | |
twisti@2047 | 101 | // Block management |
twisti@2047 | 102 | private: |
twisti@2047 | 103 | llvm::BasicBlock* _block_insertion_point; |
twisti@2047 | 104 | |
twisti@2047 | 105 | void set_block_insertion_point(llvm::BasicBlock* block_insertion_point) { |
twisti@2047 | 106 | _block_insertion_point = block_insertion_point; |
twisti@2047 | 107 | } |
twisti@2047 | 108 | llvm::BasicBlock* block_insertion_point() const { |
twisti@2047 | 109 | return _block_insertion_point; |
twisti@2047 | 110 | } |
twisti@2047 | 111 | |
twisti@2047 | 112 | public: |
twisti@2047 | 113 | llvm::BasicBlock* CreateBlock(const char* name = "") const { |
twisti@2047 | 114 | return llvm::BasicBlock::Create( |
twisti@2047 | 115 | SharkContext::current(), name, function(), block_insertion_point()); |
twisti@2047 | 116 | } |
twisti@2047 | 117 | |
twisti@2047 | 118 | // Deferred zero checks |
twisti@2047 | 119 | public: |
twisti@2047 | 120 | void add_deferred_zero_check(SharkTopLevelBlock* block, |
twisti@2047 | 121 | SharkValue* value); |
twisti@2047 | 122 | |
twisti@2047 | 123 | private: |
twisti@2047 | 124 | void do_deferred_zero_checks(); |
twisti@2047 | 125 | }; |
stefank@2314 | 126 | |
stefank@2314 | 127 | #endif // SHARE_VM_SHARK_SHARKFUNCTION_HPP |