[A83] Re: ION and program table


[Prev][Next][Index][Thread]

[A83] Re: ION and program table




Nat Allan wrote:
> Sorry, i wasnt 100% clear in my email.  Its not copying the program itself
> thats the problem, i believe its the re-arrangment of the program
> table/symbol table or whatever its properly called.  The subroutine thats
> crashing it is my delete program subroutine.  If i delete another program,
> the table is re-arranged to accomadate that.  Im not 100% sure how ION
> works, but im guessing that this is the problem when it copys back the data.
> Again, im not 100% sure why this would be a problem, as i would have thought
> the programs location in the table would have been irrelevant.
> 
> -Nat
> 

When you delete stuff other gets moved. It's like a deck of cards. Pick 
one from it and ones above move one lower. Same happens with the symbol 
table and with the variables.

Also, the TIOS moves the variables one by one. The size of such a block 
of data is that indicated by the size bytes. Though, Ion moves a program 
to progstart (so not copying, the data is really removed and thus the 
next variable's data follows immediately), but leaves the size bytes 
intact. Result being that when you start deleting variables and the TIOS 
comes to move up your program, things get messed up.

And what's more, Ion assumes that the location of a program is the same 
before and after it executes it. Go figure that when you delete 
variables from within your program, your mem is corrupt.

Conclusion, don't delete data from within an Ion program, unless you 
know how to bypass all this.

1: set your program's own size bytes to zero
2: delete the var
3: restore your program's own size bytes
4: overwrite Ion variables so they point to the right place in mem.




Follow-Ups: References: