[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Lightning] Copying generated functions
From: |
Sandro Magi |
Subject: |
[Lightning] Copying generated functions |
Date: |
Tue, 26 Feb 2008 08:33:15 -0500 |
Ideally, a runtime system would avoid memory fragmentation, both
internal and external. I started a thread about predicting generated
code size awhile back in order to avoid memory fragmentation. Turns
out that isn't really feasible in a cross-platform manner, so what
about the converse: generating into a temporary buffer, then copying
to the final buffer once the size is known? The copy itself would be a
small fraction of the cost of code generation.
For instance, the initial buffer could be stack-allocated, then copied
to a malloc'd buffer. Cheap and easy. The only pitfalls I can think of
here, are absolute jumps within the buffer which are then invalidated
because of the reocation. Does Lightning generate such code?
Sandro
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Lightning] Copying generated functions,
Sandro Magi <=