comparison src/share/vm/code/relocInfo.cpp @ 18041:52b4284cb496

Merge with jdk8u20-b26
author Gilles Duboscq <duboscq@ssw.jku.at>
date Wed, 15 Oct 2014 16:02:50 +0200
parents 89152779163c 78bbf4d43a14
children 89f97291c3a5
comparison
equal deleted inserted replaced
17606:45d7b2c7029d 18041:52b4284cb496
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.
29 #include "code/relocInfo.hpp" 29 #include "code/relocInfo.hpp"
30 #include "memory/resourceArea.hpp" 30 #include "memory/resourceArea.hpp"
31 #include "runtime/stubCodeGenerator.hpp" 31 #include "runtime/stubCodeGenerator.hpp"
32 #include "utilities/copy.hpp" 32 #include "utilities/copy.hpp"
33 33
34 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
34 35
35 const RelocationHolder RelocationHolder::none; // its type is relocInfo::none 36 const RelocationHolder RelocationHolder::none; // its type is relocInfo::none
36 37
37 38
38 // Implementation of relocInfo 39 // Implementation of relocInfo
580 void static_stub_Relocation::unpack_data() { 581 void static_stub_Relocation::unpack_data() {
581 address base = binding()->section_start(CodeBuffer::SECT_INSTS); 582 address base = binding()->section_start(CodeBuffer::SECT_INSTS);
582 _static_call = address_from_scaled_offset(unpack_1_int(), base); 583 _static_call = address_from_scaled_offset(unpack_1_int(), base);
583 } 584 }
584 585
586 void trampoline_stub_Relocation::pack_data_to(CodeSection* dest ) {
587 short* p = (short*) dest->locs_end();
588 CodeSection* insts = dest->outer()->insts();
589 normalize_address(_owner, insts);
590 p = pack_1_int_to(p, scaled_offset(_owner, insts->start()));
591 dest->set_locs_end((relocInfo*) p);
592 }
593
594 void trampoline_stub_Relocation::unpack_data() {
595 address base = binding()->section_start(CodeBuffer::SECT_INSTS);
596 _owner = address_from_scaled_offset(unpack_1_int(), base);
597 }
585 598
586 void external_word_Relocation::pack_data_to(CodeSection* dest) { 599 void external_word_Relocation::pack_data_to(CodeSection* dest) {
587 short* p = (short*) dest->locs_end(); 600 short* p = (short*) dest->locs_end();
588 int32_t index = runtime_address_to_index(_target); 601 int32_t index = runtime_address_to_index(_target);
589 #ifndef _LP64 602 #ifndef _LP64
809 } 822 }
810 } 823 }
811 return NULL; 824 return NULL;
812 } 825 }
813 826
827 // Finds the trampoline address for a call. If no trampoline stub is
828 // found NULL is returned which can be handled by the caller.
829 address trampoline_stub_Relocation::get_trampoline_for(address call, nmethod* code) {
830 // There are no relocations available when the code gets relocated
831 // because of CodeBuffer expansion.
832 if (code->relocation_size() == 0)
833 return NULL;
834
835 RelocIterator iter(code, call);
836 while (iter.next()) {
837 if (iter.type() == relocInfo::trampoline_stub_type) {
838 if (iter.trampoline_stub_reloc()->owner() == call) {
839 return iter.addr();
840 }
841 }
842 }
843
844 return NULL;
845 }
814 846
815 void static_stub_Relocation::clear_inline_cache() { 847 void static_stub_Relocation::clear_inline_cache() {
816 // Call stub is only used when calling the interpreted code. 848 // 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. 849 // It does not really need to be cleared, except that we want to clean out the methodoop.
818 CompiledStaticCall::set_stub_to_clean(this); 850 CompiledStaticCall::set_stub_to_clean(this);
973 { 1005 {
974 static_stub_Relocation* r = (static_stub_Relocation*) reloc(); 1006 static_stub_Relocation* r = (static_stub_Relocation*) reloc();
975 tty->print(" | [static_call=" INTPTR_FORMAT "]", r->static_call()); 1007 tty->print(" | [static_call=" INTPTR_FORMAT "]", r->static_call());
976 break; 1008 break;
977 } 1009 }
1010 case relocInfo::trampoline_stub_type:
1011 {
1012 trampoline_stub_Relocation* r = (trampoline_stub_Relocation*) reloc();
1013 tty->print(" | [trampoline owner=" INTPTR_FORMAT "]", r->owner());
1014 break;
1015 }
978 } 1016 }
979 tty->cr(); 1017 tty->cr();
980 } 1018 }
981 1019
982 1020