jumpIfEqualsConstant

fun jumpIfEqualsConstant(registerToTest: L2ReadBoxedOperand, constantValue: A_BasicObject, passBlock: L2BasicBlock, failBlock: L2BasicBlock)

Generate a conditional branch to either passBlock or failBlock, based on whether the given register equals the given constant value.

If the constant to compare against is a boolean, check the provenance of the register. If it's the result of a suitable comparison primitive, generate a more efficient compare-and-branch instruction instead of creating the boolean only to have it compared to a boolean constant.

If the value of the boolean-producing instruction is not used, it will eventually be removed as dead code.

Parameters

registerToTest

The register whose content should be compared.

constantValue

The constant value to compare against.

passBlock

Where to go if the register's value equals the constant.

failBlock

Where to go if the register's value does not equal the constant.