Verified Commit 5532bf1c authored by Camil Staps's avatar Camil Staps 🚀

Use GraphCopy function replace_desc_numbers_by_descs to resolve interpreter...

Use GraphCopy function replace_desc_numbers_by_descs to resolve interpreter symbols when deserializing
parent 62d27cc9
Pipeline #20231 passed with stages
in 11 minutes and 54 seconds
......@@ -102,15 +102,21 @@ deserialize` strict dsets {graph,descinfo,modules,bytecode} thisexe w
heap dsets.heap_size stack dsets.stack_size
asp bsp csp heap
strict
# graph_node = string_to_interpreter int_syms graph ie_settings
# graph = replace_desc_numbers_by_descs 0 graph int_syms 0 0
# graph_node = string_to_interpreter graph ie_settings
#! (ie,_) = make_finalizer ie_settings
# ie = {ie_finalizer=ie, ie_snode_ptr=0, ie_snodes=create_array_ 1}
= (Just (interpret ie (Finalizer 0 0 (graph_node + if strict 2 0))), w)
where
getInterpreterSymbols :: !Pointer -> [Symbol]
getInterpreterSymbols pgm = takeWhile (\s -> size s.symbol_name <> 0)
string_to_interpreter :: !String !Pointer -> Pointer
string_to_interpreter graph ie = code {
ccall string_to_interpreter "Sp:p"
}
getInterpreterSymbols :: !Pointer -> [Symbol]
getInterpreterSymbols pgm = takeWhile (\s -> size s.symbol_name <> 0)
[getSymbol i \\ i <- [0..get_symbol_table_size pgm-1]]
where
where
symbol_table = get_symbol_table pgm
getSymbol :: !Int -> Symbol
......@@ -130,13 +136,8 @@ where
ccall get_symbol_table "p:p"
}
string_to_interpreter :: !{#Int} !String !Pointer -> Pointer
string_to_interpreter symbol_values graph ie = code {
ccall string_to_interpreter "ASp:p"
}
lookup_symbol_value :: !DescInfo !{#String} !{#Symbol} -> Int
lookup_symbol_value {di_prefix_arity_and_mod,di_name} mod_a symbols
lookup_symbol_value :: !DescInfo !{#String} !{#Symbol} -> Int
lookup_symbol_value {di_prefix_arity_and_mod,di_name} mod_a symbols
# prefix_n = di_prefix_arity_and_mod bitand 0xff
# module_n = (di_prefix_arity_and_mod >> 8)-1
# module_name = mod_a.[module_n]
......@@ -156,7 +157,7 @@ where
= abort ("lookup_desc_info not found "+++symbol_name+++"\n")
# arity = prefix_n - PREFIX_D
= symbol_value+(arity*8*2)+2
where
where
PREFIX_D = 4
get_start_rule_as_expression :: !DeserializationSettings !String !String !*World -> *(Maybe a, !*World)
......
......@@ -83,8 +83,7 @@ BC_WORD *build_start_node(struct interpretation_environment *ie) {
return hp;
}
BC_WORD *string_to_interpreter(BC_WORD *descriptors, uint64_t *clean_string,
struct interpretation_environment *ie) {
BC_WORD *string_to_interpreter(uint64_t *clean_string, struct interpretation_environment *ie) {
int len = *(int*)clean_string;
uint64_t *s = &clean_string[1];
BC_WORD *node = ie->hp;
......@@ -117,8 +116,6 @@ BC_WORD *string_to_interpreter(BC_WORD *descriptors, uint64_t *clean_string,
continue;
}
desc=descriptors[desc-1];
#if DEBUG_CLEAN_LINKS > 1
EPRINTF("\t");
for (int16_t *a=(int16_t*)ie->bsp-1; a>a_size_stack; a--)
......@@ -163,7 +160,6 @@ BC_WORD *string_to_interpreter(BC_WORD *descriptors, uint64_t *clean_string,
EPRINTF("; __ARRAY__ " BC_WORD_FMT,size);
#endif
BC_WORD elem_desc=(BC_WORD)s[i+2];
elem_desc=elem_desc==0 ? 0 : descriptors[elem_desc-1];
**ptr_stack--=(BC_WORD)ie->hp;
ie->hp[0]=desc;
ie->hp[1]=size;
......
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