mirror of https://github.com/Nonannet/copapy.git
allocation corrected
This commit is contained in:
parent
702322ec0d
commit
ddbbf59368
|
|
@ -388,21 +388,11 @@ def compile_to_instruction_list(node_list: Iterable[Node], sdb: stencil_database
|
||||||
dw.write_value(net.source.value, lengths)
|
dw.write_value(net.source.value, lengths)
|
||||||
# print(f'+ {net.dtype} {net.source.value}')
|
# print(f'+ {net.dtype} {net.source.value}')
|
||||||
|
|
||||||
# allocate program data
|
# prep auxiliary_functions
|
||||||
dw.write_com(binw.Command.ALLOCATE_CODE)
|
|
||||||
dw.write_int(0)
|
|
||||||
|
|
||||||
# write auxiliary_functions
|
|
||||||
aux_function_names = sdb.get_sub_functions(node.name for _, node in extended_output_ops)
|
aux_function_names = sdb.get_sub_functions(node.name for _, node in extended_output_ops)
|
||||||
aux_function_mem_layout, aux_function_lengths = get_aux_function_mem_layout(aux_function_names, sdb)
|
aux_function_mem_layout, aux_function_lengths = get_aux_function_mem_layout(aux_function_names, sdb)
|
||||||
aux_func_addr_lookup = {name: offs for name, offs, _ in aux_function_mem_layout}
|
aux_func_addr_lookup = {name: offs for name, offs, _ in aux_function_mem_layout}
|
||||||
|
|
||||||
for name, out_offs, lengths in aux_function_mem_layout:
|
|
||||||
dw.write_com(binw.Command.COPY_CODE)
|
|
||||||
dw.write_int(out_offs)
|
|
||||||
dw.write_int(lengths)
|
|
||||||
dw.write_bytes(sdb.get_function_code(name))
|
|
||||||
|
|
||||||
# Prepare program code and relocations
|
# Prepare program code and relocations
|
||||||
object_addr_lookup = {net: offs for net, offs, _ in variable_mem_layout}
|
object_addr_lookup = {net: offs for net, offs, _ in variable_mem_layout}
|
||||||
data_list: list[bytes] = []
|
data_list: list[bytes] = []
|
||||||
|
|
@ -440,7 +430,18 @@ def compile_to_instruction_list(node_list: Iterable[Node], sdb: stencil_database
|
||||||
offset += len(data)
|
offset += len(data)
|
||||||
# print('function_end', offset, data)
|
# print('function_end', offset, data)
|
||||||
|
|
||||||
# write program data
|
# allocate program data
|
||||||
|
dw.write_com(binw.Command.ALLOCATE_CODE)
|
||||||
|
dw.write_int(offset)
|
||||||
|
|
||||||
|
# write aux code
|
||||||
|
for name, out_offs, lengths in aux_function_mem_layout:
|
||||||
|
dw.write_com(binw.Command.COPY_CODE)
|
||||||
|
dw.write_int(out_offs)
|
||||||
|
dw.write_int(lengths)
|
||||||
|
dw.write_bytes(sdb.get_function_code(name))
|
||||||
|
|
||||||
|
# write program code
|
||||||
dw.write_com(binw.Command.COPY_CODE)
|
dw.write_com(binw.Command.COPY_CODE)
|
||||||
dw.write_int(aux_function_lengths)
|
dw.write_int(aux_function_lengths)
|
||||||
dw.write_int(offset - aux_function_lengths)
|
dw.write_int(offset - aux_function_lengths)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue