File: TestMod.sil

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 (64 lines) | stat: -rw-r--r-- 2,239 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64

// Test module for the specialize_cg_update_crash.sil test.

sil_stage canonical

import Builtin

func genlibfunc<X>(x: X) -> X

func genlibfunc2<X>(x: X) -> X

func genlibfunc3<X>(x: X) -> X

class MyClass {
  init()
  func mymethod<X>(x: X) -> X
   deinit
}

sil @_TFC7TestMod7MyClassD : $@convention(method) (@owned MyClass) -> ()
sil @_TFC7TestMod7MyClasscfMS0_FT_S0_ : $@convention(method) (@owned MyClass) -> @owned MyClass

sil @_TF7TestMod11genlibfunc3urFq_q_ : $@convention(thin) <X> (@in_guaranteed X) -> @out X {
bb0(%0 : $*X, %1 : $*X):
  %4 = tuple ()
  return %4 : $()
}

sil @_TF7TestMod11genlibfunc2urFq_q_ : $@convention(thin) <X> (@in_guaranteed X) -> @out X {
bb0(%0 : $*X, %1 : $*X):
  %3 = function_ref @_TF7TestMod11genlibfunc3urFq_q_ : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out τ_0_0
  %9 = tuple ()
  return %9 : $()
}

sil @_TFC7TestMod7MyClass8mymethodurfS0_Fq_q_ : $@convention(method) <X> (@in_guaranteed X, @guaranteed MyClass) -> @out X {
bb0(%0 : $*X, %1 : $*X, %2 : $MyClass):
  %5 = function_ref @_TF7TestMod11genlibfunc3urFq_q_ : $@convention(thin) <τ_0_0> (@in_guaranteed τ_0_0) -> @out τ_0_0
  %11 = tuple ()
  return %11 : $()
}

// This is the critical function.
sil @_TF7TestMod10genlibfuncurFq_q_ : $@convention(thin) <X> (@in_guaranteed X) -> @out X {
bb0(%0 : $*X, %1 : $*X):

  // First reference the method, which lets the method be deserialized, but not processed.
  %x0 = function_ref @_TFC7TestMod7MyClass8mymethodurfS0_Fq_q_ : $@convention(method) <X> (@in_guaranteed X, @guaranteed MyClass) -> @out X

  // Then reference the metatype which reads the vtable and processes the method.
  // The bug was that during reading the vtable (and processing the vtable functions),
  // the callback (to update the CG) was lost.
  %x4 = metatype $@thick MyClass.Type

  %17 = tuple ()
  return %17 : $()
}

sil_vtable MyClass {
  #MyClass.init!initializer: @_TFC7TestMod7MyClasscfMS0_FT_S0_	// TestMod.MyClass.init (TestMod.MyClass.Type)() -> TestMod.MyClass
  #MyClass.mymethod: @_TFC7TestMod7MyClass8mymethodurfS0_Fq_q_	// TestMod.MyClass.mymethod <A> (TestMod.MyClass)(A) -> A
  #MyClass.deinit!deallocator: @_TFC7TestMod7MyClassD	// TestMod.MyClass.__deallocating_deinit
}