Fix spilling algorithm for double-sized coroutine parameters
This commit is contained in:
@@ -135,12 +135,15 @@ class CoroutineCodegen(
|
||||
with(codegen.v) {
|
||||
setLabelValue(LABEL_VALUE_BEFORE_FIRST_SUSPENSION)
|
||||
|
||||
// Save lambda parameters to fields
|
||||
// 0 - this
|
||||
// 1 - controller
|
||||
var index = 2
|
||||
for (parameter in funDescriptor.valueParameters) {
|
||||
// 0 - this
|
||||
// 1 - controller
|
||||
val parametersIndexShift = 2
|
||||
val fieldInfoForCoroutineLambdaParameter = parameter.getFieldInfoForCoroutineLambdaParameter()
|
||||
AsmUtil.genAssignInstanceFieldFromParam(
|
||||
parameter.getFieldInfoForCoroutineLambdaParameter(), parametersIndexShift + parameter.index, this)
|
||||
fieldInfoForCoroutineLambdaParameter, index, this)
|
||||
index += fieldInfoForCoroutineLambdaParameter.fieldType.size
|
||||
}
|
||||
|
||||
load(0, AsmTypes.OBJECT_TYPE)
|
||||
|
||||
@@ -4,8 +4,8 @@ class Controller {
|
||||
}
|
||||
}
|
||||
|
||||
fun builder(coroutine c: Controller.(String, Int) -> Continuation<Unit>) {
|
||||
c(Controller(), "OK", 56).resume(Unit)
|
||||
fun builder(coroutine c: Controller.(Long, String) -> Continuation<Unit>) {
|
||||
c(Controller(), 56L, "OK").resume(Unit)
|
||||
}
|
||||
|
||||
fun noinline(l: () -> String) = l()
|
||||
@@ -14,23 +14,23 @@ inline fun inline(l: () -> String) = l()
|
||||
fun box(): String {
|
||||
var result = ""
|
||||
|
||||
builder { s, i ->
|
||||
result = suspendHere(s + "#" + i)
|
||||
builder { l, s ->
|
||||
result = suspendHere(s + "#" + l)
|
||||
}
|
||||
|
||||
if (result != "OK#56") return "fail 1: $result"
|
||||
|
||||
builder { s, i ->
|
||||
builder { l, s ->
|
||||
result = suspendHere(noinline {
|
||||
s + "#" + i
|
||||
s + "#" + l
|
||||
})
|
||||
}
|
||||
|
||||
if (result != "OK#56") return "fail 2: $result"
|
||||
|
||||
builder { s, i ->
|
||||
builder { l, s ->
|
||||
result = suspendHere(inline {
|
||||
s + "#" + i
|
||||
s + "#" + l
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user