• swift class的虚函数表


    class NSObjectBase: NSObject {

        func Msg_Normal(){ }

        func Msg_Second(){}

        func Msg_Third(){}

        

        @objc func Msg_ObjcX(){}

        @objc dynamic func Msg_Objc_DynamicX(){ }

        

        func callTest(){self.Msg_Normal()}

        func callAgain(){self.Msg_Third()}

    }

    extension NSObjectBase{

        @objc func OcExtensionFunc(){}

    }

    class DerivedOcClass:NSObjectBase{

        override func Msg_Normal() {}

        override func OcExtensionFunc(){}

        override func Msg_Objc_DynamicX() {}

    }

    swiftc -emit-sil BaseClass.swift | xcrun swift-demangle > ClassFunc.silgen

    cat ClassFunc.silgen

    class NSObjectBase : NSObject {

      func Msg_Normal()

      func Msg_Second()

      func Msg_Third()

      @objc func Msg_ObjcX()

      @objc dynamic func Msg_Objc_DynamicX()

      func callTest()

      func callAgain()

    }

    extension NSObjectBase {

      @objc dynamic func OcExtensionFunc()

    }

    class DerivedOcClass : NSObjectBase {

      override func Msg_Normal()

      override dynamic func OcExtensionFunc()

      override dynamic func Msg_Objc_DynamicX()

    }

    sil_vtable NSObjectBase {

      #NSObjectBase.Msg_Normal!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.Msg_Normal() -> () // NSObjectBase.Msg_Normal()

      #NSObjectBase.Msg_Second!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.Msg_Second() -> () // NSObjectBase.Msg_Second()

      #NSObjectBase.Msg_Third!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.Msg_Third() -> () // NSObjectBase.Msg_Third()

      #NSObjectBase.Msg_ObjcX!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.Msg_ObjcX() -> () // NSObjectBase.Msg_ObjcX()

      #NSObjectBase.callTest!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.callTest() -> () // NSObjectBase.callTest()

      #NSObjectBase.callAgain!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.callAgain() -> () // NSObjectBase.callAgain()

    }

    sil_vtable DerivedOcClass {

      #NSObjectBase.Msg_Normal!1: (NSObjectBase) -> () -> () : @NSObjectBase.DerivedOcClass.Msg_Normal() -> () [override] // DerivedOcClass.Msg_Normal()

      #NSObjectBase.Msg_Second!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.Msg_Second() -> () [inherited] // NSObjectBase.Msg_Second()

      #NSObjectBase.Msg_Third!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.Msg_Third() -> () [inherited] // NSObjectBase.Msg_Third()

      #NSObjectBase.Msg_ObjcX!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.Msg_ObjcX() -> () [inherited] // NSObjectBase.Msg_ObjcX()

      #NSObjectBase.callTest!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.callTest() -> () [inherited] // NSObjectBase.callTest()

      #NSObjectBase.callAgain!1: (NSObjectBase) -> () -> () : @NSObjectBase.NSObjectBase.callAgain() -> () [inherited] // NSObjectBase.callAgain()

    }

    class BaseClass {

        func NormalFunc(){}

        @objc func ObjcFunc(){}

        @objc dynamic func ObjcDynamicFunc(){}

    }

    extension BaseClass{

        @objc func ExtensionNormal(){}

        func ExtenNoneOcNormal(){}

    }

    class DerivedClass:BaseClass{

        override func NormalFunc() {}

        override func ObjcFunc(){}

        override func ObjcDynamicFunc(){}

        override func ExtensionNormal(){}

    }

    extension DerivedClass{}

    class BaseClass {

      func NormalFunc()

      @objc func ObjcFunc()

      @objc dynamic func ObjcDynamicFunc()

      init()

      deinit

    }

    extension BaseClass {

      @objc dynamic func ExtensionNormal()

      func ExtenNoneOcNormal()

    }

    class DerivedClass : BaseClass {

      override func NormalFunc()

      override func ObjcFunc()

      override dynamic func ObjcDynamicFunc()

      override dynamic func ExtensionNormal()

      override init()

      deinit

    }

    sil_vtable BaseClass {

      #BaseClass.NormalFunc!1: (BaseClass) -> () -> () : @BaseClass.BaseClass.NormalFunc() -> () // BaseClass.NormalFunc()

      #BaseClass.ObjcFunc!1: (BaseClass) -> () -> () : @BaseClass.BaseClass.ObjcFunc() -> () // BaseClass.ObjcFunc()

    }

    sil_vtable DerivedClass {

      #BaseClass.NormalFunc!1: (BaseClass) -> () -> () : @BaseClass.DerivedClass.NormalFunc() -> () [override] // DerivedClass.NormalFunc()

      #BaseClass.ObjcFunc!1: (BaseClass) -> () -> () : @BaseClass.DerivedClass.ObjcFunc() -> () [override] // DerivedClass.ObjcFunc()

    }

  • 相关阅读:
    mysql总结
    JVM入门_笔记_狂神说
    spring-与事务管理相关的工具类
    spring-获取连接的工具类
    浏览器调试之 实时更新 browser-sync
    Git: 版本控件
    Visual Studio Code 自定义快捷键,自动生成.vue文件
    Markdown基本语法
    Node.js 平台-服务器 之 Express
    chrome插件之 vue devtools
  • 原文地址:https://www.cnblogs.com/feng9exe/p/10564955.html
Copyright © 2020-2023  润新知