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; code_block* compiled = op.compiled;
array* parameters = to_boolean(compiled->parameters) array* parameters = to_boolean(compiled->parameters)
? untag<array>(compiled->parameters) ? untag<array>(compiled->parameters)
: NULL; : NULL;
cell index = op.index; cell idx = op.index;
relocation_type rel_type = op.rel_type(); relocation_type rel_type = op.rel_type();
cell ext_addr = lookup_external_address(rel_type, cell ext_addr = lookup_external_address(rel_type, compiled, parameters, idx);
compiled,
parameters,
index);
if (ext_addr == (cell)-1) { if (ext_addr == (cell)-1) {
ostringstream ss; ostringstream ss;
print_obj(ss, compiled->owner); print_obj(ss, compiled->owner);
ss << ": "; ss << ": ";
cell arg; cell arg;
if (rel_type == RT_DLSYM || rel_type == RT_DLSYM_TOC) { if (rel_type == RT_DLSYM || rel_type == RT_DLSYM_TOC) {
ss << "Bad symbol specifier in store_external_address"; ss << "Bad symbol specifier in compute_external_address";
arg = array_nth(parameters, index); arg = array_nth(parameters, idx);
} else { } else {
ss << "Bad rel type in store_external_address"; ss << "Bad rel type in compute_external_address";
arg = rel_type; arg = rel_type;
} }
critical_error(ss.str().c_str(), arg); 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, 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(word* w, cell tagged_quot);
cell compute_entry_point_pic_address(cell w_); cell compute_entry_point_pic_address(cell w_);
cell compute_entry_point_pic_tail_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); cell code_block_owner(code_block* compiled);
void update_word_references(code_block* compiled, bool reset_inline_caches); void update_word_references(code_block* compiled, bool reset_inline_caches);
void undefined_symbol(); void undefined_symbol();