File: vtable_thunks_reabstraction_modify.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (39 lines) | stat: -rw-r--r-- 1,729 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
// RUN: %target-swift-frontend -emit-ir %s

public class BaseClass<Input, Result> {
  var callback: (Input) -> Result

  init(callback: @escaping (Input) -> Result) {
    self.callback = callback
  }
}

public class DerivedClass<Result> : BaseClass<Int, Result> {
  override var callback: (Int) -> Result {
    didSet {}
  }
}

// CHECK-LABEL: sil private [thunk] [ossa] @$s34vtable_thunks_reabstraction_modify12DerivedClassC8callbackyxSicvMAA04BaseF0CADyq_xcvMTV :
// CHECK: [[DERIVED:%.*]] = function_ref @$s34vtable_thunks_reabstraction_modify12DerivedClassC8callbackyxSicvM :
// CHECK: ([[RESULT_BUF:%.*]], [[TOKEN:%.*]]) = begin_apply [[DERIVED]]<τ_0_0>(%0) :
// CHECK: [[OUTER_RESULT_BUF:%.*]] = alloc_stack
// CHECK: [[RESULT:%.*]] = load [take] [[RESULT_BUF]] :
// CHECK: [[RESULT_CONV:%.*]] = convert_function [[RESULT]]
// CHECK: [[THUNK_FN:%.*]] = function_ref @$sSixIegyr_SixIegnr_lTR :
// CHECK: [[THUNK:%.*]] = partial_apply [callee_guaranteed] [[THUNK_FN]]<τ_0_0>([[RESULT_CONV]]) :
// CHECK: [[THUNK_CONV:%.*]] = convert_function [[THUNK]]
// CHECK: store [[THUNK_CONV]] to [init] [[OUTER_RESULT_BUF]] :
// CHECK: yield [[OUTER_RESULT_BUF]] :

// CHECK: bb1:
// CHECK: [[MODIFIED:%.*]] = load [take] [[OUTER_RESULT_BUF]] :
// CHECK: [[MOD_CONV:%.*]] = convert_function [[MODIFIED]]
// CHECK: [[THUNK_FN:%.*]] = function_ref @$sSixIegnr_SixIegyr_lTR :
// CHECK: [[THUNK:%.*]] = partial_apply [callee_guaranteed] [[THUNK_FN]]<τ_0_0>([[MOD_CONV]]) :
// CHECK: [[THUNK_CONV:%.*]] = convert_function [[THUNK]]
// CHECK: store [[THUNK_CONV]] to [init] [[RESULT_BUF]] :
// CHECK: dealloc_stack [[OUTER_RESULT_BUF]] :
// CHECK: end_apply [[TOKEN]]
// CHECK: return