< prev index next >

test/hotspot/gtest/code/test_dependencyContext.cpp


*** 27,38 **** #include "code/nmethod.hpp" #include "unittest.hpp" class TestDependencyContext { public: ! char* _buffer[sizeof(nmethod) * 3]; ! nmethod* _nmethods[3]; nmethodBucket* volatile _dependency_context; volatile uint64_t _last_cleanup; DependencyContext dependencies() { --- 27,37 ---- #include "code/nmethod.hpp" #include "unittest.hpp" class TestDependencyContext { public: ! nmethod _nmethods[3]; nmethodBucket* volatile _dependency_context; volatile uint64_t _last_cleanup; DependencyContext dependencies() { ***************
*** 43,64 **** TestDependencyContext() : _dependency_context(NULL), _last_cleanup(0) { CodeCache_lock->lock_without_safepoint_check(); ! memset(_buffer, 0, sizeof(nmethod) * 3); ! _nmethods[0] = reinterpret_cast<nmethod*>(_buffer) + 0; ! _nmethods[1] = reinterpret_cast<nmethod*>(_buffer) + 1; ! _nmethods[2] = reinterpret_cast<nmethod*>(_buffer) + 2; ! ! _nmethods[0]->clear_unloading_state(); ! _nmethods[1]->clear_unloading_state(); ! _nmethods[2]->clear_unloading_state(); ! ! dependencies().add_dependent_nmethod(_nmethods[2]); ! dependencies().add_dependent_nmethod(_nmethods[1]); ! dependencies().add_dependent_nmethod(_nmethods[0]); } ~TestDependencyContext() { wipe(); CodeCache_lock->unlock(); --- 42,58 ---- TestDependencyContext() : _dependency_context(NULL), _last_cleanup(0) { CodeCache_lock->lock_without_safepoint_check(); ! _nmethods[0].clear_unloading_state(); ! _nmethods[1].clear_unloading_state(); ! _nmethods[2].clear_unloading_state(); ! ! dependencies().add_dependent_nmethod(&_nmethods[2]); ! dependencies().add_dependent_nmethod(&_nmethods[1]); ! dependencies().add_dependent_nmethod(&_nmethods[0]); } ~TestDependencyContext() { wipe(); CodeCache_lock->unlock(); ***************
*** 78,88 **** static void test_remove_dependent_nmethod(int id) { TestDependencyContext c; DependencyContext depContext = c.dependencies(); ! nmethod* nm = c._nmethods[id]; depContext.remove_dependent_nmethod(nm); NOT_PRODUCT(ASSERT_FALSE(depContext.is_dependent_nmethod(nm))); } --- 72,82 ---- static void test_remove_dependent_nmethod(int id) { TestDependencyContext c; DependencyContext depContext = c.dependencies(); ! nmethod* nm = &c._nmethods[id]; depContext.remove_dependent_nmethod(nm); NOT_PRODUCT(ASSERT_FALSE(depContext.is_dependent_nmethod(nm))); }
< prev index next >