示例#1
0
omr_error_t
OMR_GC_SystemCollect(OMR_VMThread* omrVMThread, uint32_t gcCode)
{
	MM_EnvironmentBase *env = MM_EnvironmentBase::getEnvironment(omrVMThread);
	MM_GCExtensionsBase *extensions = MM_GCExtensionsBase::getExtensions(omrVMThread->_vm);
	/* Lazily create the collector, if necessary. */
	if (NULL == extensions->getGlobalCollector()) {
		if (OMR_ERROR_NONE != OMR_GC_InitializeCollector(omrVMThread)) {
			return OMR_ERROR_INTERNAL;
		}
	}
	extensions->heap->systemGarbageCollect(env, gcCode);
	return OMR_ERROR_NONE;
}
示例#2
0
omr_error_t
OMR_GC_SystemCollect(OMR_VMThread* omrVMThread, uint32_t gcCode)
{
	omr_error_t result = OMR_ERROR_NONE;
	MM_EnvironmentBase *env = MM_EnvironmentBase::getEnvironment(omrVMThread);
	MM_GCExtensionsBase *extensions = env->getExtensions();
	if (NULL == extensions->getGlobalCollector()) {
		result = OMR_GC_InitializeCollector(omrVMThread);
	}
	if (OMR_ERROR_NONE == result) {
		extensions->heap->systemGarbageCollect(env, gcCode);
	}
	return result;
}
示例#3
0
omrobjectptr_t
OMR_GC_Allocate(OMR_VMThread * omrVMThread, size_t sizeInBytes, uintptr_t flags)
{
	omrobjectptr_t heapBytes = allocHelper(omrVMThread, sizeInBytes, flags, true);
	if (NULL == heapBytes) {
		MM_GCExtensionsBase *extensions = MM_GCExtensionsBase::getExtensions(omrVMThread->_vm);
		if (NULL == extensions->getGlobalCollector()) {
			/* Lazily create the collector and try to allocate again. */
			if (OMR_ERROR_NONE == OMR_GC_InitializeCollector(omrVMThread)) {
				heapBytes = allocHelper(omrVMThread, sizeInBytes, flags, true);
			}
		}
	}
	return heapBytes;
}