Mercurial > hg > graal-jvmci-8
comparison src/share/vm/classfile/verifier.hpp @ 17573:aff11567504c
8035119: Fix exceptions to bytecode verification
Summary: Prevent ctor calls to super() and this() from avoidable code (try blocks, if stmts, etc.)
Reviewed-by: coleenp, acorn, mschoene
author | hseigel |
---|---|
date | Mon, 17 Mar 2014 10:17:55 -0400 |
parents | 22eaa15b7960 |
children | f73af4455d7d |
comparison
equal
deleted
inserted
replaced
17572:cc7a96a360d0 | 17573:aff11567504c |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
256 Symbol* _exception_type; | 256 Symbol* _exception_type; |
257 char* _message; | 257 char* _message; |
258 | 258 |
259 ErrorContext _error_context; // contains information about an error | 259 ErrorContext _error_context; // contains information about an error |
260 | 260 |
261 // Used to detect illegal jumps over calls to super() nd this() in ctors. | |
262 int32_t _furthest_jump; | |
263 | |
261 void verify_method(methodHandle method, TRAPS); | 264 void verify_method(methodHandle method, TRAPS); |
262 char* generate_code_data(methodHandle m, u4 code_length, TRAPS); | 265 char* generate_code_data(methodHandle m, u4 code_length, TRAPS); |
263 void verify_exception_handler_table(u4 code_length, char* code_data, | 266 void verify_exception_handler_table(u4 code_length, char* code_data, |
264 int& min, int& max, TRAPS); | 267 int& min, int& max, TRAPS); |
265 void verify_local_variable_table(u4 code_length, char* code_data, TRAPS); | 268 void verify_local_variable_table(u4 code_length, char* code_data, TRAPS); |
401 Symbol* create_temporary_symbol( | 404 Symbol* create_temporary_symbol( |
402 const Symbol* s, int begin, int end, TRAPS); | 405 const Symbol* s, int begin, int end, TRAPS); |
403 Symbol* create_temporary_symbol(const char *s, int length, TRAPS); | 406 Symbol* create_temporary_symbol(const char *s, int length, TRAPS); |
404 | 407 |
405 TypeOrigin ref_ctx(const char* str, TRAPS); | 408 TypeOrigin ref_ctx(const char* str, TRAPS); |
409 | |
410 // Keep track of the furthest branch done in a method to make sure that | |
411 // there are no branches over calls to super() or this() from inside of | |
412 // a constructor. | |
413 int32_t furthest_jump() { return _furthest_jump; } | |
414 | |
415 void set_furthest_jump(int32_t target) { | |
416 _furthest_jump = target; | |
417 } | |
418 | |
419 void update_furthest_jump(int32_t target) { | |
420 if (target > _furthest_jump) _furthest_jump = target; | |
421 } | |
422 | |
406 }; | 423 }; |
407 | 424 |
408 inline int ClassVerifier::change_sig_to_verificationType( | 425 inline int ClassVerifier::change_sig_to_verificationType( |
409 SignatureStream* sig_type, VerificationType* inference_type, TRAPS) { | 426 SignatureStream* sig_type, VerificationType* inference_type, TRAPS) { |
410 BasicType bt = sig_type->type(); | 427 BasicType bt = sig_type->type(); |