JVM: use various Interpreter.new* methods in FastMethodAnalyzer
These allow e.g. specifying different values for parameters depending on their indices.
This commit is contained in:
+12
-8
@@ -132,7 +132,7 @@ open class FastMethodAnalyzer<V : Value>
|
|||||||
|
|
||||||
handler.init(f)
|
handler.init(f)
|
||||||
handler.clearStack()
|
handler.clearStack()
|
||||||
handler.push(interpreter.newValue(exnType))
|
handler.push(interpreter.newExceptionValue(tcb, handler, exnType))
|
||||||
mergeControlFlowEdge(jump, handler)
|
mergeControlFlowEdge(jump, handler)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -157,21 +157,25 @@ open class FastMethodAnalyzer<V : Value>
|
|||||||
}
|
}
|
||||||
|
|
||||||
internal fun initLocals(current: Frame<V>) {
|
internal fun initLocals(current: Frame<V>) {
|
||||||
current.setReturn(interpreter.newValue(Type.getReturnType(method.desc)))
|
current.setReturn(interpreter.newReturnTypeValue(Type.getReturnType(method.desc)))
|
||||||
val args = Type.getArgumentTypes(method.desc)
|
val args = Type.getArgumentTypes(method.desc)
|
||||||
var local = 0
|
var local = 0
|
||||||
if ((method.access and Opcodes.ACC_STATIC) == 0) {
|
val isInstanceMethod = (method.access and Opcodes.ACC_STATIC) == 0
|
||||||
val ctype = Type.getObjectType(owner)
|
if (isInstanceMethod) {
|
||||||
current.setLocal(local++, interpreter.newValue(ctype))
|
current.setLocal(local, interpreter.newParameterValue(true, local, Type.getObjectType(owner)))
|
||||||
|
local++
|
||||||
}
|
}
|
||||||
for (arg in args) {
|
for (arg in args) {
|
||||||
current.setLocal(local++, interpreter.newValue(arg))
|
current.setLocal(local, interpreter.newParameterValue(isInstanceMethod, local, arg))
|
||||||
|
local++
|
||||||
if (arg.size == 2) {
|
if (arg.size == 2) {
|
||||||
current.setLocal(local++, interpreter.newValue(null))
|
current.setLocal(local, interpreter.newEmptyValue(local))
|
||||||
|
local++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (local < method.maxLocals) {
|
while (local < method.maxLocals) {
|
||||||
current.setLocal(local++, interpreter.newValue(null))
|
current.setLocal(local, interpreter.newEmptyValue(local))
|
||||||
|
local++
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user