Exemplo n.º 1
0
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si local_size)
{
	sljit_si locals_offset;

	CHECK_ERROR_VOID();
	check_sljit_set_context(compiler, args, scratches, saveds, local_size);

	compiler->scratches = scratches;
	compiler->saveds = saveds;
	compiler->args = args;
#if (defined SLJIT_DEBUG && SLJIT_DEBUG)
	compiler->logical_local_size = local_size;
#endif

#if (defined SLJIT_X86_32_FASTCALL && SLJIT_X86_32_FASTCALL)
	locals_offset = 2 * sizeof(sljit_uw);
#else
	locals_offset = FIXED_LOCALS_OFFSET;
#endif
	compiler->scratches_start = locals_offset;
	if (scratches > 3)
		locals_offset += (scratches - 3) * sizeof(sljit_uw);
	compiler->saveds_start = locals_offset;
	if (saveds > 3)
		locals_offset += (saveds - 3) * sizeof(sljit_uw);
	compiler->locals_offset = locals_offset;
	compiler->local_size = locals_offset + ((local_size + sizeof(sljit_uw) - 1) & ~(sizeof(sljit_uw) - 1));
}
Exemplo n.º 2
0
void sljit_fake_enter(struct sljit_compiler *compiler, int args, int temporaries, int generals, int local_size)
{
	CHECK_ERROR_VOID();
	check_sljit_fake_enter(compiler, args, temporaries, generals, local_size);

	compiler->temporaries = temporaries;
	compiler->generals = generals;
	compiler->args = args;
	compiler->local_size = (local_size + sizeof(sljit_uw) - 1) & ~(sizeof(sljit_uw) - 1);
	compiler->temporaries_start = compiler->local_size;
	if (temporaries > 3)
		compiler->local_size += (temporaries - 3) * sizeof(sljit_uw);
	compiler->generals_start = compiler->local_size;
	if (generals > 3)
		compiler->local_size += (generals - 3) * sizeof(sljit_uw);
}
Exemplo n.º 3
0
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, sljit_si args, sljit_si scratches, sljit_si saveds, sljit_si local_size)
{
	sljit_si pushed_size;

	CHECK_ERROR_VOID();
	check_sljit_set_context(compiler, args, scratches, saveds, local_size);

	compiler->scratches = scratches;
	compiler->saveds = saveds;
#if (defined SLJIT_DEBUG && SLJIT_DEBUG)
	compiler->logical_local_size = local_size;
#endif

	/* Including the return address saved by the call instruction. */
	pushed_size = (saveds + 1) * sizeof(sljit_sw);
#ifdef _WIN64
	if (scratches >= 5)
		pushed_size += sizeof(sljit_sw);
#endif
	compiler->local_size = ((local_size + FIXED_LOCALS_OFFSET + pushed_size + 16 - 1) & ~(16 - 1)) - pushed_size;
}
Exemplo n.º 4
0
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_context(struct sljit_compiler *compiler, int args, int temporaries, int saveds, int local_size)
{
	int pushed_size;

	CHECK_ERROR_VOID();
	check_sljit_set_context(compiler, args, temporaries, saveds, local_size);

	compiler->temporaries = temporaries;
	compiler->saveds = saveds;
	/* Including the return address saved by the call instruction. */
	pushed_size = (saveds + 1) * sizeof(sljit_w);
#ifdef _WIN64
	compiler->has_locals = local_size > 0;
	if (local_size > 0)
		pushed_size += sizeof(sljit_w);
	if (temporaries >= 5)
		pushed_size += sizeof(sljit_w);
#endif
	compiler->local_size = ((local_size + pushed_size + 16 - 1) & ~(16 - 1)) - pushed_size;
#ifdef _WIN64
	compiler->local_size += 4 * sizeof(sljit_w);
#endif
}