overwrite code indices of dynamic_undefined predicates (dynamic, multifile, discontiguous) on export
This commit is contained in:
@@ -133,7 +133,7 @@ pub(super) fn import_module_exports<'a, LS: LoadState<'a>>(
|
|||||||
meta_predicates.insert(key, meta_specs.clone());
|
meta_predicates.insert(key, meta_specs.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(src_code_index) = imported_module.code_dir.get(&key) {
|
if let Some(src_code_index) = imported_module.code_dir.get(&key).cloned() {
|
||||||
let arena = &mut LS::machine_st(payload).arena;
|
let arena = &mut LS::machine_st(payload).arena;
|
||||||
|
|
||||||
let target_code_index = code_dir
|
let target_code_index = code_dir
|
||||||
@@ -148,6 +148,10 @@ pub(super) fn import_module_exports<'a, LS: LoadState<'a>>(
|
|||||||
target_code_index,
|
target_code_index,
|
||||||
src_code_index.get(),
|
src_code_index.get(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if src_code_index.is_dynamic_undefined() {
|
||||||
|
code_dir.insert(key, src_code_index);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
return Err(SessionError::ModuleDoesNotContainExport(
|
return Err(SessionError::ModuleDoesNotContainExport(
|
||||||
imported_module.module_decl.name,
|
imported_module.module_decl.name,
|
||||||
|
|||||||
@@ -1631,23 +1631,16 @@ impl Machine {
|
|||||||
usize,
|
usize,
|
||||||
) -> Result<(), SessionError>,
|
) -> Result<(), SessionError>,
|
||||||
) -> CallResult {
|
) -> CallResult {
|
||||||
let module_name = cell_as_atom!(
|
let module_name = cell_as_atom!(self.deref_register(1));
|
||||||
self.machine_st.store(self.machine_st.deref(self.machine_st.registers[1]))
|
|
||||||
);
|
|
||||||
|
|
||||||
let compilation_target = match module_name {
|
let compilation_target = match module_name {
|
||||||
atom!("user") => CompilationTarget::User,
|
atom!("user") => CompilationTarget::User,
|
||||||
_ => CompilationTarget::Module(module_name),
|
_ => CompilationTarget::Module(module_name),
|
||||||
};
|
};
|
||||||
|
|
||||||
let predicate_name = cell_as_atom!(
|
let predicate_name = cell_as_atom!(self.deref_register(2));
|
||||||
self.machine_st.store(self.machine_st.deref(self.machine_st.registers[2]))
|
|
||||||
);
|
|
||||||
|
|
||||||
let arity = self
|
|
||||||
.machine_st
|
|
||||||
.store(self.machine_st.deref(self.machine_st.registers[3]));
|
|
||||||
|
|
||||||
|
let arity = self.deref_register(3);
|
||||||
let arity = match Number::try_from(arity) {
|
let arity = match Number::try_from(arity) {
|
||||||
Ok(Number::Integer(n)) if &*n >= &Integer::from(0) && &*n <= &Integer::from(MAX_ARITY) => Ok(n.to_usize().unwrap()),
|
Ok(Number::Integer(n)) if &*n >= &Integer::from(0) && &*n <= &Integer::from(MAX_ARITY) => Ok(n.to_usize().unwrap()),
|
||||||
Ok(Number::Fixnum(n)) if n.get_num() >= 0 && n.get_num() <= MAX_ARITY as i64 => {
|
Ok(Number::Fixnum(n)) if n.get_num() >= 0 && n.get_num() <= MAX_ARITY as i64 => {
|
||||||
|
|||||||
Reference in New Issue
Block a user