1 /*
2 * Copyright (c) 2003, 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 *
158 // Return true if an uninitialized object is found.
159 bool has_new_object() const;
160
161 // Search local variable type array and stack type array.
162 // Set every element with type of old_object to new_object.
163 void initialize_object(
164 VerificationType old_object, VerificationType new_object);
165
166 // Copy local variable type array in src into this local variable type array.
167 void copy_locals(const StackMapFrame* src);
168
169 // Copy stack type array in src into this stack type array.
170 void copy_stack(const StackMapFrame* src);
171
172 // Return true if this stack map frame is assignable to target.
173 bool is_assignable_to(
174 const StackMapFrame* target, bool is_exception_handler,
175 ErrorContext* ctx, TRAPS) const;
176
177 inline void set_mark() {
178 #ifdef DEBUG
179 // Put bogus type to indicate it's no longer valid.
180 if (_stack_mark != -1) {
181 for (int i = _stack_mark - 1; i >= _stack_size; --i) {
182 _stack[i] = VerificationType::bogus_type();
183 }
184 }
185 #endif // def DEBUG
186 _stack_mark = _stack_size;
187 }
188
189 // Used when an error occurs and we want to reset the stack to the state
190 // it was before operands were popped off.
191 void restore() {
192 if (_stack_mark != -1) {
193 _stack_size = _stack_mark;
194 }
195 }
196
197 // Push type into stack type array.
198 inline void push_stack(VerificationType type, TRAPS) {
199 assert(!type.is_check(), "Must be a real type");
200 if (_stack_size >= _max_stack) {
201 verifier()->verify_error(
202 ErrorContext::stack_overflow(_offset, this),
203 "Operand stack overflow");
204 return;
205 }
|
1 /*
2 * Copyright (c) 2003, 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 *
158 // Return true if an uninitialized object is found.
159 bool has_new_object() const;
160
161 // Search local variable type array and stack type array.
162 // Set every element with type of old_object to new_object.
163 void initialize_object(
164 VerificationType old_object, VerificationType new_object);
165
166 // Copy local variable type array in src into this local variable type array.
167 void copy_locals(const StackMapFrame* src);
168
169 // Copy stack type array in src into this stack type array.
170 void copy_stack(const StackMapFrame* src);
171
172 // Return true if this stack map frame is assignable to target.
173 bool is_assignable_to(
174 const StackMapFrame* target, bool is_exception_handler,
175 ErrorContext* ctx, TRAPS) const;
176
177 inline void set_mark() {
178 #ifdef ASSERT
179 // Put bogus type to indicate it's no longer valid.
180 if (_stack_mark != -1) {
181 for (int i = _stack_mark - 1; i >= _stack_size; --i) {
182 _stack[i] = VerificationType::bogus_type();
183 }
184 }
185 #endif // def ASSERT
186 _stack_mark = _stack_size;
187 }
188
189 // Used when an error occurs and we want to reset the stack to the state
190 // it was before operands were popped off.
191 void restore() {
192 if (_stack_mark != -1) {
193 _stack_size = _stack_mark;
194 }
195 }
196
197 // Push type into stack type array.
198 inline void push_stack(VerificationType type, TRAPS) {
199 assert(!type.is_check(), "Must be a real type");
200 if (_stack_size >= _max_stack) {
201 verifier()->verify_error(
202 ErrorContext::stack_overflow(_offset, this),
203 "Operand stack overflow");
204 return;
205 }
|