opalj / opal

https://www.opal-project.de
Other
51 stars 27 forks source link

Naive TA Code Computational Type Generation #144

Closed kevzhumba closed 1 year ago

kevzhumba commented 1 year ago

Hi Opal team,

I was curious as to why during Naive TAC generation, for GETFIELD and GETSTATIC instructions, the computational type of the assigned variable is always a reference type. It seems like the computational type could be determined by the field type included in the instruction. Specifically the code shown below:

case GETFIELD.opcode =>
      val objRef :: rest = stack
      val GETFIELD(declaringClass, name, fieldType) = instruction
      val getField = GetField(pc, declaringClass, name, fieldType, objRef)
      val newVal = OperandVar(ComputationalTypeReference, rest)
      statements(pc) = List(Assignment(pc, newVal, getField))
      schedule(pcOfNextInstruction(pc), newVal :: rest)

Thanks!

Delors commented 1 year ago

Hi, I would say you seem to be right and actually, I would say it is even wrong this way. However, I'm currently not involved in the project, but I will talk to my colleagues.

errt commented 1 year ago

Thanks for reporting, this is fixed now.