Пример #1
0
void
MM_SweepSchemeSegregated::sweep(MM_EnvironmentBase *env, MM_MemoryPoolSegregated *memoryPool, bool isFixHeapForWalk)
{
	_memoryPool = memoryPool;
	_isFixHeapForWalk = isFixHeapForWalk;

	if (env->_currentTask->synchronizeGCThreadsAndReleaseMaster(env, UNIQUE_ID)) {
		preSweep(env);
		env->_currentTask->releaseSynchronizedGCThreads(env);
	}
	
#if defined(OMR_GC_ARRAYLETS)
	incrementalSweepArraylet(env);
	env->_currentTask->synchronizeGCThreads(env, UNIQUE_ID);
#endif /* OMR_GC_ARRAYLETS */
	incrementalSweepLarge(env);
	
	MM_RegionPoolSegregated *regionPool = _memoryPool->getRegionPool();
	if (env->_currentTask->synchronizeGCThreadsAndReleaseMaster(env, UNIQUE_ID)) {
		regionPool->setSweepSmallPages(true);
		regionPool->resetSkipAvailableRegionForAllocation();
		env->_currentTask->releaseSynchronizedGCThreads(env);
	}

	incrementalSweepSmall(env);
	regionPool->joinBucketListsForSplitIndex(env);

	if (env->_currentTask->synchronizeGCThreadsAndReleaseMaster(env, UNIQUE_ID)) {
		regionPool->setSweepSmallPages(false);
		postSweep(env);
		env->_currentTask->releaseSynchronizedGCThreads(env);
	}
}
Пример #2
0
/*!\brief Recursive function that runs one move of the tour.
 *
 * \param row
 * 	The row to check this once.
 *
 * \param column
 * 	The column to check this once.
 */
bool GameBoard::myPlaceKnight(const unsigned row, const unsigned column)
{
#ifdef MARCUS_DEBUG
	std::cerr << "Entered myPlaceKnight function." << std::endl;
#endif
	/* If preSweep is true, we have recieved an abort message, so get out.
	 */
	if (preSweep(row, column))
	{
		return(false);
	}
	
	// Early out if the board is, in fact, complete.
	if ((board_.getRows() * board_.getColumns()) == move_)
	{
		bindMessage(MSG_FINISHED_OK, row, column);
		return(true);
	}

	// If we're doing a static policy...
	if (policy_ == tpSTATIC)
	{
		if (staticSweepNeighbors(row, column))
		{
			// Hoho, we found something good.
			return(true);
		}
	}
	else // Well, only two options, so we're heuristic!
	{
		if (heuristicSweepNeighbors(row, column))
		{
			return(true);
		}
	}

	// Clean up for this particular iteration.
	postSweep(row, column);

	// If we made it this far, we can't have found anything interesting.
	return(false);
}