mirror of
https://github.com/corda/corda.git
synced 2025-06-19 15:43:52 +00:00
handle methods ending with large blocks properly when generating constant pools
We can only omit the jump past a constant pool if it's placed at the end of a method, which is only true if the pool belongs to the last block of that method and that block is not so large that the pool must be placed inside the block instead of after it.
This commit is contained in:
12
src/arm.cpp
12
src/arm.cpp
@ -664,13 +664,19 @@ appendPoolEvent(Context* c, MyBlock* b, unsigned offset, PoolOffset* head,
|
|||||||
b->poolEventTail = e;
|
b->poolEventTail = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
needJump(MyBlock* b)
|
||||||
|
{
|
||||||
|
return b->next or b->size != (b->size & PoolOffsetMask);
|
||||||
|
}
|
||||||
|
|
||||||
unsigned
|
unsigned
|
||||||
padding(MyBlock* b, unsigned offset)
|
padding(MyBlock* b, unsigned offset)
|
||||||
{
|
{
|
||||||
unsigned total = 0;
|
unsigned total = 0;
|
||||||
for (PoolEvent* e = b->poolEventHead; e; e = e->next) {
|
for (PoolEvent* e = b->poolEventHead; e; e = e->next) {
|
||||||
if (e->offset <= offset) {
|
if (e->offset <= offset) {
|
||||||
if (b->next) {
|
if (needJump(b)) {
|
||||||
total += BytesPerWord;
|
total += BytesPerWord;
|
||||||
}
|
}
|
||||||
for (PoolOffset* o = e->poolOffsetHead; o; o = o->next) {
|
for (PoolOffset* o = e->poolOffsetHead; o; o = o->next) {
|
||||||
@ -2363,7 +2369,7 @@ class MyAssembler: public Assembler {
|
|||||||
|
|
||||||
unsigned entry = dstOffset + poolSize;
|
unsigned entry = dstOffset + poolSize;
|
||||||
|
|
||||||
if (b->next) {
|
if (needJump(b)) {
|
||||||
entry += BytesPerWord;
|
entry += BytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2381,7 +2387,7 @@ class MyAssembler: public Assembler {
|
|||||||
poolSize += BytesPerWord;
|
poolSize += BytesPerWord;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->next) {
|
if (needJump(b)) {
|
||||||
write4(dst + dstOffset, ::b((poolSize + BytesPerWord - 8) >> 2));
|
write4(dst + dstOffset, ::b((poolSize + BytesPerWord - 8) >> 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user