src/share/vm/oops/klassVtable.cpp

changeset 2534
e5383553fd4e
parent 2497
3582bf76420e
child 2616
dbad0519a1c4
equal deleted inserted replaced
2533:c5a923563727 2534:e5383553fd4e
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, 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.
675 const int n = length(); 675 const int n = length();
676 for (int i = 0; i < n; i++) { 676 for (int i = 0; i < n; i++) {
677 PSParallelCompact::adjust_pointer(adr_method_at(i)); 677 PSParallelCompact::adjust_pointer(adr_method_at(i));
678 } 678 }
679 } 679 }
680
681 void klassVtable::oop_update_pointers(ParCompactionManager* cm,
682 HeapWord* beg_addr, HeapWord* end_addr) {
683 const int n = length();
684 const int entry_size = vtableEntry::size();
685
686 int beg_idx = 0;
687 HeapWord* const method_0 = (HeapWord*)adr_method_at(0);
688 if (beg_addr > method_0) {
689 // it's safe to use cast, as we have guarantees on vtable size to be sane
690 beg_idx = int((pointer_delta(beg_addr, method_0) + entry_size - 1) / entry_size);
691 }
692
693 oop* const beg_oop = adr_method_at(beg_idx);
694 oop* const end_oop = MIN2((oop*)end_addr, adr_method_at(n));
695 for (oop* cur_oop = beg_oop; cur_oop < end_oop; cur_oop += entry_size) {
696 PSParallelCompact::adjust_pointer(cur_oop);
697 }
698 }
699 #endif // SERIALGC 680 #endif // SERIALGC
700 681
701 // Iterators 682 // Iterators
702 void klassVtable::oop_oop_iterate(OopClosure* blk) { 683 void klassVtable::oop_oop_iterate(OopClosure* blk) {
703 int len = length(); 684 int len = length();
815 796
816 // method table 797 // method table
817 itableMethodEntry* ime = method_entry(0); 798 itableMethodEntry* ime = method_entry(0);
818 for(int j = 0; j < _size_method_table; j++) { 799 for(int j = 0; j < _size_method_table; j++) {
819 PSParallelCompact::adjust_pointer((oop*)&ime->_method); 800 PSParallelCompact::adjust_pointer((oop*)&ime->_method);
820 ime++;
821 }
822 }
823
824 void klassItable::oop_update_pointers(ParCompactionManager* cm,
825 HeapWord* beg_addr, HeapWord* end_addr) {
826 // offset table
827 itableOffsetEntry* ioe = offset_entry(0);
828 for(int i = 0; i < _size_offset_table; i++) {
829 oop* p = (oop*)&ioe->_interface;
830 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
831 ioe++;
832 }
833
834 // method table
835 itableMethodEntry* ime = method_entry(0);
836 for(int j = 0; j < _size_method_table; j++) {
837 oop* p = (oop*)&ime->_method;
838 PSParallelCompact::adjust_pointer(p, beg_addr, end_addr);
839 ime++; 801 ime++;
840 } 802 }
841 } 803 }
842 #endif // SERIALGC 804 #endif // SERIALGC
843 805

mercurial