< prev index next >

src/share/vm/classfile/symbolTable.cpp

Print this page




 650            "BOOLEAN", false, "false") {
 651   _dcmdparser.add_dcmd_option(&_verbose);
 652 }
 653 
 654 void SymboltableDCmd::execute(DCmdSource source, TRAPS) {
 655   VM_DumpHashtable dumper(output(), VM_DumpHashtable::DumpSymbols,
 656                          _verbose.value());
 657   VMThread::execute(&dumper);
 658 }
 659 
 660 int SymboltableDCmd::num_arguments() {
 661   ResourceMark rm;
 662   SymboltableDCmd* dcmd = new SymboltableDCmd(NULL, false);
 663   if (dcmd != NULL) {
 664     DCmdMark mark(dcmd);
 665     return dcmd->_dcmdparser.num_arguments();
 666   } else {
 667     return 0;
 668   }
 669 }

































 650            "BOOLEAN", false, "false") {
 651   _dcmdparser.add_dcmd_option(&_verbose);
 652 }
 653 
 654 void SymboltableDCmd::execute(DCmdSource source, TRAPS) {
 655   VM_DumpHashtable dumper(output(), VM_DumpHashtable::DumpSymbols,
 656                          _verbose.value());
 657   VMThread::execute(&dumper);
 658 }
 659 
 660 int SymboltableDCmd::num_arguments() {
 661   ResourceMark rm;
 662   SymboltableDCmd* dcmd = new SymboltableDCmd(NULL, false);
 663   if (dcmd != NULL) {
 664     DCmdMark mark(dcmd);
 665     return dcmd->_dcmdparser.num_arguments();
 666   } else {
 667     return 0;
 668   }
 669 }
 670 
 671 #ifndef PRODUCT
 672 // Internal test of TempNewSymbol
 673 void Test_TempNewSymbol() {
 674   Thread* THREAD = Thread::current();
 675   Symbol* sym = SymbolTable::new_symbol("abc", CATCH);
 676   TempNewSymbol ss = sym;
 677   assert(ss->refcount() == 1, "only one abc");
 678   assert(ss->refcount() == sym->refcount(), "should match TempNewSymbol");
 679 
 680   Symbol* sym1 = SymbolTable::new_symbol("efg", CATCH);
 681   Symbol* sym2 = SymbolTable::new_symbol("hij", CATCH);
 682   TempNewSymbol s1 = sym1;
 683   TempNewSymbol s2 = sym2;
 684   assert(s1->refcount() == 1, "one efg");
 685   assert(s2->refcount() == 1, "one hij");
 686 
 687   // Assignment operator
 688   s1 = s2;
 689   assert(sym2->refcount() == 2, "should be two hij");
 690   assert(sym1->refcount() == 0, "should be no efg");
 691 
 692   s1 = ss;  // s1 is abc
 693   assert(s1->refcount() == 2, "should be two abc (s1 and ss)");
 694   assert(sym2->refcount() == 1, "should only have one hij now (s2)");
 695 
 696   TempNewSymbol s3;
 697   s3 = SymbolTable::new_symbol("klm", CATCH);
 698   assert(s3->refcount() == 1, "only one klm now");
 699 }
 700 #endif // PRODUCT
< prev index next >