VM: code_block::scan, make it so the method always returns -1 if scan can't be determined, part of the fix for #1265
parent
8ee1f890f2
commit
11e906139b
|
@ -44,7 +44,13 @@ HELP: set-retainstack
|
||||||
|
|
||||||
HELP: callstack
|
HELP: callstack
|
||||||
{ $values { "callstack" callstack } }
|
{ $values { "callstack" callstack } }
|
||||||
{ $description "Outputs a copy of the call stack contents, with the top of the stack at the end of the vector. The stack frame of the caller word is " { $emphasis "not" } " included." } ;
|
{ $description "Outputs a copy of the call stack contents, with the top of the stack at the end of the vector. The stack frame of the caller word is " { $emphasis "not" } " included. Each group of three elements in the callstack is frame:"
|
||||||
|
{ $list
|
||||||
|
"The first element is the executing word or quotation."
|
||||||
|
"The second element is the executing quotation."
|
||||||
|
"The third element is the offset in the executing quotation, or -1 if the offset can't be determined."
|
||||||
|
}
|
||||||
|
} ;
|
||||||
|
|
||||||
HELP: set-callstack
|
HELP: set-callstack
|
||||||
{ $values { "callstack" callstack } }
|
{ $values { "callstack" callstack } }
|
||||||
|
|
|
@ -9,26 +9,21 @@ cell code_block::owner_quot() const {
|
||||||
return executing.value();
|
return executing.value();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* If the code block is an unoptimized quotation, we can calculate the
|
||||||
|
scan offset. In all other cases -1 is returned. */
|
||||||
cell code_block::scan(factor_vm* vm, void* addr) const {
|
cell code_block::scan(factor_vm* vm, void* addr) const {
|
||||||
switch (type()) {
|
if (type() != code_block_unoptimized) {
|
||||||
case code_block_unoptimized: {
|
return tag_fixnum(-1);
|
||||||
tagged<object> obj(owner);
|
|
||||||
if (obj.type_p(WORD_TYPE))
|
|
||||||
obj = obj.as<word>()->def;
|
|
||||||
|
|
||||||
if (obj.type_p(QUOTATION_TYPE))
|
|
||||||
return tag_fixnum(
|
|
||||||
vm->quot_code_offset_to_scan(obj.value(), offset(addr)));
|
|
||||||
else
|
|
||||||
return false_object;
|
|
||||||
}
|
|
||||||
case code_block_optimized:
|
|
||||||
case code_block_pic:
|
|
||||||
return false_object;
|
|
||||||
default:
|
|
||||||
critical_error("Bad frame type", type());
|
|
||||||
return false_object;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tagged<object> obj(owner);
|
||||||
|
if (obj.type_p(WORD_TYPE))
|
||||||
|
obj = obj.as<word>()->def;
|
||||||
|
if (!obj.type_p(QUOTATION_TYPE))
|
||||||
|
return tag_fixnum(-1);
|
||||||
|
|
||||||
|
cell ofs = offset(addr);
|
||||||
|
return tag_fixnum(vm->quot_code_offset_to_scan(obj.value(), ofs));
|
||||||
}
|
}
|
||||||
|
|
||||||
cell factor_vm::compute_entry_point_address(cell obj) {
|
cell factor_vm::compute_entry_point_address(cell obj) {
|
||||||
|
|
Loading…
Reference in New Issue