Mercurial > hg > truffle
comparison src/share/vm/interpreter/linkResolver.cpp @ 17637:1a023fd29afb
8031045: Access checks should precede additional per-instruction checks
Summary: Move access check above the check for non-static method
Reviewed-by: lfoltan, coleenp
author | hseigel |
---|---|
date | Fri, 17 Jan 2014 09:39:51 -0500 |
parents | 5832cdaf89c6 |
children | f3959a2e0eee |
comparison
equal
deleted
inserted
replaced
17632:2604e2767d2c | 17637:1a023fd29afb |
---|---|
1 /* | 1 /* |
2 * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. | 2 * Copyright (c) 1997, 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. |
647 method_name, | 647 method_name, |
648 method_signature)); | 648 method_signature)); |
649 } | 649 } |
650 } | 650 } |
651 | 651 |
652 if (nostatics && resolved_method->is_static()) { | |
653 ResourceMark rm(THREAD); | |
654 char buf[200]; | |
655 jio_snprintf(buf, sizeof(buf), "Expected instance not static method %s", Method::name_and_sig_as_C_string(resolved_klass(), | |
656 resolved_method->name(), | |
657 resolved_method->signature())); | |
658 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); | |
659 } | |
660 | |
661 | |
662 if (check_access) { | 652 if (check_access) { |
663 // JDK8 adds non-public interface methods, and accessability check requirement | 653 // JDK8 adds non-public interface methods, and accessability check requirement |
664 assert(current_klass.not_null() , "current_klass should not be null"); | 654 assert(current_klass.not_null() , "current_klass should not be null"); |
665 | 655 |
666 // check if method can be accessed by the referring class | 656 // check if method can be accessed by the referring class |
700 THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); | 690 THROW_MSG(vmSymbols::java_lang_LinkageError(), buf); |
701 } | 691 } |
702 } | 692 } |
703 } | 693 } |
704 | 694 |
695 if (nostatics && resolved_method->is_static()) { | |
696 ResourceMark rm(THREAD); | |
697 char buf[200]; | |
698 jio_snprintf(buf, sizeof(buf), "Expected instance not static method %s", | |
699 Method::name_and_sig_as_C_string(resolved_klass(), | |
700 resolved_method->name(), resolved_method->signature())); | |
701 THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), buf); | |
702 } | |
703 | |
705 if (TraceItables && Verbose) { | 704 if (TraceItables && Verbose) { |
706 ResourceMark rm(THREAD); | 705 ResourceMark rm(THREAD); |
707 tty->print("invokeinterface resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ", | 706 tty->print("invokeinterface resolved method: caller-class:%s, compile-time-class:%s, method:%s, method_holder:%s, access_flags: ", |
708 (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()), | 707 (current_klass.is_null() ? "<NULL>" : current_klass->internal_name()), |
709 (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()), | 708 (resolved_klass.is_null() ? "<NULL>" : resolved_klass->internal_name()), |