Clear cached function from wasm Table when we know for sure an index is dirty

This commit is contained in:
Amaan Cheval 2017-11-08 16:06:30 +05:30 committed by Fabian
parent c0a5f84f2f
commit 7ed2fcaf4f
4 changed files with 13 additions and 0 deletions

View file

@ -108,6 +108,7 @@ function V86Starter(options)
return this["cpu_exception_hook"] && this["cpu_exception_hook"](n);
},
"_jit_store_func": function(index) { return cpu.jit_store_func(index); },
"_jit_clear_func": function(index) { return cpu.jit_clear_func(index); },
"_hlt_op": function() { return cpu.hlt_op(); },
"abort": function() { dbg_assert(false); },
"_dbg_assert": function() { return cpu.dbg_assert.apply(cpu, arguments); },

View file

@ -412,6 +412,11 @@ CPU.prototype.jit_store_func = function(index)
this.wm.imports.env.table.set(index, o["exports"]["f"]);
};
CPU.prototype.jit_clear_func = function(index)
{
this.wm.imports.env.table.set(index, null);
};
CPU.prototype.get_state = function()
{
var state = [];

View file

@ -265,6 +265,12 @@ void cycle_internal()
bool cached = entry->start_addr == phys_addr && entry->is_32 == *is_32;
bool clean = entry->group_status == group_dirtiness[phys_addr >> DIRTY_ARR_SHIFT];
if(cached && !clean)
{
// Remove the cached entry from the Table
jit_clear_func(addr_index);
}
if(cached && clean)
{
// XXX: With the code-generation, we need to figure out how we

View file

@ -54,4 +54,5 @@ uint32_t group_dirtiness[1 + (0xffffffff >> DIRTY_ARR_SHIFT)] = {0};
void call_indirect(int32_t index);
void jit_store_func(int32_t index);
void jit_clear_func(int32_t index);
#endif