1.1 --- a/src/cpu/x86/vm/macroAssembler_x86.cpp Tue Aug 08 12:02:01 2017 +0100 1.2 +++ b/src/cpu/x86/vm/macroAssembler_x86.cpp Fri Sep 29 14:30:05 2017 -0400 1.3 @@ -1,5 +1,5 @@ 1.4 /* 1.5 - * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved. 1.6 + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. 1.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.8 * 1.9 * This code is free software; you can redistribute it and/or modify it 1.10 @@ -4853,8 +4853,13 @@ 1.11 RegisterOrConstant itable_index, 1.12 Register method_result, 1.13 Register scan_temp, 1.14 - Label& L_no_such_interface) { 1.15 - assert_different_registers(recv_klass, intf_klass, method_result, scan_temp); 1.16 + Label& L_no_such_interface, 1.17 + bool return_method) { 1.18 + assert_different_registers(recv_klass, intf_klass, scan_temp); 1.19 + assert_different_registers(method_result, intf_klass, scan_temp); 1.20 + assert(recv_klass != method_result || !return_method, 1.21 + "recv_klass can be destroyed when method isn't needed"); 1.22 + 1.23 assert(itable_index.is_constant() || itable_index.as_register() == method_result, 1.24 "caller must use same register for non-constant itable index as for method"); 1.25 1.26 @@ -4876,9 +4881,11 @@ 1.27 round_to(scan_temp, BytesPerLong); 1.28 } 1.29 1.30 - // Adjust recv_klass by scaled itable_index, so we can free itable_index. 1.31 - assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); 1.32 - lea(recv_klass, Address(recv_klass, itable_index, Address::times_ptr, itentry_off)); 1.33 + if (return_method) { 1.34 + // Adjust recv_klass by scaled itable_index, so we can free itable_index. 1.35 + assert(itableMethodEntry::size() * wordSize == wordSize, "adjust the scaling in the code below"); 1.36 + lea(recv_klass, Address(recv_klass, itable_index, Address::times_ptr, itentry_off)); 1.37 + } 1.38 1.39 // for (scan = klass->itable(); scan->interface() != NULL; scan += scan_step) { 1.40 // if (scan->interface() == intf) { 1.41 @@ -4912,9 +4919,11 @@ 1.42 1.43 bind(found_method); 1.44 1.45 - // Got a hit. 1.46 - movl(scan_temp, Address(scan_temp, itableOffsetEntry::offset_offset_in_bytes())); 1.47 - movptr(method_result, Address(recv_klass, scan_temp, Address::times_1)); 1.48 + if (return_method) { 1.49 + // Got a hit. 1.50 + movl(scan_temp, Address(scan_temp, itableOffsetEntry::offset_offset_in_bytes())); 1.51 + movptr(method_result, Address(recv_klass, scan_temp, Address::times_1)); 1.52 + } 1.53 } 1.54 1.55