Wed, 18 Sep 2013 14:34:56 -0700
8024342: PPC64 (part 111): Support for C calling conventions that require 64-bit ints.
Summary: Some platforms, as ppc and s390x/zArch require that 32-bit ints are passed as 64-bit values to C functions. This change adds support to adapt the signature and to issue proper casts to c2-compiled stubs. The functions are used in generate_native_wrapper(). Adapt signature used by the compiler as in PhaseIdealLoop::intrinsify_fill().
Reviewed-by: kvn
duke@435 | 1 | /* |
mikael@4153 | 2 | * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved. |
duke@435 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
duke@435 | 4 | * |
duke@435 | 5 | * This code is free software; you can redistribute it and/or modify it |
duke@435 | 6 | * under the terms of the GNU General Public License version 2 only, as |
duke@435 | 7 | * published by the Free Software Foundation. |
duke@435 | 8 | * |
duke@435 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
duke@435 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
duke@435 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
duke@435 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
duke@435 | 13 | * accompanied this code). |
duke@435 | 14 | * |
duke@435 | 15 | * You should have received a copy of the GNU General Public License version |
duke@435 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
duke@435 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
duke@435 | 18 | * |
trims@1907 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
trims@1907 | 20 | * or visit www.oracle.com if you need additional information or have any |
trims@1907 | 21 | * questions. |
duke@435 | 22 | * |
duke@435 | 23 | */ |
duke@435 | 24 | |
stefank@2314 | 25 | #ifndef SHARE_VM_OPTO_MACRO_HPP |
stefank@2314 | 26 | #define SHARE_VM_OPTO_MACRO_HPP |
stefank@2314 | 27 | |
stefank@2314 | 28 | #include "opto/phase.hpp" |
stefank@2314 | 29 | |
duke@435 | 30 | class AllocateNode; |
duke@435 | 31 | class AllocateArrayNode; |
duke@435 | 32 | class CallNode; |
duke@435 | 33 | class Node; |
duke@435 | 34 | class PhaseIterGVN; |
duke@435 | 35 | |
duke@435 | 36 | class PhaseMacroExpand : public Phase { |
duke@435 | 37 | private: |
duke@435 | 38 | PhaseIterGVN &_igvn; |
duke@435 | 39 | |
duke@435 | 40 | // Helper methods roughly modelled after GraphKit: |
duke@435 | 41 | Node* top() const { return C->top(); } |
duke@435 | 42 | Node* intcon(jint con) const { return _igvn.intcon(con); } |
duke@435 | 43 | Node* longcon(jlong con) const { return _igvn.longcon(con); } |
duke@435 | 44 | Node* makecon(const Type *t) const { return _igvn.makecon(t); } |
duke@435 | 45 | Node* basic_plus_adr(Node* base, int offset) { |
duke@435 | 46 | return (offset == 0)? base: basic_plus_adr(base, MakeConX(offset)); |
duke@435 | 47 | } |
duke@435 | 48 | Node* basic_plus_adr(Node* base, Node* ptr, int offset) { |
duke@435 | 49 | return (offset == 0)? ptr: basic_plus_adr(base, ptr, MakeConX(offset)); |
duke@435 | 50 | } |
duke@435 | 51 | Node* basic_plus_adr(Node* base, Node* offset) { |
duke@435 | 52 | return basic_plus_adr(base, base, offset); |
duke@435 | 53 | } |
duke@435 | 54 | Node* basic_plus_adr(Node* base, Node* ptr, Node* offset) { |
kvn@4115 | 55 | Node* adr = new (C) AddPNode(base, ptr, offset); |
duke@435 | 56 | return transform_later(adr); |
duke@435 | 57 | } |
duke@435 | 58 | Node* transform_later(Node* n) { |
duke@435 | 59 | // equivalent to _gvn.transform in GraphKit, Ideal, etc. |
duke@435 | 60 | _igvn.register_new_node_with_optimizer(n); |
duke@435 | 61 | return n; |
duke@435 | 62 | } |
duke@435 | 63 | void set_eden_pointers(Node* &eden_top_adr, Node* &eden_end_adr); |
duke@435 | 64 | Node* make_load( Node* ctl, Node* mem, Node* base, int offset, |
duke@435 | 65 | const Type* value_type, BasicType bt); |
duke@435 | 66 | Node* make_store(Node* ctl, Node* mem, Node* base, int offset, |
duke@435 | 67 | Node* value, BasicType bt); |
duke@435 | 68 | |
duke@435 | 69 | // projections extracted from a call node |
duke@435 | 70 | ProjNode *_fallthroughproj; |
duke@435 | 71 | ProjNode *_fallthroughcatchproj; |
duke@435 | 72 | ProjNode *_ioproj_fallthrough; |
duke@435 | 73 | ProjNode *_ioproj_catchall; |
duke@435 | 74 | ProjNode *_catchallcatchproj; |
duke@435 | 75 | ProjNode *_memproj_fallthrough; |
duke@435 | 76 | ProjNode *_memproj_catchall; |
duke@435 | 77 | ProjNode *_resproj; |
duke@435 | 78 | |
duke@435 | 79 | |
duke@435 | 80 | void expand_allocate(AllocateNode *alloc); |
duke@435 | 81 | void expand_allocate_array(AllocateArrayNode *alloc); |
duke@435 | 82 | void expand_allocate_common(AllocateNode* alloc, |
duke@435 | 83 | Node* length, |
duke@435 | 84 | const TypeFunc* slow_call_type, |
duke@435 | 85 | address slow_call_address); |
kvn@508 | 86 | Node *value_from_mem(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc); |
kvn@682 | 87 | Node *value_from_mem_phi(Node *mem, BasicType ft, const Type *ftype, const TypeOopPtr *adr_t, Node *alloc, Node_Stack *value_phis, int level); |
kvn@508 | 88 | |
kvn@5110 | 89 | bool eliminate_boxing_node(CallStaticJavaNode *boxing); |
kvn@508 | 90 | bool eliminate_allocate_node(AllocateNode *alloc); |
kvn@508 | 91 | bool can_eliminate_allocation(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints); |
kvn@508 | 92 | bool scalar_replacement(AllocateNode *alloc, GrowableArray <SafePointNode *>& safepoints_done); |
kvn@5110 | 93 | void process_users_of_allocation(CallNode *alloc); |
kvn@508 | 94 | |
kvn@508 | 95 | void eliminate_card_mark(Node *cm); |
kvn@3406 | 96 | void mark_eliminated_box(Node* box, Node* obj); |
kvn@2951 | 97 | void mark_eliminated_locking_nodes(AbstractLockNode *alock); |
kvn@501 | 98 | bool eliminate_locking_node(AbstractLockNode *alock); |
duke@435 | 99 | void expand_lock_node(LockNode *lock); |
duke@435 | 100 | void expand_unlock_node(UnlockNode *unlock); |
duke@435 | 101 | |
duke@435 | 102 | int replace_input(Node *use, Node *oldref, Node *newref); |
duke@435 | 103 | void copy_call_debug_info(CallNode *oldcall, CallNode * newcall); |
kvn@855 | 104 | Node* opt_bits_test(Node* ctrl, Node* region, int edge, Node* word, int mask, int bits, bool return_fast_path = false); |
duke@435 | 105 | void copy_predefined_input_for_runtime_call(Node * ctrl, CallNode* oldcall, CallNode* call); |
duke@435 | 106 | CallNode* make_slow_call(CallNode *oldcall, const TypeFunc* slow_call_type, address slow_call, |
duke@435 | 107 | const char* leaf_name, Node* slow_path, Node* parm0, Node* parm1); |
duke@435 | 108 | void extract_call_projections(CallNode *call); |
duke@435 | 109 | |
duke@435 | 110 | Node* initialize_object(AllocateNode* alloc, |
duke@435 | 111 | Node* control, Node* rawmem, Node* object, |
duke@435 | 112 | Node* klass_node, Node* length, |
duke@435 | 113 | Node* size_in_bytes); |
duke@435 | 114 | |
duke@435 | 115 | Node* prefetch_allocation(Node* i_o, |
duke@435 | 116 | Node*& needgc_false, Node*& contended_phi_rawmem, |
duke@435 | 117 | Node* old_eden_top, Node* new_eden_top, |
duke@435 | 118 | Node* length); |
duke@435 | 119 | |
duke@435 | 120 | public: |
coleenp@548 | 121 | PhaseMacroExpand(PhaseIterGVN &igvn) : Phase(Macro_Expand), _igvn(igvn) { |
coleenp@548 | 122 | _igvn.set_delay_transform(true); |
coleenp@548 | 123 | } |
kvn@3311 | 124 | void eliminate_macro_nodes(); |
duke@435 | 125 | bool expand_macro_nodes(); |
duke@435 | 126 | |
duke@435 | 127 | }; |
stefank@2314 | 128 | |
stefank@2314 | 129 | #endif // SHARE_VM_OPTO_MACRO_HPP |