Re: QL / PASCAL
Posted: Tue Nov 24, 2020 2:01 pm
Sure, for a codebase I'm new to, I also tend to do the same approach. And as I wrote, the patch was very helpful anyway.mk79 wrote:Wow, thanks for the quick uptakeObviously I'm completely foreign to the codebase and in that case I tend to change minimalistically, so if anything can be implemented better I'm all for it. I also very much noticed that my Pascal days have been a while
![]()
Yes. The previous CVS history was not imported in 2005, when the project moved to SVN. This was intentional, due to some code licensing issue at the time, and all the code which was affected have been left behind.mk79 wrote:That explains it. I actually went "svn blame" to see when that got broken and which is the "newer" version, only to see that, within the SVN history, it has never worked in the first place.Chain-Q wrote: The assembler reader was the only major component which we reused and just patched up from the very early 1.0.x m68k Free Pascal, when we resurrected the m68k port for v3.0, and it sadly shows.
What do you mean by "style of output"? Assembler style? Not currently, on the backend, the m68k always produces GNU AS style assembler, even for vasm.mk79 wrote:Is there any mechanism of passing an option to the backend to select which style of output should be produced?
Yes, the optimizer completely skips the assembler blocks, including the dead-move elimination. If you want to optimize those, I'd still leave the parameter-move code in place, commented out maybe, or a small comment in its place, that the parameter is already at the right register, or something. This way the next person who comes around will probably understand better what is going on.mk79 wrote:I didn't check the register order! Good point. I did see some funny "move.l d1,d1" in the resulting code when the register is already in the right place, though
OK, we'll keep it like it is currently then.mk79 wrote:I thought about the linker generating the header, too, but actually no QL linker does so either, so I'm fine with it being linked into the code as a normal object to stay generic.
Sure. The only drawback will be that the relocation code gets slightly more complicated and slower, as it will be a byte-stream with no longer guaranteed alignments. But it's not too bad.mk79 wrote:Having a smaller relocation section would be very nice, as it already takes some 2.5kb in the Hello World example.
This was already like this, for the BASIC loader version, .bss overwrote the relocation table after it has been used. I guess to see if we can keep this in the exe version or not, depends on the if the dataspace is allocated right after the binary when loaded, forming a continuous address range, or not. If yes, this should be possible. When calculating the dataspace needed, we only have to sutract the relocations size from it, and reuse the reloc as part of the .bss area. If not, and the dataspace is allocated elsewhere, then it gets complicated...mk79 wrote: However, if any new formats could be established I'd like to put one further possible optimization up for consideration: relocation is not a common concept in the QL world and as the QL does not have any "loader" in that sense, it cannot throw away the reloc info after relocation like other systems would. So they end up occupying memory without any further benefit. It would however be possible for .reloc and .bss to share the same address space in memory, with the loader clearing the info during relocation for .bss usage. Not sure how difficult that would be to implement on the linker side, but definitely worth thinking about for small systems I guess.