< prev index next >

test/hotspot/gtest/classfile/test_symbolTable.cpp

Print this page




   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  */
  23 
  24 #include "precompiled.hpp"
  25 #include "runtime/interfaceSupport.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "unittest.hpp"
  28 
  29 TEST_VM(SymbolTable, temp_new_symbol) {
  30   // Assert messages assume these symbols are unique, and the refcounts start at
  31   // one, but code does not rely on this.
  32   JavaThread* THREAD = JavaThread::current();
  33   // the thread should be in vm to use locks
  34   ThreadInVMfromNative ThreadInVMfromNative(THREAD);
  35 
  36   Symbol* abc = SymbolTable::new_symbol("abc", CATCH);
  37   int abccount = abc->refcount();
  38   TempNewSymbol ss = abc;
  39   ASSERT_EQ(ss->refcount(), abccount) << "only one abc";
  40   ASSERT_EQ(ss->refcount(), abc->refcount()) << "should match TempNewSymbol";
  41 
  42   Symbol* efg = SymbolTable::new_symbol("efg", CATCH);
  43   Symbol* hij = SymbolTable::new_symbol("hij", CATCH);
  44   int efgcount = efg->refcount();
  45   int hijcount = hij->refcount();




   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  */
  23 
  24 #include "precompiled.hpp"
  25 #include "runtime/interfaceSupport.inline.hpp"
  26 #include "classfile/symbolTable.hpp"
  27 #include "unittest.hpp"
  28 
  29 TEST_VM(SymbolTable, temp_new_symbol) {
  30   // Assert messages assume these symbols are unique, and the refcounts start at
  31   // one, but code does not rely on this.
  32   JavaThread* THREAD = JavaThread::current();
  33   // the thread should be in vm to use locks
  34   ThreadInVMfromNative ThreadInVMfromNative(THREAD);
  35 
  36   Symbol* abc = SymbolTable::new_symbol("abc", CATCH);
  37   int abccount = abc->refcount();
  38   TempNewSymbol ss = abc;
  39   ASSERT_EQ(ss->refcount(), abccount) << "only one abc";
  40   ASSERT_EQ(ss->refcount(), abc->refcount()) << "should match TempNewSymbol";
  41 
  42   Symbol* efg = SymbolTable::new_symbol("efg", CATCH);
  43   Symbol* hij = SymbolTable::new_symbol("hij", CATCH);
  44   int efgcount = efg->refcount();
  45   int hijcount = hij->refcount();


< prev index next >