comparison src/share/vm/interpreter/oopMapCache.cpp @ 6725:da91efe96a93

6964458: Reimplement class meta-data storage to use native memory Summary: Remove PermGen, allocate meta-data in metaspace linked to class loaders, rewrite GC walking, rewrite and rename metadata to be C++ classes Reviewed-by: jmasa, stefank, never, coleenp, kvn, brutisso, mgerdin, dholmes, jrose, twisti, roland Contributed-by: jmasa <jon.masamitsu@oracle.com>, stefank <stefan.karlsson@oracle.com>, mgerdin <mikael.gerdin@oracle.com>, never <tom.rodriguez@oracle.com>
author coleenp
date Sat, 01 Sep 2012 13:25:18 -0400
parents d2a62e0f25eb
children 78bbf4d43a14
comparison
equal deleted inserted replaced
6724:36d1d483d5d6 6725:da91efe96a93
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2012, 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.
192 _bci = 0; 192 _bci = 0;
193 _expression_stack_size = 0; 193 _expression_stack_size = 0;
194 for (int i = 0; i < N; i++) _bit_mask[i] = 0; 194 for (int i = 0; i < N; i++) _bit_mask[i] = 0;
195 } 195 }
196 196
197
198 void InterpreterOopMap::oop_iterate(OopClosure *blk) {
199 if (method() != NULL) {
200 blk->do_oop((oop*) &_method);
201 }
202 }
203
204 void InterpreterOopMap::oop_iterate(OopClosure *blk, MemRegion mr) {
205 if (method() != NULL && mr.contains(&_method)) {
206 blk->do_oop((oop*) &_method);
207 }
208 }
209
210
211
212 void InterpreterOopMap::iterate_oop(OffsetClosure* oop_closure) { 197 void InterpreterOopMap::iterate_oop(OffsetClosure* oop_closure) {
213 int n = number_of_entries(); 198 int n = number_of_entries();
214 int word_index = 0; 199 int word_index = 0;
215 uintptr_t value = 0; 200 uintptr_t value = 0;
216 uintptr_t mask = 0; 201 uintptr_t mask = 0;
224 // test for oop 209 // test for oop
225 if ((value & (mask << oop_bit_number)) != 0) oop_closure->offset_do(i); 210 if ((value & (mask << oop_bit_number)) != 0) oop_closure->offset_do(i);
226 } 211 }
227 } 212 }
228 213
229 void InterpreterOopMap::verify() {
230 // If we are doing mark sweep _method may not have a valid header
231 // $$$ This used to happen only for m/s collections; we might want to
232 // think of an appropriate generalization of this distinction.
233 guarantee(Universe::heap()->is_gc_active() || _method->is_oop_or_null(),
234 "invalid oop in oopMapCache");
235 }
236 214
237 #ifdef ENABLE_ZAP_DEAD_LOCALS 215 #ifdef ENABLE_ZAP_DEAD_LOCALS
238 216
239 void InterpreterOopMap::iterate_all(OffsetClosure* oop_closure, OffsetClosure* value_closure, OffsetClosure* dead_closure) { 217 void InterpreterOopMap::iterate_all(OffsetClosure* oop_closure, OffsetClosure* value_closure, OffsetClosure* dead_closure) {
240 int n = number_of_entries(); 218 int n = number_of_entries();
385 } else { 363 } else {
386 EXCEPTION_MARK; 364 EXCEPTION_MARK;
387 OopMapForCacheEntry gen(method, bci, this); 365 OopMapForCacheEntry gen(method, bci, this);
388 gen.compute_map(CATCH); 366 gen.compute_map(CATCH);
389 } 367 }
390 #ifdef ASSERT
391 verify();
392 #endif
393 } 368 }
394 369
395 370
396 void OopMapCacheEntry::set_mask(CellTypeState *vars, CellTypeState *stack, int stack_top) { 371 void OopMapCacheEntry::set_mask(CellTypeState *vars, CellTypeState *stack, int stack_top) {
397 // compute bit mask size 372 // compute bit mask size
462 #endif 437 #endif
463 438
464 void InterpreterOopMap::resource_copy(OopMapCacheEntry* from) { 439 void InterpreterOopMap::resource_copy(OopMapCacheEntry* from) {
465 assert(_resource_allocate_bit_mask, 440 assert(_resource_allocate_bit_mask,
466 "Should not resource allocate the _bit_mask"); 441 "Should not resource allocate the _bit_mask");
467 assert(from->method()->is_oop(), "MethodOop is bad");
468 442
469 set_method(from->method()); 443 set_method(from->method());
470 set_bci(from->bci()); 444 set_bci(from->bci());
471 set_mask_size(from->mask_size()); 445 set_mask_size(from->mask_size());
472 set_expression_stack_size(from->expression_stack_size()); 446 set_expression_stack_size(from->expression_stack_size());
542 516
543 _array[i].flush(); 517 _array[i].flush();
544 } 518 }
545 } 519 }
546 520
547 void OopMapCache::oop_iterate(OopClosure *blk) {
548 for (int i = 0; i < _size; i++) _array[i].oop_iterate(blk);
549 }
550
551 void OopMapCache::oop_iterate(OopClosure *blk, MemRegion mr) {
552 for (int i = 0; i < _size; i++) _array[i].oop_iterate(blk, mr);
553 }
554
555 void OopMapCache::verify() {
556 for (int i = 0; i < _size; i++) _array[i].verify();
557 }
558
559 void OopMapCache::lookup(methodHandle method, 521 void OopMapCache::lookup(methodHandle method,
560 int bci, 522 int bci,
561 InterpreterOopMap* entry_for) { 523 InterpreterOopMap* entry_for) {
562 MutexLocker x(&_mut); 524 MutexLocker x(&_mut);
563 525
584 546
585 // Entry is not in hashtable. 547 // Entry is not in hashtable.
586 // Compute entry and return it 548 // Compute entry and return it
587 549
588 if (method->should_not_be_cached()) { 550 if (method->should_not_be_cached()) {
589 // It is either not safe or not a good idea to cache this methodOop 551 // It is either not safe or not a good idea to cache this Method*
590 // at this time. We give the caller of lookup() a copy of the 552 // at this time. We give the caller of lookup() a copy of the
591 // interesting info via parameter entry_for, but we don't add it to 553 // interesting info via parameter entry_for, but we don't add it to
592 // the cache. See the gory details in methodOop.cpp. 554 // the cache. See the gory details in Method*.cpp.
593 compute_one_oop_map(method, bci, entry_for); 555 compute_one_oop_map(method, bci, entry_for);
594 return; 556 return;
595 } 557 }
596 558
597 // First search for an empty slot 559 // First search for an empty slot