Hi Lang. This patch implements the idea we previously discussed on IRC, introducing --preallocate so that we can get memory upfront and use that in small memory model tests. to It's currently unfinished because we don't keep track of FunctionMemory/DataMemory (it depends on my next review). I hope this was what you had in mind. Comments welcome.
Details
Diff Detail
Event Timeline
Hi David,
Excellent! This is exactly the kind of thing I was looking for - thank you.
What do you mean 'don't keep track of function memory / data memory' though? We may run in to issues for platforms that don't allow us to allocate RWX sections, in which case we'd have to make that distinction, but if we can get RWX memory I think we can just use one pool.
- Lang.
tools/llvm-rtdyld/llvm-rtdyld.cpp | ||
---|---|---|
193–200 ↗ | (On Diff #37045) | allocateFromSlab needs to respect the requested alignment. There's a RoundUpToAlignment function in MathExtras.h that you can use for this. |
377–384 ↗ | (On Diff #37045) | Can you add the preallocate call to linkAndVerify? We'll want it there too so we can write relocation verifier tests for the small code model. |
New patch addressing your comments. To answer your question by "not keeping track of memory" I meant that my previous patch didn't push_back allocated data/code section to {Function,Data}Memory vector. I think it was wrong, because e.g., invalidateInstructionCache wouldn't have been called on those regions. I hope my reasoning is correct.
Thanks!