All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opalj.br.instructions.JSRInstruction.scala Maven / Gradle / Ivy

The newest version!
/* BSD 2-Clause License - see OPAL/LICENSE for details. */
package org.opalj
package br
package instructions

/**
 * Jump subroutine.
 *
 * @author Michael Eichberg
 */
trait JSRInstructionLike extends UnconditionalBranchInstructionLike {

    final def numberOfPushedOperands(ctg: Int => ComputationalTypeCategory): Int = 1

    final def stackSlotsChange: Int = 1
}

trait JSRInstruction extends UnconditionalBranchInstruction with JSRInstructionLike {

    final override def isIsomorphic(thisPC: PC, thatPC: PC)(implicit code: Code): Boolean = {
        val that = code.instructions(thatPC)
        (this eq that) || (
            that match {
                case that: JSRInstruction => thisPC + this.branchoffset == thatPC + that.branchoffset
                case _                    => false
            }
        )
    }
}

object JSRInstruction {

    def unapply(i: JSRInstruction): Some[Int] = Some(i.branchoffset)

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy