Пример #1
0
void CAlu64Test::Compile(Jitter::CJitter& jitter)
{
	Framework::CMemStream codeStream;
	jitter.SetStream(&codeStream);

	jitter.Begin();
	{
		jitter.PushRel64(offsetof(CONTEXT, value0));
		jitter.PushRel64(offsetof(CONTEXT, value1));
		jitter.Add64();
		jitter.PullRel64(offsetof(CONTEXT, resultAdd0));

		jitter.PushRel64(offsetof(CONTEXT, value2));
		jitter.PushRel64(offsetof(CONTEXT, value3));
		jitter.Add64();
		jitter.PullRel64(offsetof(CONTEXT, resultAdd1));

		jitter.PushRel64(offsetof(CONTEXT, value0));
		jitter.PushCst64(CONSTANT_5);
		jitter.Add64();
		jitter.PullRel64(offsetof(CONTEXT, resultAddCst));

		jitter.PushRel64(offsetof(CONTEXT, value0));
		jitter.PushRel64(offsetof(CONTEXT, value1));
		jitter.Sub64();
		jitter.PullRel64(offsetof(CONTEXT, resultSub0));

		jitter.PushRel64(offsetof(CONTEXT, value2));
		jitter.PushRel64(offsetof(CONTEXT, value3));
		jitter.Sub64();
		jitter.PullRel64(offsetof(CONTEXT, resultSub1));

		jitter.PushCst64(CONSTANT_5);
		jitter.PushRel64(offsetof(CONTEXT, value0));
		jitter.Sub64();
		jitter.PullRel64(offsetof(CONTEXT, resultSubCst));
	}
	jitter.End();

	m_function = CMemoryFunction(codeStream.GetBuffer(), codeStream.GetSize());
}