comparison src/share/vm/code/relocInfo.cpp @ 14518:d8041d695d19

Merged with jdk9/dev/hotspot changeset 3812c088b945
author twisti
date Tue, 11 Mar 2014 18:45:59 -0700
parents d49f00604347 abec000618bf
children 4ca6dc0799b6
comparison
equal deleted inserted replaced
14141:f97c5ec83832 14518:d8041d695d19
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.
580 void static_stub_Relocation::unpack_data() { 580 void static_stub_Relocation::unpack_data() {
581 address base = binding()->section_start(CodeBuffer::SECT_INSTS); 581 address base = binding()->section_start(CodeBuffer::SECT_INSTS);
582 _static_call = address_from_scaled_offset(unpack_1_int(), base); 582 _static_call = address_from_scaled_offset(unpack_1_int(), base);
583 } 583 }
584 584
585 void trampoline_stub_Relocation::pack_data_to(CodeSection* dest ) {
586 short* p = (short*) dest->locs_end();
587 CodeSection* insts = dest->outer()->insts();
588 normalize_address(_owner, insts);
589 p = pack_1_int_to(p, scaled_offset(_owner, insts->start()));
590 dest->set_locs_end((relocInfo*) p);
591 }
592
593 void trampoline_stub_Relocation::unpack_data() {
594 address base = binding()->section_start(CodeBuffer::SECT_INSTS);
595 _owner = address_from_scaled_offset(unpack_1_int(), base);
596 }
585 597
586 void external_word_Relocation::pack_data_to(CodeSection* dest) { 598 void external_word_Relocation::pack_data_to(CodeSection* dest) {
587 short* p = (short*) dest->locs_end(); 599 short* p = (short*) dest->locs_end();
588 int32_t index = runtime_address_to_index(_target); 600 int32_t index = runtime_address_to_index(_target);
589 #ifndef _LP64 601 #ifndef _LP64
809 } 821 }
810 } 822 }
811 return NULL; 823 return NULL;
812 } 824 }
813 825
826 // Finds the trampoline address for a call. If no trampoline stub is
827 // found NULL is returned which can be handled by the caller.
828 address trampoline_stub_Relocation::get_trampoline_for(address call, nmethod* code) {
829 // There are no relocations available when the code gets relocated
830 // because of CodeBuffer expansion.
831 if (code->relocation_size() == 0)
832 return NULL;
833
834 RelocIterator iter(code, call);
835 while (iter.next()) {
836 if (iter.type() == relocInfo::trampoline_stub_type) {
837 if (iter.trampoline_stub_reloc()->owner() == call) {
838 return iter.addr();
839 }
840 }
841 }
842
843 return NULL;
844 }
814 845
815 void static_stub_Relocation::clear_inline_cache() { 846 void static_stub_Relocation::clear_inline_cache() {
816 // Call stub is only used when calling the interpreted code. 847 // Call stub is only used when calling the interpreted code.
817 // It does not really need to be cleared, except that we want to clean out the methodoop. 848 // It does not really need to be cleared, except that we want to clean out the methodoop.
818 CompiledStaticCall::set_stub_to_clean(this); 849 CompiledStaticCall::set_stub_to_clean(this);
973 { 1004 {
974 static_stub_Relocation* r = (static_stub_Relocation*) reloc(); 1005 static_stub_Relocation* r = (static_stub_Relocation*) reloc();
975 tty->print(" | [static_call=" INTPTR_FORMAT "]", r->static_call()); 1006 tty->print(" | [static_call=" INTPTR_FORMAT "]", r->static_call());
976 break; 1007 break;
977 } 1008 }
1009 case relocInfo::trampoline_stub_type:
1010 {
1011 trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
1012 tty->print(" | [trampoline owner=" INTPTR_FORMAT "]", r->owner());
1013 break;
1014 }
978 } 1015 }
979 tty->cr(); 1016 tty->cr();
980 } 1017 }
981 1018
982 1019