Lines Matching refs:compiler
4 * Stack-less Just-In-Time compiler
31 static sljit_s32 emit_do_imm(struct sljit_compiler *compiler, sljit_u8 opcode, sljit_sw imm)
35 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + sizeof(sljit_sw));
68 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_enter(struct sljit_compiler *compiler,
76 CHECK(check_sljit_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
77 set_emit_enter(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
79 compiler->args = args;
83 compiler->saveds_offset = 1 * sizeof(sljit_sw);
87 compiler->saveds_offset = 1 * sizeof(sljit_sw);
89 compiler->saveds_offset = ((scratches == 2) ? 2 : 3) * sizeof(sljit_sw);
93 compiler->saveds_offset += ((scratches > (3 + 6)) ? 6 : (scratches - 3)) * sizeof(sljit_sw);
95 compiler->locals_offset = compiler->saveds_offset;
98 compiler->locals_offset += (saveds - 3) * sizeof(sljit_sw);
101 compiler->locals_offset = (compiler->locals_offset + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) - 1);
109 inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
173 compiler->local_size = local_size;
178 FAIL_IF(emit_do_imm(compiler, MOV_r_i32 + reg_map[SLJIT_R0], local_size));
182 FAIL_IF(emit_do_imm(compiler, MOV_r_i32 + reg_map[SLJIT_R0], local_size));
183 FAIL_IF(emit_non_cum_binary(compiler, SUB_r_rm, SUB_rm_r, SUB, SUB_EAX_i32,
186 FAIL_IF(sljit_emit_ijump(compiler, SLJIT_CALL1, SLJIT_IMM, SLJIT_FUNC_OFFSET(sljit_grow_stack)));
194 EMIT_MOV(compiler, TMP_REG1, 0, SLJIT_SP, 0);
197 FAIL_IF(emit_non_cum_binary(compiler, SUB_r_rm, SUB_rm_r, SUB, SUB_EAX_i32,
201 if (compiler->local_size > 1024)
202 FAIL_IF(emit_cum_binary(compiler, ADD_r_rm, ADD_rm_r, ADD, ADD_EAX_i32,
206 inst = (sljit_u8*)ensure_buf(compiler, 1 + 6);
215 return emit_mov(compiler, SLJIT_MEM1(SLJIT_SP), compiler->local_size, TMP_REG1, 0);
218 return emit_non_cum_binary(compiler, SUB_r_rm, SUB_rm_r, SUB, SUB_EAX_i32,
222 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_set_context(struct sljit_compiler *compiler,
227 CHECK(check_sljit_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size));
228 set_set_context(compiler, options, args, scratches, saveds, fscratches, fsaveds, local_size);
230 compiler->args = args;
234 compiler->saveds_offset = 1 * sizeof(sljit_sw);
238 compiler->saveds_offset = 1 * sizeof(sljit_sw);
240 compiler->saveds_offset = ((scratches == 2) ? 2 : 3) * sizeof(sljit_sw);
244 compiler->saveds_offset += ((scratches > (3 + 6)) ? 6 : (scratches - 3)) * sizeof(sljit_sw);
246 compiler->locals_offset = compiler->saveds_offset;
249 compiler->locals_offset += (saveds - 3) * sizeof(sljit_sw);
252 compiler->locals_offset = (compiler->locals_offset + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) - 1);
256 compiler->local_size = ((SLJIT_LOCALS_OFFSET + saveds + local_size + 15) & ~15) - saveds;
259 compiler->local_size = SLJIT_LOCALS_OFFSET + ((local_size + sizeof(sljit_f64) - 1) & ~(sizeof(sljit_f64) - 1));
261 compiler->local_size = SLJIT_LOCALS_OFFSET + ((local_size + sizeof(sljit_sw) - 1) & ~(sizeof(sljit_sw) - 1));
266 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_return(struct sljit_compiler *compiler, sljit_s32 op, sljit_s32 src, sljit_sw srcw)
272 CHECK(check_sljit_emit_return(compiler, op, src, srcw));
273 SLJIT_ASSERT(compiler->args >= 0);
275 FAIL_IF(emit_mov_before_return(compiler, op, src, srcw));
277 SLJIT_ASSERT(compiler->local_size > 0);
280 if (compiler->options & SLJIT_F64_ALIGNMENT)
281 EMIT_MOV(compiler, SLJIT_SP, 0, SLJIT_MEM1(SLJIT_SP), compiler->local_size)
283 FAIL_IF(emit_cum_binary(compiler, ADD_r_rm, ADD_rm_r, ADD, ADD_EAX_i32,
284 SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, compiler->local_size));
286 FAIL_IF(emit_cum_binary(compiler, ADD_r_rm, ADD_rm_r, ADD, ADD_EAX_i32,
287 SLJIT_SP, 0, SLJIT_SP, 0, SLJIT_IMM, compiler->local_size));
290 size = 2 + (compiler->scratches > 7 ? (compiler->scratches - 7) : 0) +
291 (compiler->saveds <= 3 ? compiler->saveds : 3);
293 if (compiler->args > 2)
296 if (compiler->args > 0)
299 inst = (sljit_u8*)ensure_buf(compiler, 1 + size);
304 if (compiler->saveds > 0 || compiler->scratches > 11)
306 if (compiler->saveds > 1 || compiler->scratches > 10)
308 if (compiler->saveds > 2 || compiler->scratches > 9)
312 if (compiler->args > 2)
328 static sljit_u8* emit_x86_instruction(struct sljit_compiler *compiler, sljit_s32 size,
404 inst = (sljit_u8*)ensure_buf(compiler, 1 + inst_size);
495 static SLJIT_INLINE sljit_s32 call_with_args(struct sljit_compiler *compiler, sljit_s32 type)
500 inst = (sljit_u8*)ensure_buf(compiler, type >= SLJIT_CALL3 ? 1 + 2 + 1 : 1 + 2);
509 inst = (sljit_u8*)ensure_buf(compiler, 1 + 4 * (type - SLJIT_CALL0));
533 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_enter(struct sljit_compiler *compiler, sljit_s32 dst, sljit_sw dstw)
538 CHECK(check_sljit_emit_fast_enter(compiler, dst, dstw));
549 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
558 inst = emit_x86_instruction(compiler, 1, 0, 0, dst, dstw);
564 SLJIT_API_FUNC_ATTRIBUTE sljit_s32 sljit_emit_fast_return(struct sljit_compiler *compiler, sljit_s32 src, sljit_sw srcw)
569 CHECK(check_sljit_emit_fast_return(compiler, src, srcw));
575 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1 + 1);
582 inst = emit_x86_instruction(compiler, 1, 0, 0, src, srcw);
587 inst = (sljit_u8*)ensure_buf(compiler, 1 + 1);
593 inst = (sljit_u8*)ensure_buf(compiler, 1 + 5 + 1);