On Mon, Jan 3, 2011 at 1:57 PM, Mark Cave-Ayland mark.cave-ayland@siriusit.co.uk wrote:
On 02/01/11 16:54, Blue Swirl wrote:
The Forth dictionary was relocated at run time, incurring also a copy operation. The source dictionary remained in memory. It was not possible to run forthstrap without any input files besides the base dictionary.
Make forthstrap generate a hex dump which can be included in C, but also contains relocations, so that relocations are performed by the linker at compile time. Allow dictionary compilation with no source files.
Don't allocate the dictionary dynamically; reduce ofmem supply accordingly.
This looks like a good idea in principle. My only comments would be that I think we should do it for all architectures, and also perhaps add some more comments in bootstrap.c explaining what is happening, particularly in relation to the relocation code section.
I converted others too, but the relocation arithmetic does not seem to work on ppc64 because ucell size is smaller than pointer and pointer2cell() arithmetic is not accepted by the compiler as constant. Back to drawing board. One way would be to relocate the dictionary to its final location (which is fixed by ldscript) at build time, but that is less flexible.
Oh - and I'm a little confused as to why there is a hard-coded filename for bootstrap.dict in there - should this be passed in as a parameter?
I just moved the ? : expression earlier and changed it to if (). I don't know why that exists.