1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
300
301 // Compute highest outgoing stack argument as
302 // _new_SP + out_preserve_stack_slots + max(outgoing argument size).
303 _out_arg_limit = OptoReg::add(_new_SP, C->out_preserve_stack_slots());
304 assert( is_even(_out_arg_limit), "out_preserve must be even" );
305
306 if (!RegMask::can_represent_arg(OptoReg::add(_out_arg_limit,-1))) {
307 // the compiler cannot represent this method's calling sequence
308 C->record_method_not_compilable("must be able to represent all call arguments in reg mask");
309 }
310
311 if (C->failing()) return; // bailed out on incoming arg failure
312
313 // ---------------
314 // Collect roots of matcher trees. Every node for which
315 // _shared[_idx] is cleared is guaranteed to not be shared, and thus
316 // can be a valid interior of some tree.
317 find_shared( C->root() );
318 find_shared( C->top() );
319
320 C->print_method("Before Matching");
321
322 // Create new ideal node ConP #NULL even if it does exist in old space
323 // to avoid false sharing if the corresponding mach node is not used.
324 // The corresponding mach node is only used in rare cases for derived
325 // pointers.
326 Node* new_ideal_null = ConNode::make(C, TypePtr::NULL_PTR);
327
328 // Swap out to old-space; emptying new-space
329 Arena *old = C->node_arena()->move_contents(C->old_arena());
330
331 // Save debug and profile information for nodes in old space:
332 _old_node_note_array = C->node_note_array();
333 if (_old_node_note_array != NULL) {
334 C->set_node_note_array(new(C->comp_arena()) GrowableArray<Node_Notes*>
335 (C->comp_arena(), _old_node_note_array->length(),
336 0, NULL));
337 }
338
339 // Pre-size the new_node table to avoid the need for range checks.
340 grow_new_node_array(C->unique());
1841 if( kid == NULL && !_swallowed[rule] ) {
1842 mach->add_req( s->_leaf ); // Add leaf pointer
1843 return; // Bail out
1844 }
1845
1846 if( s->_leaf->is_Load() ) {
1847 assert( mem == (Node*)1, "multiple Memories being matched at once?" );
1848 mem = s->_leaf->in(MemNode::Memory);
1849 debug_only(_mem_node = s->_leaf;)
1850 }
1851 if( s->_leaf->in(0) && s->_leaf->req() > 1) {
1852 if( !mach->in(0) )
1853 mach->set_req(0,s->_leaf->in(0));
1854 else {
1855 assert( s->_leaf->in(0) == mach->in(0), "same instruction, differing controls?" );
1856 }
1857 }
1858
1859 for( uint i=0; kid != NULL && i<2; kid = s->_kids[1], i++ ) { // binary tree
1860 int newrule;
1861 if( i == 0 )
1862 newrule = kid->_rule[_leftOp[rule]];
1863 else
1864 newrule = kid->_rule[_rightOp[rule]];
1865
1866 if( newrule < _LAST_MACH_OPER ) { // Operand or instruction?
1867 // Internal operand; recurse but do nothing else
1868 ReduceOper( kid, newrule, mem, mach );
1869
1870 } else { // Child is a new instruction
1871 // Reduce the instruction, and add a direct pointer from this
1872 // machine instruction to the newly reduced one.
1873 Node *mem1 = (Node*)1;
1874 debug_only(Node *save_mem_node = _mem_node;)
1875 mach->add_req( ReduceInst( kid, newrule, mem1 ) );
1876 debug_only(_mem_node = save_mem_node;)
1877 }
1878 }
1879 }
1880
1881
|
1 /*
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
300
301 // Compute highest outgoing stack argument as
302 // _new_SP + out_preserve_stack_slots + max(outgoing argument size).
303 _out_arg_limit = OptoReg::add(_new_SP, C->out_preserve_stack_slots());
304 assert( is_even(_out_arg_limit), "out_preserve must be even" );
305
306 if (!RegMask::can_represent_arg(OptoReg::add(_out_arg_limit,-1))) {
307 // the compiler cannot represent this method's calling sequence
308 C->record_method_not_compilable("must be able to represent all call arguments in reg mask");
309 }
310
311 if (C->failing()) return; // bailed out on incoming arg failure
312
313 // ---------------
314 // Collect roots of matcher trees. Every node for which
315 // _shared[_idx] is cleared is guaranteed to not be shared, and thus
316 // can be a valid interior of some tree.
317 find_shared( C->root() );
318 find_shared( C->top() );
319
320 C->print_method(PHASE_BEFORE_MATCHING);
321
322 // Create new ideal node ConP #NULL even if it does exist in old space
323 // to avoid false sharing if the corresponding mach node is not used.
324 // The corresponding mach node is only used in rare cases for derived
325 // pointers.
326 Node* new_ideal_null = ConNode::make(C, TypePtr::NULL_PTR);
327
328 // Swap out to old-space; emptying new-space
329 Arena *old = C->node_arena()->move_contents(C->old_arena());
330
331 // Save debug and profile information for nodes in old space:
332 _old_node_note_array = C->node_note_array();
333 if (_old_node_note_array != NULL) {
334 C->set_node_note_array(new(C->comp_arena()) GrowableArray<Node_Notes*>
335 (C->comp_arena(), _old_node_note_array->length(),
336 0, NULL));
337 }
338
339 // Pre-size the new_node table to avoid the need for range checks.
340 grow_new_node_array(C->unique());
1841 if( kid == NULL && !_swallowed[rule] ) {
1842 mach->add_req( s->_leaf ); // Add leaf pointer
1843 return; // Bail out
1844 }
1845
1846 if( s->_leaf->is_Load() ) {
1847 assert( mem == (Node*)1, "multiple Memories being matched at once?" );
1848 mem = s->_leaf->in(MemNode::Memory);
1849 debug_only(_mem_node = s->_leaf;)
1850 }
1851 if( s->_leaf->in(0) && s->_leaf->req() > 1) {
1852 if( !mach->in(0) )
1853 mach->set_req(0,s->_leaf->in(0));
1854 else {
1855 assert( s->_leaf->in(0) == mach->in(0), "same instruction, differing controls?" );
1856 }
1857 }
1858
1859 for( uint i=0; kid != NULL && i<2; kid = s->_kids[1], i++ ) { // binary tree
1860 int newrule;
1861 if( i == 0)
1862 newrule = kid->_rule[_leftOp[rule]];
1863 else
1864 newrule = kid->_rule[_rightOp[rule]];
1865
1866 if( newrule < _LAST_MACH_OPER ) { // Operand or instruction?
1867 // Internal operand; recurse but do nothing else
1868 ReduceOper( kid, newrule, mem, mach );
1869
1870 } else { // Child is a new instruction
1871 // Reduce the instruction, and add a direct pointer from this
1872 // machine instruction to the newly reduced one.
1873 Node *mem1 = (Node*)1;
1874 debug_only(Node *save_mem_node = _mem_node;)
1875 mach->add_req( ReduceInst( kid, newrule, mem1 ) );
1876 debug_only(_mem_node = save_mem_node;)
1877 }
1878 }
1879 }
1880
1881
|