Skip to content

Commit

Permalink
InvokeInterface now handled properly in 'freeze'
Browse files Browse the repository at this point in the history
pradeepk authored and psuter committed Jul 19, 2012

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 0402f5e commit 03c8788
Showing 2 changed files with 18 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/scala/cafebabe/CodeHandler.scala
Original file line number Diff line number Diff line change
@@ -189,6 +189,20 @@ class CodeHandler private[cafebabe](c: CodeAttributeInfo, cp: ConstantPool, val
}
case _ => sys.error("Expected RawBytes after INVOKEVIRTUAL/INVOKESPECIAL.")
}
case INVOKEINTERFACE => codeArray(pc+1) match {
case RawBytes(idx) => codeArray(pc+3) match {
case RawByte(n) => {
val se = constantPool.getMethodEffect(idx)
codeArray(pc+4) match {
case RawByte(0) => setHeight(from + 5, there + se - 1)
case _ => sys.error("Expected RawByte(0) as the last param for INVOKEINTERFACE")
}
}
case b => sys.error("Expected RawByte after the RawBytes in INVOKEINTERFACE @ " + pc + " ; found: " + b)

}
case _ => sys.error("Expected RawBytes after INVOKEINTERFACE.")
}
case INVOKESTATIC => codeArray(pc+1) match {
case RawBytes(idx) => {
val se = constantPool.getMethodEffect(idx)
4 changes: 4 additions & 0 deletions src/main/scala/cafebabe/ConstantPool.scala
Original file line number Diff line number Diff line change
@@ -152,6 +152,10 @@ class ConstantPool extends Streamable {
val strDesc: String = entryAt(entryAt(natid).asInstanceOf[CPNameAndTypeInfo].descriptorIndex).asInstanceOf[CPUtf8Info].getSource
methodSignatureToStackEffect(strDesc)
}
case CPInterfaceMethodRefInfo(_, natid) => {
val strDesc: String = entryAt(entryAt(natid).asInstanceOf[CPNameAndTypeInfo].descriptorIndex).asInstanceOf[CPUtf8Info].getSource
methodSignatureToStackEffect(strDesc)
}
case _ => sys.error("getMethodEffect: no method ref info at given index.")
}

0 comments on commit 03c8788

Please sign in to comment.