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

Re: [f-cpu] new cjump instruction



On Sat, Apr 12, 2003 at 11:35:14AM +0200, Christophe Avoinne wrote:
[...]
> The idea to have a short absolute jumper in the same page (supposedly a
> minimal size for a page is 4096-byte long) that we are running would prevent
> from any TLB exception to occur. So it could be used fastly in small loops
> that are within a page.

I would prefer a smaller minimum page size (like 1K), but that's a
different story.

> Nevertheless, we need to care about page boundary, not about range boundary,
> so your compiler needs to be aware of it and probably to rearrange code in
> another suitable order; which is quite restrictive and something
> definitively not wishable for a compiler.

Most compilers don't care about addresses at all -- they use symbolic
labels and let the assembler assign addresses.  Some modern compilers
(e.g. Sun Forte) use assemblers that perform peephole optimization --
that is, the length of a piece of code may change, and the compiler won't
even notice it.  That's also true for gcc if it uses things like the
`loadcons' macro instruction -- its length depends on the constant that
is loaded, and the value may not be known until assembly time.  The only
tool that would be able to use cjump is the assembler.  Unfortunately,
it's usually not allowed to re-order basic blocks, but only instructions
*within* a basic block.  Therefore, it can't handle page boundaries
either.

> For shared libraries, the page boundary should not be a problem because it
> is usually only the index page of the address that changes, not the offset
> due to the virtual address mapping used for sharing code in several
> different addresses.
> 
> But for object linking, it might become an obstacle if object codes are not
> mergeable at least on page boundary.

If the linker is allowed to move whole functions (atomically), that
will not be a big problem.  If a function is smaller than a page, the
linker can try to put it into a partially used page; if it doesn't fit
or is larger than a page, the linker will have to allocate new pages
and page-align the function.  The compiler will just have to specify
beginning and end of functions (that's also needed for link-time register
renaming BTW).  The problem is that we won't get so far at all.

-- 
 Michael "Tired" Riepe <Michael.Riepe@stud.uni-hannover.de>
 "All I wanna do is have a little fun before I die"
*************************************************************
To unsubscribe, send an e-mail to majordomo@seul.org with
unsubscribe f-cpu       in the body. http://f-cpu.seul.org/