Verified Commit 825ffe40 authored by Camil Staps's avatar Camil Staps 🙂

JavaScript: don't overwrite the top of the stack when interpret is called from ap

parent cb22d975
......@@ -204,7 +204,7 @@ class ABCInterpreter {
var result=undefined;
const new_asp=me.interpreter.instance.exports.get_asp();
const hp_ptr=me.memory_array[new_asp/4];
const hp_ptr=me.memory_array[new_asp/4+2];
if (me.memory_array[hp_ptr/4]!=25*8+2) { // INT, i.e. JSWorld
// Assume we have received a tuple with the first element as the result
// This is the case with jsWrapFunWithResult
......@@ -720,10 +720,10 @@ class ABCInterpreter {
/* NB: the order here matters: copy_js_to_clean may trigger garbage
* collection, so do that first, then set the rest of the arguments and
* update asp. */
const copied=me.copy_js_to_clean(args, asp+8);
me.memory_array[asp/4]=(30+17*2)*8; // JSWorld: INT 17
me.memory_array[asp/4+4]=me.shared_clean_values[f.shared_clean_value_index].ref;
me.interpreter.instance.exports.set_asp(asp+16);
const copied=me.copy_js_to_clean(args, asp+16);
me.memory_array[asp/4+2]=(30+17*2)*8; // JSWorld: INT 17
me.memory_array[asp/4+6]=me.shared_clean_values[f.shared_clean_value_index].ref;
me.interpreter.instance.exports.set_asp(asp+24);
hp=copied.hp;
hp_free=copied.hp_free;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment