1 /*
2 * Copyright (c) 1999, 2006, 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 *
23 */
24
25 class ValueStack: public CompilationResourceObj {
26 private:
27 IRScope* _scope; // the enclosing scope
28 bool _lock_stack; // indicates that this ValueStack is for an exception site
29 Values _locals; // the locals
30 Values _stack; // the expression stack
31 Values _locks; // the monitor stack (holding the locked values)
32
33 Value check(ValueTag tag, Value t) {
34 assert(tag == t->type()->tag() || tag == objectTag && t->type()->tag() == addressTag, "types must correspond");
35 return t;
36 }
37
38 Value check(ValueTag tag, Value t, Value h) {
39 assert(h->as_HiWord()->lo_word() == t, "incorrect stack pair");
40 return check(tag, t);
41 }
42
43 // helper routine
44 static void apply(Values list, ValueVisitor* f);
326 int cur_index; \
327 ValueStack* cur_state = v_block->state(); \
328 Value value; \
329 { \
330 for_each_stack_value(cur_state, cur_index, value) { \
331 Phi* v_phi = value->as_Phi(); \
332 if (v_phi != NULL && v_phi->block() == v_block) { \
333 v_code; \
334 } \
335 } \
336 } \
337 { \
338 for_each_local_value(cur_state, cur_index, value) { \
339 Phi* v_phi = value->as_Phi(); \
340 if (v_phi != NULL && v_phi->block() == v_block) { \
341 v_code; \
342 } \
343 } \
344 } \
345 }
|
1 /*
2 * Copyright (c) 1999, 2010, 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 *
23 */
24
25 #ifndef SHARE_VM_C1_C1_VALUESTACK_HPP
26 #define SHARE_VM_C1_C1_VALUESTACK_HPP
27
28 #include "c1/c1_Instruction.hpp"
29
30 class ValueStack: public CompilationResourceObj {
31 private:
32 IRScope* _scope; // the enclosing scope
33 bool _lock_stack; // indicates that this ValueStack is for an exception site
34 Values _locals; // the locals
35 Values _stack; // the expression stack
36 Values _locks; // the monitor stack (holding the locked values)
37
38 Value check(ValueTag tag, Value t) {
39 assert(tag == t->type()->tag() || tag == objectTag && t->type()->tag() == addressTag, "types must correspond");
40 return t;
41 }
42
43 Value check(ValueTag tag, Value t, Value h) {
44 assert(h->as_HiWord()->lo_word() == t, "incorrect stack pair");
45 return check(tag, t);
46 }
47
48 // helper routine
49 static void apply(Values list, ValueVisitor* f);
331 int cur_index; \
332 ValueStack* cur_state = v_block->state(); \
333 Value value; \
334 { \
335 for_each_stack_value(cur_state, cur_index, value) { \
336 Phi* v_phi = value->as_Phi(); \
337 if (v_phi != NULL && v_phi->block() == v_block) { \
338 v_code; \
339 } \
340 } \
341 } \
342 { \
343 for_each_local_value(cur_state, cur_index, value) { \
344 Phi* v_phi = value->as_Phi(); \
345 if (v_phi != NULL && v_phi->block() == v_block) { \
346 v_code; \
347 } \
348 } \
349 } \
350 }
351
352 #endif // SHARE_VM_C1_C1_VALUESTACK_HPP
|