当前位置: 首页>>代码示例>>C++>>正文


C++ OMRPORT_ACCESS_FROM_OMRPORT函数代码示例

本文整理汇总了C++中OMRPORT_ACCESS_FROM_OMRPORT函数的典型用法代码示例。如果您正苦于以下问题:C++ OMRPORT_ACCESS_FROM_OMRPORT函数的具体用法?C++ OMRPORT_ACCESS_FROM_OMRPORT怎么用?C++ OMRPORT_ACCESS_FROM_OMRPORT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了OMRPORT_ACCESS_FROM_OMRPORT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: removeDump

static void
removeDump(OMRPortLibrary *portLib, const char *filename, const char *testName)
{
	OMRPORT_ACCESS_FROM_OMRPORT(portLib);
	bool removeDumpSucceeded = true;
	portTestEnv->changeIndent(1);

	/* Delete the file if possible. */
#if defined(J9ZOS390)
	char deleteCore[EsMaxPath] = {0};
	sprintf(deleteCore, "tso delete %s", (strstr(filename, ".") + 1));

	char *ending = strstr(deleteCore, ".X&DS");
	if (NULL != ending) {
		strncpy(ending, ".X001", 5);
	}
	if (-1 == system(deleteCore)) {
		removeDumpSucceeded = false;
	}
#else /* defined(J9ZOS390) */
	if (0 != remove(filename)) {
		removeDumpSucceeded = false;
	}
#endif /* defined(J9ZOS390) */
	if (removeDumpSucceeded) {
		portTestEnv->log("removed: %s\n", filename);
	} else {
		outputErrorMessage(PORTTEST_ERROR_ARGS, "\tfailed to remove %s\n", filename);
	}
	portTestEnv->changeIndent(-1);
}
开发者ID:LinHu2016,项目名称:omr,代码行数:31,代码来源:omrdumpTest.cpp

示例2: simpleHandlerFunction

static uintptr_t
simpleHandlerFunction(struct OMRPortLibrary *portLibrary, uint32_t gpType, void *gpInfo, void *handler_arg)
{
	OMRPORT_ACCESS_FROM_OMRPORT(portLibrary);
	simpleHandlerInfo *info = (simpleHandlerInfo *)handler_arg;
	const char *testName = info->testName;
	uintptr_t rc;

	portTestEnv->log("calling omrdump_create with filename: %s\n", info->coreFileName);

#if defined(J9ZOS390)
	rc = omrdump_create(info->coreFileName, "IEATDUMP", NULL);
#else
	rc = omrdump_create(info->coreFileName, NULL, NULL);
#endif

	if (rc == 0) {
		uintptr_t verifyFileRC = 99;

		portTestEnv->log("omrdump_create claims to have written a core file to: %s\n", info->coreFileName);
		verifyFileRC = verifyFileExists(PORTTEST_ERROR_ARGS, info->coreFileName);
		if (verifyFileRC == 0) {
			removeDump(OMRPORTLIB, info->coreFileName, testName);
		}
	} else {
		outputErrorMessage(PORTTEST_ERROR_ARGS, "omrdump_create returned: %u, with filename: %s", rc, info->coreFileName);
	}

	return OMRPORT_SIG_EXCEPTION_RETURN;
}
开发者ID:LinHu2016,项目名称:omr,代码行数:30,代码来源:omrdumpTest.cpp

示例3: OMRPORT_ACCESS_FROM_OMRPORT

/**
 * Probe the file system for existing files. Determine
 * the first number which is unused, or the number of the oldest
 * file if all numbers are used.
 * @return the first file number to use (starting at 0), or -1 on failure
 */
intptr_t 
MM_VerboseWriterFileLogging::findInitialFile(MM_EnvironmentBase *env)
{
	OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary());
	MM_GCExtensionsBase *extensions = MM_GCExtensionsBase::getExtensions(env->getOmrVM());
	int64_t oldestTime = J9CONST64(0x7FFFFFFFFFFFFFFF); /* the highest possible time. */
	intptr_t oldestFile = 0;

	if (_mode != rotating_files) {
		/* nothing to do */
		return 0;
	}

	for (uintptr_t currentFile = 0; currentFile < _numFiles; currentFile++) {
		char *filenameToOpen = expandFilename(env, currentFile);
		if (NULL == filenameToOpen) {
			return -1;
		}

		int64_t thisTime = omrfile_lastmod(filenameToOpen);
		extensions->getForge()->free(filenameToOpen);
		
		if (thisTime < 0) {
			/* file doesn't exist, or some other problem reading the file */
			oldestFile = currentFile;
			break;
		} else if (thisTime < oldestTime) {
			oldestTime = thisTime;
			oldestFile = currentFile;
		}
	}
	
	return oldestFile; 
}
开发者ID:LinHu2016,项目名称:omr,代码行数:40,代码来源:VerboseWriterFileLogging.cpp

示例4: TEST

/**
 * Call omrdump_create() without passing in core file name. This does not actually test that a core file was actually created.
 */
TEST(PortDumpTest, dump_test_create_dump_with_NO_name)
{
	OMRPORT_ACCESS_FROM_OMRPORT(portTestEnv->getPortLibrary());
	const char *testName = "omrdump_test_create_dump_with_NO_name";
	uintptr_t rc = 99;
	char coreFileName[EsMaxPath];
	BOOLEAN doFileVerification = FALSE;
#if defined(AIXPPC)
	struct vario myvar;
	int sys_parmRC;
#endif

	reportTestEntry(OMRPORTLIB, testName);

	coreFileName[0] = '\0';

#if 0
	/* try out a NULL test (turns out this crashes) */
	rc = omrdump_create(NULL, NULL, NULL); /* this crashes */
#endif

	/* try out a more sane NULL test */
	portTestEnv->log("calling omrdump_create with empty filename\n");

#if defined(J9ZOS390)
	rc = omrdump_create(coreFileName, "IEATDUMP", NULL);
#else
	rc = omrdump_create(coreFileName, NULL, NULL);
#endif

	if (rc == 0) {
		uintptr_t verifyFileRC = 99;

		portTestEnv->log("omrdump_create claims to have written a core file to: %s\n", coreFileName);


#if defined(AIXPPC)
		/* We defer to fork abort on AIX machines that don't have "Enable full CORE dump" enabled in smit,
		 * in which case omrdump_create will not return the filename.
		 * So, only check for a specific filename if we are getting full core dumps */
		sys_parmRC = sys_parm(SYSP_GET, SYSP_V_FULLCORE, &myvar);

		if ((sys_parmRC == 0) && (myvar.v.v_fullcore.value == 1)) {

			doFileVerification = TRUE;
		}
#else /* defined(AIXPPC) */
		doFileVerification = TRUE;
#endif /* defined(AIXPPC) */
		if (doFileVerification) {
			verifyFileRC = verifyFileExists(PORTTEST_ERROR_ARGS, coreFileName);
			if (verifyFileRC == 0) {
				removeDump(OMRPORTLIB, coreFileName, testName);
			}
		}
	} else {
		outputErrorMessage(PORTTEST_ERROR_ARGS, "omrdump_create returned: %u, with filename: %s", rc, coreFileName);
	}
	reportTestExit(OMRPORTLIB, testName);
}
开发者ID:LinHu2016,项目名称:omr,代码行数:63,代码来源:omrdumpTest.cpp

示例5: deleteControlDirectory

/**
 * Removes a directory by recursively removing sub-directory and files.
 *
 * @param[in] portLibrary The port library
 * @param[in] directory to clean up
 *
 * @return void
 */
void
deleteControlDirectory(struct OMRPortLibrary *portLibrary, char *baseDir)
{
	OMRPORT_ACCESS_FROM_OMRPORT(portLibrary);
	struct J9FileStat buf;

	omrfile_stat(baseDir, (uint32_t)0, &buf);

	if (buf.isDir != 1) {
		omrfile_unlink(baseDir);
	} else {
		char mybaseFilePath[EsMaxPath];
		char resultBuffer[EsMaxPath];
		uintptr_t rc, handle;

		omrstr_printf(mybaseFilePath, EsMaxPath, "%s", baseDir);
		rc = handle = omrfile_findfirst(mybaseFilePath, resultBuffer);
		while ((uintptr_t)-1 != rc) {
			char nextEntry[EsMaxPath];
			/* skip current and parent dir */
			if (resultBuffer[0] == '.') {
				rc = omrfile_findnext(handle, resultBuffer);
				continue;
			}
			omrstr_printf(nextEntry, EsMaxPath, "%s/%s", mybaseFilePath, resultBuffer);
			deleteControlDirectory(OMRPORTLIB, nextEntry);
			rc = omrfile_findnext(handle, resultBuffer);
		}
		if (handle != (uintptr_t)-1) {
			omrfile_findclose(handle);
		}
		omrfile_unlinkdir(mybaseFilePath);
	}
}
开发者ID:dinogun,项目名称:omr,代码行数:42,代码来源:testHelpers.cpp

示例6: OMRPORT_ACCESS_FROM_OMRPORT

bool
MM_VerboseWriter::initialize(MM_EnvironmentBase* env)
{
	OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary());
	MM_GCExtensionsBase* ext = env->getExtensions();

	/* Initialize _header */
	const char* version = omrgc_get_version(env->getOmrVM());
	/* The length is -2 for the "%s" in VERBOSEGC_HEADER and +1 for '\0' */
	uintptr_t headerLength = strlen(version) + strlen(VERBOSEGC_HEADER) - 1;
	_header = (char*)ext->getForge()->allocate(sizeof(char) * headerLength, OMR::GC::AllocationCategory::DIAGNOSTIC, OMR_GET_CALLSITE());
	if (NULL == _header) {
		return false;
	}
	omrstr_printf(_header, headerLength, VERBOSEGC_HEADER, version);

	/* Initialize _footer */
	uintptr_t footerLength = strlen(VERBOSEGC_FOOTER) + 1;
	_footer = (char*)ext->getForge()->allocate(sizeof(char) * footerLength, OMR::GC::AllocationCategory::DIAGNOSTIC, OMR_GET_CALLSITE());
	if (NULL == _footer) {
		ext->getForge()->free(_header);
		return false;
	}
	omrstr_printf(_footer, footerLength, VERBOSEGC_FOOTER);
	
	return true;
}
开发者ID:LinHu2016,项目名称:omr,代码行数:27,代码来源:VerboseWriter.cpp

示例7: convertFromUTF8

wchar_t *
convertFromUTF8(OMRPortLibrary *portLibrary, const char *string, wchar_t *unicodeBuffer, uintptr_t unicodeBufferSize)
{
	wchar_t *unicodeString;
	uintptr_t length;
	OMRPORT_ACCESS_FROM_OMRPORT(portLibrary);

	if (NULL == string) {
		return NULL;
	}
	length = (uintptr_t)strlen(string);
	if (length < unicodeBufferSize) {
		unicodeString = unicodeBuffer;
	} else {
		unicodeString = (wchar_t *)omrmem_allocate_memory((length + 1) * 2, OMRMEM_CATEGORY_PORT_LIBRARY);
		if (NULL == unicodeString) {
			return NULL;
		}
	}
	if (0 == MultiByteToWideChar(OS_ENCODING_CODE_PAGE, OS_ENCODING_MB_FLAGS, string, -1, unicodeString, (int)length + 1)) {
		omrerror_set_last_error(GetLastError(), OMRPORT_ERROR_OPFAILED);
		if (unicodeString != unicodeBuffer) {
			omrmem_free_memory(unicodeString);
		}
		return NULL;
	}

	return unicodeString;
}
开发者ID:bjornvar,项目名称:omr,代码行数:29,代码来源:testProcessHelpers.cpp

示例8: TEST

TEST(TraceLifecycleTest, deregisterSubscriberAfterShutdown)
{
	/* OMR VM data structures */
	OMRTestVM testVM;
	OMR_VMThread *vmthread = NULL;
	UtSubscription *subscriptionID = NULL;
	const OMR_TI *ti = omr_agent_getTI();

	OMRPORT_ACCESS_FROM_OMRPORT(rasTestEnv->getPortLibrary());
	char *datDir = getTraceDatDir(rasTestEnv->_argc, (const char **)rasTestEnv->_argv);

	OMRTEST_ASSERT_ERROR_NONE(omrTestVMInit(&testVM, OMRPORTLIB));
	/* use small buffers to exercise buffer wrapping */
	OMRTEST_ASSERT_ERROR_NONE(omr_ras_initTraceEngine(&testVM.omrVM, "buffers=1k:maximal=all:print=omr_test", datDir));

	/* Attach the thread to the trace engine */
	OMRTEST_ASSERT_ERROR_NONE(OMR_Thread_Init(&testVM.omrVM, NULL, &vmthread, "registerSubscriberAfterShutdown"));

	/* Register the subscriber */
	OMRTEST_ASSERT_ERROR_NONE(
		ti->RegisterRecordSubscriber(vmthread, "registerSubscriberAfterShutdown", subscribeFunc, NULL, NULL, &subscriptionID));

	/* Shut down the trace engine */
	OMRTEST_ASSERT_ERROR_NONE(omr_ras_cleanupTraceEngine(vmthread));

	/* Attempt to deregister using external agent API. This succeeds because this thread is still attached to the trace engine. */
	OMRTEST_ASSERT_ERROR_NONE(ti->DeregisterRecordSubscriber(vmthread, subscriptionID));

	/* Now clear up the VM we started for this test case. */
	OMRTEST_ASSERT_ERROR_NONE(OMR_Thread_Free(vmthread));
	OMRTEST_ASSERT_ERROR_NONE(omrTestVMFini(&testVM));

	ASSERT_TRUE(NULL == (void *)omr_test_UtModuleInfo.intf);
}
开发者ID:ChengJin01,项目名称:omr,代码行数:34,代码来源:traceLifecycleTest.cpp

示例9: testDispatch

static void
testDispatch(OMRPortLibrary *portLib, uintptr_t *passCount, uintptr_t *failCount, uintptr_t event, uintptr_t expectedResult)
{
	OMRPORT_ACCESS_FROM_OMRPORT(portLib);
	uintptr_t count = 0;

	switch (event) {
	case TESTHOOK_EVENT1:
		TRIGGER_TESTHOOK_EVENT1(sampleHookInterface, count, -1);
		break;
	case TESTHOOK_EVENT2:
		TRIGGER_TESTHOOK_EVENT2(sampleHookInterface, 1, count, -1);
		break;
	case TESTHOOK_EVENT3:
		TRIGGER_TESTHOOK_EVENT3(sampleHookInterface, 2, 3, count, -1);
		break;
	case TESTHOOK_EVENT4:
		TRIGGER_TESTHOOK_EVENT4(sampleHookInterface, 4, 5, 6, count, -1);
		break;
	}

	if (count == expectedResult) {
		(*passCount)++;
	} else {
		omrtty_printf("Incorrect number of listeners responded for 0x%zx. Got %d, expected %d\n", event, count, expectedResult);
		(*failCount)++;
	}
}
开发者ID:bjornvar,项目名称:omr,代码行数:28,代码来源:hooktest.c

示例10: OMRPORT_ACCESS_FROM_OMRPORT

bool
MM_MemoryManager::isLargePage(MM_EnvironmentBase* env, uintptr_t pageSize)
{
	OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary());
	uintptr_t* pageSizes = omrvmem_supported_page_sizes();
	return pageSize > pageSizes[0];
}
开发者ID:lmaisons,项目名称:omr,代码行数:7,代码来源:MemoryManager.cpp

示例11: Assert_MM_true

bool
MM_ConcurrentGCIncrementalUpdate::createCardTable(MM_EnvironmentBase *env)
{
	bool result = false;

	Assert_MM_true(NULL == _cardTable);
	Assert_MM_true(NULL == _extensions->cardTable);

#if defined(AIXPPC) || defined(LINUXPPC)
	OMRPORT_ACCESS_FROM_OMRPORT(env->getPortLibrary());

	if ((uintptr_t)omrsysinfo_get_number_CPUs_by_type(OMRPORT_CPU_ONLINE) > 1 ) {
		_cardTable = MM_ConcurrentCardTableForWC::newInstance(env, _extensions->getHeap(), _markingScheme, this);
	} else
#endif /* AIXPPC || LINUXPPC */
	{
		_cardTable = MM_ConcurrentCardTable::newInstance(env, _extensions->getHeap(), _markingScheme, this);
	}

	if(NULL != _cardTable) {
		result = true;
		/* Set card table address in GC Extensions */
		_extensions->cardTable = _cardTable;
	}

	return result;
}
开发者ID:LinHu2016,项目名称:omr,代码行数:27,代码来源:ConcurrentGCIncrementalUpdate.cpp

示例12: moduleUnloadAfterThreadDetachHelper

static int J9THREAD_PROC
moduleUnloadAfterThreadDetachHelper(void *entryArg)
{
	omr_error_t rc = OMR_ERROR_NONE;
	ChildThreadData *childData = (ChildThreadData *)entryArg;
	OMRTestVM *testVM = childData->testVM;
	OMR_VMThread *vmthread = NULL;
	OMRPORT_ACCESS_FROM_OMRPORT(testVM->portLibrary);

	rc = OMRTEST_PRINT_ERROR(OMR_Thread_Init(&testVM->omrVM, NULL, &vmthread, "moduleUnloadAfterThreadDetachHelper"));
	if (OMR_ERROR_NONE != rc) {
		childData->childRc = rc;
		return -1;
	}

	UT_OMR_TEST_MODULE_LOADED(testVM->omrVM._trcEngine->utIntf);
	Trc_OMR_Test_String(vmthread, "This tracepoint should appear.");

	rc = OMRTEST_PRINT_ERROR(OMR_Thread_Free(vmthread));
	if (OMR_ERROR_NONE != rc) {
		childData->childRc = rc;
		return -1;
	}

	/* This should fail silently without crashing */
	UT_OMR_TEST_MODULE_UNLOADED(testVM->omrVM._trcEngine->utIntf);

	return 0;
}
开发者ID:ChengJin01,项目名称:omr,代码行数:29,代码来源:traceLifecycleTest.cpp

示例13: OMRPORT_ACCESS_FROM_OMRPORT

void
MM_EnvironmentBase::reportExclusiveAccessAcquire()
{
	OMRPORT_ACCESS_FROM_OMRPORT(_portLibrary);

	/* record statistics */
	U_64 meanResponseTime = _omrVM->exclusiveVMAccessStats.totalResponseTime / (_omrVM->exclusiveVMAccessStats.haltedThreads + 1); /* +1 for the requester */
	_exclusiveAccessTime = _omrVM->exclusiveVMAccessStats.endTime - _omrVM->exclusiveVMAccessStats.startTime;
	_meanExclusiveAccessIdleTime = _exclusiveAccessTime - meanResponseTime;
	_lastExclusiveAccessResponder = _omrVM->exclusiveVMAccessStats.lastResponder;
	_exclusiveAccessHaltedThreads = _omrVM->exclusiveVMAccessStats.haltedThreads;

	/* report hook */
	/* first the deprecated trigger */
	TRIGGER_J9HOOK_MM_PRIVATE_EXCLUSIVE_ACCESS(this->getExtensions()->privateHookInterface, _omrVMThread);
	/* now the new trigger */
	TRIGGER_J9HOOK_MM_PRIVATE_EXCLUSIVE_ACCESS_ACQUIRE(
			this->getExtensions()->privateHookInterface,
			_omrVMThread,
			omrtime_hires_clock(),
			J9HOOK_MM_PRIVATE_EXCLUSIVE_ACCESS_ACQUIRE,
			_exclusiveAccessTime,
			_meanExclusiveAccessIdleTime,
			_lastExclusiveAccessResponder,
			_exclusiveAccessHaltedThreads);
}
开发者ID:ChengJin01,项目名称:omr,代码行数:26,代码来源:EnvironmentBase.cpp

示例14: OMRPORT_ACCESS_FROM_OMRPORT

ObjectEntry *
GCConfigTest::createObject(const char *namePrefix, OMRGCObjectType objType, int32_t depth, int32_t nthInRow, uintptr_t size)
{
	OMRPORT_ACCESS_FROM_OMRPORT(gcTestEnv->portLib);
	ObjectEntry *objEntry = NULL;

	char *objName = (char *)omrmem_allocate_memory(MAX_NAME_LENGTH, OMRMEM_CATEGORY_MM);
	if (NULL == objName) {
		omrtty_printf("%s:%d Failed to allocate native memory.\n", __FILE__, __LINE__);
		goto done;
	}
	omrstr_printf(objName, MAX_NAME_LENGTH, "%s_%d_%d", namePrefix, depth, nthInRow);

	objEntry = find(objName);
	if (NULL != objEntry) {
#if defined(OMRGCTEST_DEBUG)
		omrtty_printf("Found object %s in object table.\n", objEntry->name);
#endif
		omrmem_free_memory(objName);
	} else {
		objEntry = allocateHelper(objName, size);
		if (NULL != objEntry) {
			/* Keep count of the new allocated non-garbage object size for garbage insertion. If the object exists in objectTable, its size is ignored. */
			if ((ROOT == objType) || (NORMAL == objType)) {
				gp.accumulatedSize += env->getExtensions()->objectModel.getSizeInBytesWithHeader(objEntry->objPtr);
			}
		} else {
			omrmem_free_memory(objName);
		}
	}

done:
	return objEntry;
}
开发者ID:is00hcw,项目名称:omr,代码行数:34,代码来源:GCConfigTest.cpp

示例15: waitForEvent

/**
 * Wait for expected event and optionally bring event related data back.
 *
 * @param testName The name of the waiting thread
 * @param info The pointer to SigMaskTestInfo object
 * @param event The expected event
 * @param result The event related data
 * @param size The size of the event data
 * @return TRUE upon success; FALSE if expected event did not occur before timeout.
 */
static BOOLEAN
waitForEvent(const char *testName, SigMaskTestInfo *info, SignalEvent event, void *result, size_t size)
{
	OMRPORT_ACCESS_FROM_OMRPORT(info->portLibrary);
	BOOLEAN ret = FALSE;
	intptr_t waitRC = J9THREAD_WOULD_BLOCK;

	omrthread_monitor_enter(info->monitor);

	while (info->bulletinBoard.event != event) {
		waitRC = omrthread_monitor_wait_timed(info->monitor, 60000, 0);
		if (J9THREAD_TIMED_OUT == waitRC) {
			break;
		}
	}

	ret = (info->bulletinBoard.event == event);
	if (TRUE == ret) {
		if ((NULL != result) && (size > 0)) {
			memcpy(result, &info->bulletinBoard.data, size);
		}
	} else {
		if (J9THREAD_TIMED_OUT == waitRC) {
			outputErrorMessage(PORTTEST_ERROR_ARGS, "timed out without being notified. expected (%d), received (%d)\n", event, info->bulletinBoard.event);
		} else {
			outputErrorMessage(PORTTEST_ERROR_ARGS, "expected event(%d) was not received. bulletinBoard(%d)\n", event, info->bulletinBoard.event);
		}
	}

	info->bulletinBoard.event = INVALID;

	omrthread_monitor_exit(info->monitor);

	return ret;
}
开发者ID:LinHu2016,项目名称:omr,代码行数:45,代码来源:omrsignalExtendedTest.cpp


注:本文中的OMRPORT_ACCESS_FROM_OMRPORT函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。