PerformInvocations doesn't handle computational types properly

Issue #30 resolved
Frederik Buss-Joraschek created an issue

When having a type with a ComputationalType of Category 2, the initialization of the AI is wrong.

In PerformInvocations.invokestatic replace:

        val parameters = operands.view.reverse.zipWithIndex.map { operand_index 
            val (operand, index) = operand_index
            operand.adapt(executionHandler.domain, -(index + 1))
        }.toArray(executionHandler.domain.DomainValueTag)

with

        val parameters = executionHandler.domain.DomainValueTag.newArray(method.body.get.maxLocals)
        var localVariableIndex = 0
        for (operand_index <- operands.view.reverse.zipWithIndex) {
                val (operand, index) = operand_index
                val ct = operand.computationalType
                val adaptedOperand =  operand.adapt(executionHandler.domain, -(index + 1))
                parameters.update(localVariableIndex, adaptedOperand)
                localVariableIndex += ct.operandSize
            }

(based on the implementation of AI.initialLocals)

Comments (2)

  1. Log in to comment