comparison src/cpu/x86/vm/methodHandles_x86.cpp @ 12332:dc261f466b6d

8025260: Methodhandles/JSR292: NullPointerException (NPE) thrown instead of AbstractMethodError (AME) Summary: Copied null-checks from templateInterpreter_CPU into methodHandles_CPU Reviewed-by: jrose, twisti
author drchase
date Fri, 27 Sep 2013 13:36:25 -0400
parents cc32ccaaf47f
children 268e7a2178d7
comparison
equal deleted inserted replaced
12331:d8d059e90ec1 12332:dc261f466b6d
1 /* 1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2013, 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.
112 #endif //ASSERT 112 #endif //ASSERT
113 113
114 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp, 114 void MethodHandles::jump_from_method_handle(MacroAssembler* _masm, Register method, Register temp,
115 bool for_compiler_entry) { 115 bool for_compiler_entry) {
116 assert(method == rbx, "interpreter calling convention"); 116 assert(method == rbx, "interpreter calling convention");
117
118 Label L_no_such_method;
119 __ testptr(rbx, rbx);
120 __ jcc(Assembler::zero, L_no_such_method);
121
117 __ verify_method_ptr(method); 122 __ verify_method_ptr(method);
118 123
119 if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) { 124 if (!for_compiler_entry && JvmtiExport::can_post_interpreter_events()) {
120 Label run_compiled_code; 125 Label run_compiled_code;
121 // JVMTI events, such as single-stepping, are implemented partly by avoiding running 126 // JVMTI events, such as single-stepping, are implemented partly by avoiding running
136 } 141 }
137 142
138 const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() : 143 const ByteSize entry_offset = for_compiler_entry ? Method::from_compiled_offset() :
139 Method::from_interpreted_offset(); 144 Method::from_interpreted_offset();
140 __ jmp(Address(method, entry_offset)); 145 __ jmp(Address(method, entry_offset));
146
147 __ bind(L_no_such_method);
148 __ jump(RuntimeAddress(StubRoutines::throw_AbstractMethodError_entry()));
141 } 149 }
142 150
143 void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm, 151 void MethodHandles::jump_to_lambda_form(MacroAssembler* _masm,
144 Register recv, Register method_temp, 152 Register recv, Register method_temp,
145 Register temp2, 153 Register temp2,