... | ... |
@@ -1655,6 +1655,8 @@ int cli_bytecode_run(const struct cli_all_bc *bcs, const struct cli_bc *bc, stru |
1655 | 1655 |
inst.u.ops.opsizes = ctx->opsizes; |
1656 | 1656 |
cli_dbgmsg("Bytecode %u: executing in interpeter mode\n", bc->id); |
1657 | 1657 |
|
1658 |
+ ctx->on_jit = 0; |
|
1659 |
+ |
|
1658 | 1660 |
cli_event_time_start(interp_ev, BCEV_EXEC_TIME); |
1659 | 1661 |
ret = cli_vm_execute(ctx->bc, ctx, &func, &inst); |
1660 | 1662 |
cli_event_time_stop(interp_ev, BCEV_EXEC_TIME); |
... | ... |
@@ -1674,6 +1676,7 @@ int cli_bytecode_run(const struct cli_all_bc *bcs, const struct cli_bc *bc, stru |
1674 | 1674 |
ctx->bc_events = jit_ev; |
1675 | 1675 |
cli_dbgmsg("Bytecode %u: executing in JIT mode\n", bc->id); |
1676 | 1676 |
|
1677 |
+ ctx->on_jit = 1; |
|
1677 | 1678 |
cli_event_time_start(jit_ev, BCEV_EXEC_TIME); |
1678 | 1679 |
ret = cli_vm_execute_jit(bcs, ctx, &bc->funcs[ctx->funcid]); |
1679 | 1680 |
cli_event_time_stop(jit_ev, BCEV_EXEC_TIME); |
... | ... |
@@ -1699,7 +1702,7 @@ int cli_bytecode_run(const struct cli_all_bc *bcs, const struct cli_bc *bc, stru |
1699 | 1699 |
bc->id, interp_errors, jit_errors); |
1700 | 1700 |
ok = 0; |
1701 | 1701 |
} |
1702 |
- if (cli_event_diff_all(interp_ev, jit_ev, NULL)) { |
|
1702 |
+ if (!ctx->no_diff && cli_event_diff_all(interp_ev, jit_ev, NULL)) { |
|
1703 | 1703 |
cli_infomsg(cctx, "bytecode %d execution different with JIT and interpreter, see --debug for details\n", |
1704 | 1704 |
bc->id); |
1705 | 1705 |
ok = 0; |
... | ... |
@@ -977,5 +977,11 @@ int32_t pdf_get_dumpedobjid(void); |
977 | 977 |
int32_t matchicon(const uint8_t* group1, int32_t group1_len, |
978 | 978 |
const uint8_t* group2, int32_t group2_len); |
979 | 979 |
/* ---------------- END 0.96.2 APIs ----------------------------------- */ |
980 |
+/* ----------------- BEGIN 0.96.4 APIs ---------------------------------- */ |
|
981 |
+/* Returns whether running on JIT. As side-effect it disables |
|
982 |
+ * interp / JIT comparisons in test mode (errors are still checked) */ |
|
983 |
+int32_t running_on_jit(void); |
|
984 |
+ |
|
985 |
+/* ----------------- END 0.96.4 APIs ---------------------------------- */ |
|
980 | 986 |
#endif |
981 | 987 |
#endif |
... | ... |
@@ -122,6 +122,7 @@ int32_t cli_bcapi_pdf_get_offset(struct cli_bc_ctx *ctx , int32_t); |
122 | 122 |
int32_t cli_bcapi_pdf_get_phase(struct cli_bc_ctx *ctx ); |
123 | 123 |
int32_t cli_bcapi_pdf_get_dumpedobjid(struct cli_bc_ctx *ctx ); |
124 | 124 |
int32_t cli_bcapi_matchicon(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, const uint8_t*, int32_t); |
125 |
+int32_t cli_bcapi_running_on_jit(struct cli_bc_ctx *ctx ); |
|
125 | 126 |
|
126 | 127 |
const struct cli_apiglobal cli_globals[] = { |
127 | 128 |
/* Bytecode globals BEGIN */ |
... | ... |
@@ -146,8 +147,8 @@ static uint16_t cli_tmp4[]={16, 8, 8, 32, 32, 32, 32, 32, 32, 32, 32, 32, 16, 16 |
146 | 146 |
static uint16_t cli_tmp5[]={32, 16, 16, 32, 32, 32, 16, 16}; |
147 | 147 |
static uint16_t cli_tmp6[]={32}; |
148 | 148 |
static uint16_t cli_tmp7[]={32}; |
149 |
-static uint16_t cli_tmp8[]={32, 65, 32, 65, 32}; |
|
150 |
-static uint16_t cli_tmp9[]={32}; |
|
149 |
+static uint16_t cli_tmp8[]={32}; |
|
150 |
+static uint16_t cli_tmp9[]={32, 65, 32, 65, 32}; |
|
151 | 151 |
static uint16_t cli_tmp10[]={32, 32}; |
152 | 152 |
static uint16_t cli_tmp11[]={32, 32, 32}; |
153 | 153 |
static uint16_t cli_tmp12[]={65, 32, 32}; |
... | ... |
@@ -179,8 +180,8 @@ const struct cli_bc_type cli_apicall_types[]={ |
179 | 179 |
{DStructType, cli_tmp5, 8, 0, 0}, |
180 | 180 |
{DArrayType, cli_tmp6, 1, 0, 0}, |
181 | 181 |
{DArrayType, cli_tmp7, 64, 0, 0}, |
182 |
- {DFunctionType, cli_tmp8, 5, 0, 0}, |
|
183 |
- {DFunctionType, cli_tmp9, 1, 0, 0}, |
|
182 |
+ {DFunctionType, cli_tmp8, 1, 0, 0}, |
|
183 |
+ {DFunctionType, cli_tmp9, 5, 0, 0}, |
|
184 | 184 |
{DFunctionType, cli_tmp10, 2, 0, 0}, |
185 | 185 |
{DFunctionType, cli_tmp11, 3, 0, 0}, |
186 | 186 |
{DFunctionType, cli_tmp12, 3, 0, 0}, |
... | ... |
@@ -230,7 +231,7 @@ const struct cli_apicall cli_apicalls[]={ |
230 | 230 |
{"fill_buffer", 20, 0, 4}, |
231 | 231 |
{"extract_new", 10, 4, 2}, |
232 | 232 |
{"read_number", 10, 5, 2}, |
233 |
- {"hashset_new", 9, 0, 5}, |
|
233 |
+ {"hashset_new", 8, 0, 5}, |
|
234 | 234 |
{"hashset_add", 11, 2, 0}, |
235 | 235 |
{"hashset_remove", 11, 3, 0}, |
236 | 236 |
{"hashset_contains", 11, 4, 0}, |
... | ... |
@@ -257,7 +258,7 @@ const struct cli_apicall cli_apicalls[]={ |
257 | 257 |
{"iexp", 13, 2, 7}, |
258 | 258 |
{"isin", 13, 3, 7}, |
259 | 259 |
{"icos", 13, 4, 7}, |
260 |
- {"memstr", 8, 0, 8}, |
|
260 |
+ {"memstr", 9, 0, 8}, |
|
261 | 261 |
{"hex2ui", 11, 8, 0}, |
262 | 262 |
{"atoi", 19, 13, 1}, |
263 | 263 |
{"debug_print_str_start", 19, 14, 1}, |
... | ... |
@@ -272,19 +273,19 @@ const struct cli_apicall cli_apicalls[]={ |
272 | 272 |
{"map_getvalue", 12, 2, 6}, |
273 | 273 |
{"map_done", 10, 20, 2}, |
274 | 274 |
{"file_find_limit", 14, 4, 9}, |
275 |
- {"engine_functionality_level", 9, 1, 5}, |
|
276 |
- {"engine_dconf_level", 9, 2, 5}, |
|
277 |
- {"engine_scan_options", 9, 3, 5}, |
|
278 |
- {"engine_db_options", 9, 4, 5}, |
|
275 |
+ {"engine_functionality_level", 8, 1, 5}, |
|
276 |
+ {"engine_dconf_level", 8, 2, 5}, |
|
277 |
+ {"engine_scan_options", 8, 3, 5}, |
|
278 |
+ {"engine_db_options", 8, 4, 5}, |
|
279 | 279 |
{"extract_set_container", 10, 21, 2}, |
280 | 280 |
{"input_switch", 10, 22, 2}, |
281 | 281 |
{"get_environment", 15, 17, 1}, |
282 | 282 |
{"disable_bytecode_if", 14, 5, 9}, |
283 | 283 |
{"disable_jit_if", 14, 6, 9}, |
284 |
- {"version_compare", 8, 1, 8}, |
|
284 |
+ {"version_compare", 9, 1, 8}, |
|
285 | 285 |
{"check_platform", 13, 5, 7}, |
286 |
- {"pdf_get_obj_num", 9, 5, 5}, |
|
287 |
- {"pdf_get_flags", 9, 6, 5}, |
|
286 |
+ {"pdf_get_obj_num", 8, 5, 5}, |
|
287 |
+ {"pdf_get_flags", 8, 6, 5}, |
|
288 | 288 |
{"pdf_set_flags", 10, 23, 2}, |
289 | 289 |
{"pdf_lookupobj", 10, 24, 2}, |
290 | 290 |
{"pdf_getobjsize", 10, 25, 2}, |
... | ... |
@@ -293,9 +294,10 @@ const struct cli_apicall cli_apicalls[]={ |
293 | 293 |
{"pdf_getobjflags", 10, 27, 2}, |
294 | 294 |
{"pdf_setobjflags", 11, 10, 0}, |
295 | 295 |
{"pdf_get_offset", 10, 28, 2}, |
296 |
- {"pdf_get_phase", 9, 7, 5}, |
|
297 |
- {"pdf_get_dumpedobjid", 9, 8, 5}, |
|
298 |
- {"matchicon", 8, 2, 8} |
|
296 |
+ {"pdf_get_phase", 8, 7, 5}, |
|
297 |
+ {"pdf_get_dumpedobjid", 8, 8, 5}, |
|
298 |
+ {"matchicon", 9, 2, 8}, |
|
299 |
+ {"running_on_jit", 8, 9, 5} |
|
299 | 300 |
/* Bytecode APIcalls END */ |
300 | 301 |
}; |
301 | 302 |
const cli_apicall_int2 cli_apicalls0[] = { |
... | ... |
@@ -377,7 +379,8 @@ const cli_apicall_allocobj cli_apicalls5[] = { |
377 | 377 |
(cli_apicall_allocobj)cli_bcapi_pdf_get_obj_num, |
378 | 378 |
(cli_apicall_allocobj)cli_bcapi_pdf_get_flags, |
379 | 379 |
(cli_apicall_allocobj)cli_bcapi_pdf_get_phase, |
380 |
- (cli_apicall_allocobj)cli_bcapi_pdf_get_dumpedobjid |
|
380 |
+ (cli_apicall_allocobj)cli_bcapi_pdf_get_dumpedobjid, |
|
381 |
+ (cli_apicall_allocobj)cli_bcapi_running_on_jit |
|
381 | 382 |
}; |
382 | 383 |
const cli_apicall_bufget cli_apicalls6[] = { |
383 | 384 |
(cli_apicall_bufget)cli_bcapi_buffer_pipe_read_get, |
... | ... |
@@ -120,5 +120,6 @@ int32_t cli_bcapi_pdf_get_offset(struct cli_bc_ctx *ctx , int32_t); |
120 | 120 |
int32_t cli_bcapi_pdf_get_phase(struct cli_bc_ctx *ctx ); |
121 | 121 |
int32_t cli_bcapi_pdf_get_dumpedobjid(struct cli_bc_ctx *ctx ); |
122 | 122 |
int32_t cli_bcapi_matchicon(struct cli_bc_ctx *ctx , const uint8_t*, int32_t, const uint8_t*, int32_t); |
123 |
+int32_t cli_bcapi_running_on_jit(struct cli_bc_ctx *ctx ); |
|
123 | 124 |
|
124 | 125 |
#endif |
... | ... |
@@ -225,6 +225,8 @@ struct cli_bc_ctx { |
225 | 225 |
const struct cli_environment *env; |
226 | 226 |
unsigned bytecode_disable_status; |
227 | 227 |
cli_events_t *bc_events; |
228 |
+ int on_jit; |
|
229 |
+ int no_diff; |
|
228 | 230 |
}; |
229 | 231 |
struct cli_all_bc; |
230 | 232 |
int cli_vm_execute(const struct cli_bc *bc, struct cli_bc_ctx *ctx, const struct cli_bc_func *func, const struct cli_bc_inst *inst); |