1 /*
2 * Copyright (c) 2003, 2016, 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 *
46
47 // See comment in StackMapTable about _frame_count about why these
48 // fields are int32_t instead of u2.
49 int32_t _locals_size; // number of valid type elements in _locals
50 int32_t _stack_size; // number of valid type elements in _stack
51
52 int32_t _stack_mark; // Records the size of the stack prior to an
53 // instruction modification, to allow rewinding
54 // when/if an error occurs.
55
56 int32_t _max_locals;
57 int32_t _max_stack;
58
59 u1 _flags;
60 VerificationType* _locals; // local variable type array
61 VerificationType* _stack; // operand stack type array
62
63 ClassVerifier* _verifier; // the verifier verifying this method
64
65 StackMapFrame(const StackMapFrame& cp) :
66 _offset(cp._offset), _locals_size(cp._locals_size),
67 _stack_size(cp._stack_size), _stack_mark(cp._stack_mark),
68 _max_locals(cp._max_locals), _max_stack(cp._max_stack),
69 _flags(cp._flags) {
70 _locals = NEW_RESOURCE_ARRAY(VerificationType, _max_locals);
71 for (int i = 0; i < _max_locals; ++i) {
72 if (i < _locals_size) {
73 _locals[i] = cp._locals[i];
74 } else {
75 _locals[i] = VerificationType::bogus_type();
76 }
77 }
78 int ss = MAX2(_stack_size, _stack_mark);
79 _stack = NEW_RESOURCE_ARRAY(VerificationType, _max_stack);
80 for (int i = 0; i < _max_stack; ++i) {
81 if (i < ss) {
82 _stack[i] = cp._stack[i];
83 } else {
84 _stack[i] = VerificationType::bogus_type();
85 }
|
1 /*
2 * Copyright (c) 2003, 2018, 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 *
46
47 // See comment in StackMapTable about _frame_count about why these
48 // fields are int32_t instead of u2.
49 int32_t _locals_size; // number of valid type elements in _locals
50 int32_t _stack_size; // number of valid type elements in _stack
51
52 int32_t _stack_mark; // Records the size of the stack prior to an
53 // instruction modification, to allow rewinding
54 // when/if an error occurs.
55
56 int32_t _max_locals;
57 int32_t _max_stack;
58
59 u1 _flags;
60 VerificationType* _locals; // local variable type array
61 VerificationType* _stack; // operand stack type array
62
63 ClassVerifier* _verifier; // the verifier verifying this method
64
65 StackMapFrame(const StackMapFrame& cp) :
66 ResourceObj(cp),
67 _offset(cp._offset), _locals_size(cp._locals_size),
68 _stack_size(cp._stack_size), _stack_mark(cp._stack_mark),
69 _max_locals(cp._max_locals), _max_stack(cp._max_stack),
70 _flags(cp._flags) {
71 _locals = NEW_RESOURCE_ARRAY(VerificationType, _max_locals);
72 for (int i = 0; i < _max_locals; ++i) {
73 if (i < _locals_size) {
74 _locals[i] = cp._locals[i];
75 } else {
76 _locals[i] = VerificationType::bogus_type();
77 }
78 }
79 int ss = MAX2(_stack_size, _stack_mark);
80 _stack = NEW_RESOURCE_ARRAY(VerificationType, _max_stack);
81 for (int i = 0; i < _max_stack; ++i) {
82 if (i < ss) {
83 _stack[i] = cp._stack[i];
84 } else {
85 _stack[i] = VerificationType::bogus_type();
86 }
|