1 /*
2 * Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
487 if (!((oop)_f1)->is_method()) {
488 // _f1 can also contain a klassOop for an interface
489 return false;
490 }
491 m = (methodOop)_f1;
492 }
493
494 assert(m != NULL && m->is_method(), "sanity check");
495 if (m == NULL || !m->is_method() || m->method_holder() != k) {
496 // robustness for above sanity checks or method is not in
497 // the interesting class
498 return false;
499 }
500
501 // the method is in the interesting class so the entry is interesting
502 return true;
503 }
504
505 void ConstantPoolCacheEntry::print(outputStream* st, int index) const {
506 // print separator
507 if (index == 0) tty->print_cr(" -------------");
508 // print entry
509 tty->print("%3d ("PTR_FORMAT") ", index, (intptr_t)this);
510 if (is_secondary_entry())
511 tty->print_cr("[%5d|secondary]", main_entry_index());
512 else
513 tty->print_cr("[%02x|%02x|%5d]", bytecode_2(), bytecode_1(), constant_pool_index());
514 tty->print_cr(" [ "PTR_FORMAT"]", (intptr_t)(oop)_f1);
515 tty->print_cr(" [ "PTR_FORMAT"]", (intptr_t)_f2);
516 tty->print_cr(" [ "PTR_FORMAT"]", (intptr_t)_flags);
517 tty->print_cr(" -------------");
518 }
519
520 void ConstantPoolCacheEntry::verify(outputStream* st) const {
521 // not implemented yet
522 }
523
524 // Implementation of ConstantPoolCache
525
526 void constantPoolCacheOopDesc::initialize(intArray& inverse_index_map) {
527 assert(inverse_index_map.length() == length(), "inverse index map must have same length as cache");
528 for (int i = 0; i < length(); i++) {
529 ConstantPoolCacheEntry* e = entry_at(i);
530 int original_index = inverse_index_map[i];
531 if ((original_index & Rewriter::_secondary_entry_tag) != 0) {
532 int main_index = (original_index - Rewriter::_secondary_entry_tag);
533 assert(!entry_at(main_index)->is_secondary_entry(), "valid main index");
534 e->initialize_secondary_entry(main_index);
535 } else {
536 e->initialize_entry(original_index);
537 }
|
1 /*
2 * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
487 if (!((oop)_f1)->is_method()) {
488 // _f1 can also contain a klassOop for an interface
489 return false;
490 }
491 m = (methodOop)_f1;
492 }
493
494 assert(m != NULL && m->is_method(), "sanity check");
495 if (m == NULL || !m->is_method() || m->method_holder() != k) {
496 // robustness for above sanity checks or method is not in
497 // the interesting class
498 return false;
499 }
500
501 // the method is in the interesting class so the entry is interesting
502 return true;
503 }
504
505 void ConstantPoolCacheEntry::print(outputStream* st, int index) const {
506 // print separator
507 if (index == 0) st->print_cr(" -------------");
508 // print entry
509 st->print("%3d ("PTR_FORMAT") ", index, (intptr_t)this);
510 if (is_secondary_entry())
511 st->print_cr("[%5d|secondary]", main_entry_index());
512 else
513 st->print_cr("[%02x|%02x|%5d]", bytecode_2(), bytecode_1(), constant_pool_index());
514 st->print_cr(" [ "PTR_FORMAT"]", (intptr_t)(oop)_f1);
515 st->print_cr(" [ "PTR_FORMAT"]", (intptr_t)_f2);
516 st->print_cr(" [ "PTR_FORMAT"]", (intptr_t)_flags);
517 st->print_cr(" -------------");
518 }
519
520 void ConstantPoolCacheEntry::verify(outputStream* st) const {
521 // not implemented yet
522 }
523
524 // Implementation of ConstantPoolCache
525
526 void constantPoolCacheOopDesc::initialize(intArray& inverse_index_map) {
527 assert(inverse_index_map.length() == length(), "inverse index map must have same length as cache");
528 for (int i = 0; i < length(); i++) {
529 ConstantPoolCacheEntry* e = entry_at(i);
530 int original_index = inverse_index_map[i];
531 if ((original_index & Rewriter::_secondary_entry_tag) != 0) {
532 int main_index = (original_index - Rewriter::_secondary_entry_tag);
533 assert(!entry_at(main_index)->is_secondary_entry(), "valid main index");
534 e->initialize_secondary_entry(main_index);
535 } else {
536 e->initialize_entry(original_index);
537 }
|