Skip to content

Conversation

matthewhall2
Copy link
Contributor

Adds inlined isAssignableFrom test, skipping the slow helper in most cases.

Commons out superclass test and itable walk from generateInlinedCheckCastForDynamicCastClass since isAssignableFrom uses the same tests

@hzongaro hzongaro self-assigned this Sep 23, 2025
@matthewhall2 matthewhall2 force-pushed the inlined_isAssignableFrom_X branch 6 times, most recently from 81c678a to ef01e3f Compare September 29, 2025 15:46
Adds inlined isAssignableFrom test, skipping the slow helper in most cases. Signed-off-by: Matthew Hall <matthew.hall3@outlook.com>
@matthewhall2 matthewhall2 force-pushed the inlined_isAssignableFrom_X branch from ef01e3f to eb0f0cd Compare September 29, 2025 16:01
Copy link
Member

@hzongaro hzongaro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the changes look functionally correct. Just a couple of mainly cosmetic comments.

May I also ask you to change "isAssignableFrom" to "Class.isAssignableFrom" in the commit title and body, just for clarity?

One additional question: are there cases where the JIT can determine at compile-time whether the Class objects involved are array classes or interface classes? I'm just wondering how often the opportunity to eliminate any of the run-time tests arises in practice.

*/
bool supportsInliningOfIsAssignableFrom() { return false; } // no virt, default

/** \brief
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line endings check reported a trailing blank on this line.

*/
bool supportsInliningOfIsAssignableFrom();

/** \brief
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line endings check reported a trailing blank on this line.

Comment on lines +4893 to +4895
} else {
break;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just a nit, but may I suggest removing the break from the else block and dropping the else?

Comment on lines 4176 to 4177
TR::Register *temp1Reg = cg->allocateRegister();
TR::Register *temp2Reg = cg->allocateRegister();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that with this change, temp1Reg and temp2Reg are no longer used, so these two lines can be removed.

debugObj->addInstructionComment(cursor, "-->load depth of toClass");
}

// cast class depth >= obj class depth, throw
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this might be generating code in a context where failure won't throw an exception, I think "throw" here should be changed to "fail"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants