VM: new method compute_external_address

db4
Björn Lindqvist 2015-07-31 01:14:38 +02:00
parent 718ea51d8a
commit 50318a6f77
2 changed files with 13 additions and 11 deletions

View File

@ -259,34 +259,34 @@ cell factor_vm::lookup_external_address(relocation_type rel_type,
}
}
void factor_vm::store_external_address(instruction_operand op) {
cell factor_vm::compute_external_address(instruction_operand op) {
code_block* compiled = op.compiled;
array* parameters = to_boolean(compiled->parameters)
? untag<array>(compiled->parameters)
: NULL;
cell index = op.index;
cell idx = op.index;
relocation_type rel_type = op.rel_type();
cell ext_addr = lookup_external_address(rel_type,
compiled,
parameters,
index);
cell ext_addr = lookup_external_address(rel_type, compiled, parameters, idx);
if (ext_addr == (cell)-1) {
ostringstream ss;
print_obj(ss, compiled->owner);
ss << ": ";
cell arg;
if (rel_type == RT_DLSYM || rel_type == RT_DLSYM_TOC) {
ss << "Bad symbol specifier in store_external_address";
arg = array_nth(parameters, index);
ss << "Bad symbol specifier in compute_external_address";
arg = array_nth(parameters, idx);
} else {
ss << "Bad rel type in store_external_address";
ss << "Bad rel type in compute_external_address";
arg = rel_type;
}
critical_error(ss.str().c_str(), arg);
}
op.store_value(ext_addr);
return ext_addr;
}
void factor_vm::store_external_address(instruction_operand op) {
op.store_value(compute_external_address(op));
}
cell factor_vm::compute_here_address(cell arg, cell offset,

View File

@ -559,6 +559,8 @@ struct factor_vm {
cell compute_entry_point_pic_address(word* w, cell tagged_quot);
cell compute_entry_point_pic_address(cell w_);
cell compute_entry_point_pic_tail_address(cell w_);
cell compute_external_address(instruction_operand op);
cell code_block_owner(code_block* compiled);
void update_word_references(code_block* compiled, bool reset_inline_caches);
void undefined_symbol();