Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows on ARM64: Support Visual Studio ABI sret mechanism for non-trivial data types #289

Merged
merged 9 commits into from Apr 26, 2024

Conversation

hmelder
Copy link
Collaborator

@hmelder hmelder commented Apr 13, 2024

The current implementation inaccurately handles sret for types that are not passed via registers by assuming that the caller always places a pointer to the memory block in register x8.

According to the correct convention, the caller should allocate a memory block of adequate size and alignment for the result. For POD types, the memory address should be passed in register x8, and for non-POD types, in register x0.

Clang generates an objc_msgSend_sret call for return types marked with sret, including non-trivial types tagged as inreg on ARM64 Windows. To preserve compatibility with existing behaviors, we cannot modify objc_msgSend_sret.

Instead, I propose introducing a new function, objc_msgSend_sret2_np, which expects the receiver in register x1 and the selector in register x2, to handle these cases properly.

In clang, we check for the inreg tag to be present and choose the new function over objc_msgSend_sret.

This issue has been documented and is being tracked in the llvm-project repository under issue #88273.

@hmelder
Copy link
Collaborator Author

hmelder commented Apr 13, 2024

Unit Test Results

Windows

WindowsBuildLabEx                                       : 22621.1.arm64fre.ni_release.220506-1250
OSDisplayVersion                                        : 23H2
OsName                                                  : Microsoft Windows 11 Pro
OsType                                                  : WINNT
OsVersion                                               : 10.0.22631
Windows ARM64: Unit Test Results
ninja: Entering directory `build'
[0/1] Running tests...Test project C:/Users/hugo/Documents/libobjc2/build
        Start   1: alias
  1/104 Test   #1: alias ......................................   Passed    0.09 sec
        Start   2: alias_optimised
  2/104 Test   #2: alias_optimised ............................   Passed    0.06 sec
        Start   3: alignTest
  3/104 Test   #3: alignTest ..................................   Passed    0.08 sec
        Start   4: alignTest_optimised
  4/104 Test   #4: alignTest_optimised ........................   Passed    0.07 sec
        Start   5: AllocatePair
  5/104 Test   #5: AllocatePair ...............................   Passed    0.08 sec
        Start   6: AllocatePair_optimised
  6/104 Test   #6: AllocatePair_optimised .....................   Passed    0.10 sec
        Start   7: AssociatedObject
  7/104 Test   #7: AssociatedObject ...........................   Passed    0.08 sec
        Start   8: AssociatedObject_optimised
  8/104 Test   #8: AssociatedObject_optimised .................   Passed    0.11 sec
        Start   9: AssociatedObject2
  9/104 Test   #9: AssociatedObject2 ..........................   Passed    0.08 sec
        Start  10: AssociatedObject2_optimised
 10/104 Test  #10: AssociatedObject2_optimised ................   Passed    0.08 sec
        Start  11: BlockImpTest
 11/104 Test  #11: BlockImpTest ...............................   Passed    0.09 sec
        Start  12: BlockImpTest_optimised
 12/104 Test  #12: BlockImpTest_optimised .....................   Passed    0.08 sec
        Start  13: BlockTest_arc
 13/104 Test  #13: BlockTest_arc ..............................   Passed    0.09 sec
        Start  14: BlockTest_arc_optimised
 14/104 Test  #14: BlockTest_arc_optimised ....................   Passed    0.09 sec
        Start  15: ConstantString
 15/104 Test  #15: ConstantString .............................   Passed    0.08 sec
        Start  16: ConstantString_optimised
 16/104 Test  #16: ConstantString_optimised ...................   Passed    0.06 sec
        Start  17: Category
 17/104 Test  #17: Category ...................................   Passed    0.09 sec
        Start  18: Category_optimised
 18/104 Test  #18: Category_optimised .........................   Passed    0.07 sec
        Start  19: ExceptionTest
 19/104 Test  #19: ExceptionTest ..............................   Passed    0.07 sec
        Start  20: ExceptionTest_optimised
 20/104 Test  #20: ExceptionTest_optimised ....................   Passed    0.07 sec
        Start  21: FastARC
 21/104 Test  #21: FastARC ....................................   Passed    0.08 sec
        Start  22: FastARC_optimised
 22/104 Test  #22: FastARC_optimised ..........................   Passed    0.08 sec
        Start  23: FastARCPool
 23/104 Test  #23: FastARCPool ................................   Passed    0.10 sec
        Start  24: FastARCPool_optimised
 24/104 Test  #24: FastARCPool_optimised ......................   Passed    0.08 sec
        Start  25: FastRefCount
 25/104 Test  #25: FastRefCount ...............................   Passed    0.09 sec
        Start  26: FastRefCount_optimised
 26/104 Test  #26: FastRefCount_optimised .....................   Passed    0.10 sec
        Start  27: Forward
 27/104 Test  #27: Forward ....................................   Passed    0.08 sec
        Start  28: Forward_optimised
 28/104 Test  #28: Forward_optimised ..........................   Passed    0.10 sec
        Start  29: ManyManySelectors
 29/104 Test  #29: ManyManySelectors ..........................   Passed    3.02 sec
        Start  30: ManyManySelectors_optimised
 30/104 Test  #30: ManyManySelectors_optimised ................   Passed    2.92 sec
        Start  31: NestedExceptions
 31/104 Test  #31: NestedExceptions ...........................   Passed    0.06 sec
        Start  32: NestedExceptions_optimised
 32/104 Test  #32: NestedExceptions_optimised .................   Passed    0.08 sec
        Start  33: PropertyAttributeTest
 33/104 Test  #33: PropertyAttributeTest ......................   Passed    0.07 sec
        Start  34: PropertyAttributeTest_optimised
 34/104 Test  #34: PropertyAttributeTest_optimised ............   Passed    0.08 sec
        Start  35: ProtocolExtendedProperties
 35/104 Test  #35: ProtocolExtendedProperties .................   Passed    0.11 sec
        Start  36: ProtocolExtendedProperties_optimised
 36/104 Test  #36: ProtocolExtendedProperties_optimised .......   Passed    0.11 sec
        Start  37: PropertyIntrospectionTest
 37/104 Test  #37: PropertyIntrospectionTest ..................   Passed    0.07 sec
        Start  38: PropertyIntrospectionTest_optimised
 38/104 Test  #38: PropertyIntrospectionTest_optimised ........   Passed    0.07 sec
        Start  39: ProtocolCreation
 39/104 Test  #39: ProtocolCreation ...........................   Passed    0.07 sec
        Start  40: ProtocolCreation_optimised
 40/104 Test  #40: ProtocolCreation_optimised .................   Passed    0.11 sec
        Start  41: ResurrectInDealloc_arc
 41/104 Test  #41: ResurrectInDealloc_arc .....................   Passed    0.08 sec
        Start  42: ResurrectInDealloc_arc_optimised
 42/104 Test  #42: ResurrectInDealloc_arc_optimised ...........   Passed    0.08 sec
        Start  43: RuntimeTest
 43/104 Test  #43: RuntimeTest ................................   Passed    0.09 sec
        Start  44: RuntimeTest_optimised
 44/104 Test  #44: RuntimeTest_optimised ......................   Passed    0.07 sec
        Start  45: SuperMethodMissing
 45/104 Test  #45: SuperMethodMissing .........................   Passed    0.08 sec
        Start  46: SuperMethodMissing_optimised
 46/104 Test  #46: SuperMethodMissing_optimised ...............   Passed    0.08 sec
        Start  47: WeakBlock_arc
 47/104 Test  #47: WeakBlock_arc ..............................   Passed    0.07 sec
        Start  48: WeakBlock_arc_optimised
 48/104 Test  #48: WeakBlock_arc_optimised ....................   Passed    0.09 sec
        Start  49: WeakRefLoad
 49/104 Test  #49: WeakRefLoad ................................   Passed    0.08 sec
        Start  50: WeakRefLoad_optimised
 50/104 Test  #50: WeakRefLoad_optimised ......................   Passed    0.09 sec
        Start  51: WeakReferences_arc
 51/104 Test  #51: WeakReferences_arc .........................   Passed    1.54 sec
        Start  52: WeakReferences_arc_optimised
 52/104 Test  #52: WeakReferences_arc_optimised ...............   Passed    1.40 sec
        Start  53: WeakImportClass
 53/104 Test  #53: WeakImportClass ............................   Passed    0.06 sec
        Start  54: WeakImportClass_optimised
 54/104 Test  #54: WeakImportClass_optimised ..................   Passed    0.07 sec
        Start  55: ivar_arc
 55/104 Test  #55: ivar_arc ...................................   Passed    0.07 sec
        Start  56: ivar_arc_optimised
 56/104 Test  #56: ivar_arc_optimised .........................   Passed    0.08 sec
        Start  57: ivar_atomic
 57/104 Test  #57: ivar_atomic ................................   Passed    0.07 sec
        Start  58: ivar_atomic_optimised
 58/104 Test  #58: ivar_atomic_optimised ......................   Passed    0.07 sec
        Start  59: IVarOverlap
 59/104 Test  #59: IVarOverlap ................................   Passed    0.07 sec
        Start  60: IVarOverlap_optimised
 60/104 Test  #60: IVarOverlap_optimised ......................   Passed    0.07 sec
        Start  61: IVarSuperclassOverlap
 61/104 Test  #61: IVarSuperclassOverlap ......................   Passed    0.07 sec
        Start  62: IVarSuperclassOverlap_optimised
 62/104 Test  #62: IVarSuperclassOverlap_optimised ............   Passed    0.07 sec
        Start  63: objc_msgSend
 63/104 Test  #63: objc_msgSend ...............................   Passed    0.09 sec
        Start  64: objc_msgSend_optimised
 64/104 Test  #64: objc_msgSend_optimised .....................   Passed    0.07 sec
        Start  65: msgInterpose
 65/104 Test  #65: msgInterpose ...............................   Passed    0.08 sec
        Start  66: msgInterpose_optimised
 66/104 Test  #66: msgInterpose_optimised .....................   Passed    0.11 sec
        Start  67: NilException
 67/104 Test  #67: NilException ...............................   Passed    0.08 sec
        Start  68: NilException_optimised
 68/104 Test  #68: NilException_optimised .....................   Passed    0.08 sec
        Start  69: MethodArguments
 69/104 Test  #69: MethodArguments ............................   Passed    0.08 sec
        Start  70: MethodArguments_optimised
 70/104 Test  #70: MethodArguments_optimised ..................   Passed    0.07 sec
        Start  71: zeroSizedIVar
 71/104 Test  #71: zeroSizedIVar ..............................   Passed    0.09 sec
        Start  72: zeroSizedIVar_optimised
 72/104 Test  #72: zeroSizedIVar_optimised ....................   Passed    0.08 sec
        Start  73: exchange
 73/104 Test  #73: exchange ...................................   Passed    0.07 sec
        Start  74: exchange_optimised
 74/104 Test  #74: exchange_optimised .........................   Passed    0.08 sec
        Start  75: hash_table_delete
 75/104 Test  #75: hash_table_delete ..........................   Passed    0.07 sec
        Start  76: hash_table_delete_optimised
 76/104 Test  #76: hash_table_delete_optimised ................   Passed    0.08 sec
        Start  77: hash_test
 77/104 Test  #77: hash_test ..................................   Passed    1.86 sec
        Start  78: hash_test_optimised
 78/104 Test  #78: hash_test_optimised ........................   Passed    0.25 sec
        Start  79: setSuperclass
 79/104 Test  #79: setSuperclass ..............................   Passed    0.06 sec
        Start  80: setSuperclass_optimised
 80/104 Test  #80: setSuperclass_optimised ....................   Passed    0.07 sec
        Start  81: UnexpectedException
 81/104 Test  #81: UnexpectedException ........................***Skipped   0.07 sec
        Start  82: UnexpectedException_optimised
 82/104 Test  #82: UnexpectedException_optimised ..............***Skipped   0.08 sec
        Start  83: objc_msgSend_WoA64
 83/104 Test  #83: objc_msgSend_WoA64 .........................   Passed    0.08 sec
        Start  84: objc_msgSend_WoA64_optimised
 84/104 Test  #84: objc_msgSend_WoA64_optimised ...............   Passed    0.07 sec
        Start  85: ARCTest_arc
 85/104 Test  #85: ARCTest_arc ................................   Passed    0.08 sec
        Start  86: ARCTest_arc_optimised
 86/104 Test  #86: ARCTest_arc_optimised ......................   Passed    0.07 sec
        Start  87: PropertyIntrospectionTest2_arc
 87/104 Test  #87: PropertyIntrospectionTest2_arc .............   Passed    0.07 sec
        Start  88: PropertyIntrospectionTest2_arc_optimised
 88/104 Test  #88: PropertyIntrospectionTest2_arc_optimised ...   Passed    0.08 sec
        Start  89: category_properties
 89/104 Test  #89: category_properties ........................   Passed    0.08 sec
        Start  90: category_properties_optimised
 90/104 Test  #90: category_properties_optimised ..............   Passed    0.06 sec
        Start  91: DirectMethods
 91/104 Test  #91: DirectMethods ..............................   Passed    0.08 sec
        Start  92: DirectMethods_optimised
 92/104 Test  #92: DirectMethods_optimised ....................   Passed    0.07 sec
        Start  93: FastPathAlloc
 93/104 Test  #93: FastPathAlloc ..............................   Passed    0.07 sec
        Start  94: FastPathAlloc_optimised
 94/104 Test  #94: FastPathAlloc_optimised ....................   Passed    0.07 sec
        Start  95: CXXExceptions
 95/104 Test  #95: CXXExceptions ..............................   Passed    0.07 sec
        Start  96: CXXExceptions_optimised
 96/104 Test  #96: CXXExceptions_optimised ....................   Passed    0.07 sec
        Start  97: ForwardDeclareProtocolAccess
 97/104 Test  #97: ForwardDeclareProtocolAccess ...............   Passed    0.07 sec
        Start  98: ForwardDeclareProtocolAccess_optimised
 98/104 Test  #98: ForwardDeclareProtocolAccess_optimised .....   Passed    0.07 sec
        Start  99: ObjCXXEHInterop
 99/104 Test  #99: ObjCXXEHInterop ............................   Passed    0.06 sec
        Start 100: ObjCXXEHInterop_optimised
100/104 Test #100: ObjCXXEHInterop_optimised ..................   Passed    0.07 sec
        Start 101: ObjCXXEHInteropTwice
101/104 Test #101: ObjCXXEHInteropTwice .......................   Passed    0.06 sec
        Start 102: ObjCXXEHInteropTwice_optimised
102/104 Test #102: ObjCXXEHInteropTwice_optimised .............   Passed    0.07 sec
        Start 103: ObjCXXEHInterop_arc
103/104 Test #103: ObjCXXEHInterop_arc ........................   Passed    0.08 sec
        Start 104: ObjCXXEHInterop_arc_optimised
104/104 Test #104: ObjCXXEHInterop_arc_optimised ..............   Passed    0.07 sec

100% tests passed, 0 tests failed out of 104

Total Test time (real) =  18.93 sec

The following tests did not run:
         81 - UnexpectedException (Skipped)
         82 - UnexpectedException_optimised (Skipped)
   
C:\Users\hugo\Documents\libobjc2>

Linux

Ubuntu 23.10 (Mantic Minotaur) aarch64: Unit Tests
hmelder@ubuntu:/Users/hmelder/libobjc2$ ninja -C build test
ninja: Entering directory `build'
[0/1] Running tests...
Test project /Users/hmelder/libobjc2/build
        Start   1: alias
  1/190 Test   #1: alias ...........................................   Passed    0.01 sec
        Start   2: alias_optimised
  2/190 Test   #2: alias_optimised .................................   Passed    0.00 sec
        Start   3: alias_legacy
  3/190 Test   #3: alias_legacy ....................................   Passed    0.00 sec
        Start   4: alias_legacy_optimised
  4/190 Test   #4: alias_legacy_optimised ..........................   Passed    0.00 sec
        Start   5: alignTest
  5/190 Test   #5: alignTest .......................................   Passed    0.00 sec
        Start   6: alignTest_optimised
  6/190 Test   #6: alignTest_optimised .............................   Passed    0.00 sec
        Start   7: alignTest_legacy
  7/190 Test   #7: alignTest_legacy ................................   Passed    0.00 sec
        Start   8: alignTest_legacy_optimised
  8/190 Test   #8: alignTest_legacy_optimised ......................   Passed    0.00 sec
        Start   9: AllocatePair
  9/190 Test   #9: AllocatePair ....................................   Passed    0.00 sec
        Start  10: AllocatePair_optimised
 10/190 Test  #10: AllocatePair_optimised ..........................   Passed    0.00 sec
        Start  11: AllocatePair_legacy
 11/190 Test  #11: AllocatePair_legacy .............................   Passed    0.00 sec
        Start  12: AllocatePair_legacy_optimised
 12/190 Test  #12: AllocatePair_legacy_optimised ...................   Passed    0.00 sec
        Start  13: AssociatedObject
 13/190 Test  #13: AssociatedObject ................................   Passed    0.00 sec
        Start  14: AssociatedObject_optimised
 14/190 Test  #14: AssociatedObject_optimised ......................   Passed    0.00 sec
        Start  15: AssociatedObject_legacy
 15/190 Test  #15: AssociatedObject_legacy .........................   Passed    0.00 sec
        Start  16: AssociatedObject_legacy_optimised
 16/190 Test  #16: AssociatedObject_legacy_optimised ...............   Passed    0.00 sec
        Start  17: AssociatedObject2
 17/190 Test  #17: AssociatedObject2 ...............................   Passed    0.00 sec
        Start  18: AssociatedObject2_optimised
 18/190 Test  #18: AssociatedObject2_optimised .....................   Passed    0.00 sec
        Start  19: AssociatedObject2_legacy
 19/190 Test  #19: AssociatedObject2_legacy ........................   Passed    0.00 sec
        Start  20: AssociatedObject2_legacy_optimised
 20/190 Test  #20: AssociatedObject2_legacy_optimised ..............   Passed    0.00 sec
        Start  21: BlockImpTest
 21/190 Test  #21: BlockImpTest ....................................   Passed    0.00 sec
        Start  22: BlockImpTest_optimised
 22/190 Test  #22: BlockImpTest_optimised ..........................   Passed    0.00 sec
        Start  23: BlockImpTest_legacy
 23/190 Test  #23: BlockImpTest_legacy .............................   Passed    0.00 sec
        Start  24: BlockImpTest_legacy_optimised
 24/190 Test  #24: BlockImpTest_legacy_optimised ...................   Passed    0.00 sec
        Start  25: BlockTest_arc
 25/190 Test  #25: BlockTest_arc ...................................   Passed    0.00 sec
        Start  26: BlockTest_arc_optimised
 26/190 Test  #26: BlockTest_arc_optimised .........................   Passed    0.00 sec
        Start  27: ConstantString
 27/190 Test  #27: ConstantString ..................................   Passed    0.00 sec
        Start  28: ConstantString_optimised
 28/190 Test  #28: ConstantString_optimised ........................   Passed    0.00 sec
        Start  29: ConstantString_legacy
 29/190 Test  #29: ConstantString_legacy ...........................   Passed    0.00 sec
        Start  30: ConstantString_legacy_optimised
 30/190 Test  #30: ConstantString_legacy_optimised .................   Passed    0.00 sec
        Start  31: Category
 31/190 Test  #31: Category ........................................   Passed    0.00 sec
        Start  32: Category_optimised
 32/190 Test  #32: Category_optimised ..............................   Passed    0.00 sec
        Start  33: Category_legacy
 33/190 Test  #33: Category_legacy .................................   Passed    0.00 sec
        Start  34: Category_legacy_optimised
 34/190 Test  #34: Category_legacy_optimised .......................   Passed    0.00 sec
        Start  35: ExceptionTest
 35/190 Test  #35: ExceptionTest ...................................   Passed    0.00 sec
        Start  36: ExceptionTest_optimised
 36/190 Test  #36: ExceptionTest_optimised .........................   Passed    0.00 sec
        Start  37: ExceptionTest_legacy
 37/190 Test  #37: ExceptionTest_legacy ............................   Passed    0.00 sec
        Start  38: ExceptionTest_legacy_optimised
 38/190 Test  #38: ExceptionTest_legacy_optimised ..................   Passed    0.00 sec
        Start  39: FastARC
 39/190 Test  #39: FastARC .........................................   Passed    0.00 sec
        Start  40: FastARC_optimised
 40/190 Test  #40: FastARC_optimised ...............................   Passed    0.00 sec
        Start  41: FastARC_legacy
 41/190 Test  #41: FastARC_legacy ..................................   Passed    0.00 sec
        Start  42: FastARC_legacy_optimised
 42/190 Test  #42: FastARC_legacy_optimised ........................   Passed    0.00 sec
        Start  43: FastARCPool
 43/190 Test  #43: FastARCPool .....................................   Passed    0.00 sec
        Start  44: FastARCPool_optimised
 44/190 Test  #44: FastARCPool_optimised ...........................   Passed    0.00 sec
        Start  45: FastARCPool_legacy
 45/190 Test  #45: FastARCPool_legacy ..............................   Passed    0.00 sec
        Start  46: FastARCPool_legacy_optimised
 46/190 Test  #46: FastARCPool_legacy_optimised ....................   Passed    0.00 sec
        Start  47: FastRefCount
 47/190 Test  #47: FastRefCount ....................................   Passed    0.00 sec
        Start  48: FastRefCount_optimised
 48/190 Test  #48: FastRefCount_optimised ..........................   Passed    0.00 sec
        Start  49: FastRefCount_legacy
 49/190 Test  #49: FastRefCount_legacy .............................   Passed    0.00 sec
        Start  50: FastRefCount_legacy_optimised
 50/190 Test  #50: FastRefCount_legacy_optimised ...................   Passed    0.00 sec
        Start  51: Forward
 51/190 Test  #51: Forward .........................................   Passed    0.00 sec
        Start  52: Forward_optimised
 52/190 Test  #52: Forward_optimised ...............................   Passed    0.00 sec
        Start  53: Forward_legacy
 53/190 Test  #53: Forward_legacy ..................................   Passed    0.00 sec
        Start  54: Forward_legacy_optimised
 54/190 Test  #54: Forward_legacy_optimised ........................   Passed    0.00 sec
        Start  55: ManyManySelectors
 55/190 Test  #55: ManyManySelectors ...............................   Passed    0.84 sec
        Start  56: ManyManySelectors_optimised
 56/190 Test  #56: ManyManySelectors_optimised .....................   Passed    0.81 sec
        Start  57: ManyManySelectors_legacy
 57/190 Test  #57: ManyManySelectors_legacy ........................   Passed    0.85 sec
        Start  58: ManyManySelectors_legacy_optimised
 58/190 Test  #58: ManyManySelectors_legacy_optimised ..............   Passed    0.83 sec
        Start  59: NestedExceptions
 59/190 Test  #59: NestedExceptions ................................   Passed    0.00 sec
        Start  60: NestedExceptions_optimised
 60/190 Test  #60: NestedExceptions_optimised ......................   Passed    0.00 sec
        Start  61: NestedExceptions_legacy
 61/190 Test  #61: NestedExceptions_legacy .........................   Passed    0.00 sec
        Start  62: NestedExceptions_legacy_optimised
 62/190 Test  #62: NestedExceptions_legacy_optimised ...............   Passed    0.00 sec
        Start  63: PropertyAttributeTest
 63/190 Test  #63: PropertyAttributeTest ...........................   Passed    0.00 sec
        Start  64: PropertyAttributeTest_optimised
 64/190 Test  #64: PropertyAttributeTest_optimised .................   Passed    0.00 sec
        Start  65: PropertyAttributeTest_legacy
 65/190 Test  #65: PropertyAttributeTest_legacy ....................   Passed    0.00 sec
        Start  66: PropertyAttributeTest_legacy_optimised
 66/190 Test  #66: PropertyAttributeTest_legacy_optimised ..........   Passed    0.00 sec
        Start  67: ProtocolExtendedProperties
 67/190 Test  #67: ProtocolExtendedProperties ......................   Passed    0.00 sec
        Start  68: ProtocolExtendedProperties_optimised
 68/190 Test  #68: ProtocolExtendedProperties_optimised ............   Passed    0.00 sec
        Start  69: ProtocolExtendedProperties_legacy
 69/190 Test  #69: ProtocolExtendedProperties_legacy ...............   Passed    0.00 sec
        Start  70: ProtocolExtendedProperties_legacy_optimised
 70/190 Test  #70: ProtocolExtendedProperties_legacy_optimised .....   Passed    0.00 sec
        Start  71: PropertyIntrospectionTest
 71/190 Test  #71: PropertyIntrospectionTest .......................   Passed    0.00 sec
        Start  72: PropertyIntrospectionTest_optimised
 72/190 Test  #72: PropertyIntrospectionTest_optimised .............   Passed    0.00 sec
        Start  73: PropertyIntrospectionTest_legacy
 73/190 Test  #73: PropertyIntrospectionTest_legacy ................   Passed    0.00 sec
        Start  74: PropertyIntrospectionTest_legacy_optimised
 74/190 Test  #74: PropertyIntrospectionTest_legacy_optimised ......   Passed    0.00 sec
        Start  75: ProtocolCreation
 75/190 Test  #75: ProtocolCreation ................................   Passed    0.00 sec
        Start  76: ProtocolCreation_optimised
 76/190 Test  #76: ProtocolCreation_optimised ......................   Passed    0.00 sec
        Start  77: ProtocolCreation_legacy
 77/190 Test  #77: ProtocolCreation_legacy .........................   Passed    0.00 sec
        Start  78: ProtocolCreation_legacy_optimised
 78/190 Test  #78: ProtocolCreation_legacy_optimised ...............   Passed    0.00 sec
        Start  79: ResurrectInDealloc_arc
 79/190 Test  #79: ResurrectInDealloc_arc ..........................   Passed    0.00 sec
        Start  80: ResurrectInDealloc_arc_optimised
 80/190 Test  #80: ResurrectInDealloc_arc_optimised ................   Passed    0.00 sec
        Start  81: RuntimeTest
 81/190 Test  #81: RuntimeTest .....................................   Passed    0.00 sec
        Start  82: RuntimeTest_optimised
 82/190 Test  #82: RuntimeTest_optimised ...........................   Passed    0.00 sec
        Start  83: RuntimeTest_legacy
 83/190 Test  #83: RuntimeTest_legacy ..............................   Passed    0.00 sec
        Start  84: RuntimeTest_legacy_optimised
 84/190 Test  #84: RuntimeTest_legacy_optimised ....................   Passed    0.00 sec
        Start  85: SuperMethodMissing
 85/190 Test  #85: SuperMethodMissing ..............................   Passed    0.00 sec
        Start  86: SuperMethodMissing_optimised
 86/190 Test  #86: SuperMethodMissing_optimised ....................   Passed    0.00 sec
        Start  87: SuperMethodMissing_legacy
 87/190 Test  #87: SuperMethodMissing_legacy .......................   Passed    0.00 sec
        Start  88: SuperMethodMissing_legacy_optimised
 88/190 Test  #88: SuperMethodMissing_legacy_optimised .............   Passed    0.00 sec
        Start  89: WeakBlock_arc
 89/190 Test  #89: WeakBlock_arc ...................................   Passed    0.00 sec
        Start  90: WeakBlock_arc_optimised
 90/190 Test  #90: WeakBlock_arc_optimised .........................   Passed    0.00 sec
        Start  91: WeakRefLoad
 91/190 Test  #91: WeakRefLoad .....................................   Passed    0.00 sec
        Start  92: WeakRefLoad_optimised
 92/190 Test  #92: WeakRefLoad_optimised ...........................   Passed    0.00 sec
        Start  93: WeakRefLoad_legacy
 93/190 Test  #93: WeakRefLoad_legacy ..............................   Passed    0.00 sec
        Start  94: WeakRefLoad_legacy_optimised
 94/190 Test  #94: WeakRefLoad_legacy_optimised ....................   Passed    0.00 sec
        Start  95: WeakReferences_arc
 95/190 Test  #95: WeakReferences_arc ..............................   Passed    1.18 sec
        Start  96: WeakReferences_arc_optimised
 96/190 Test  #96: WeakReferences_arc_optimised ....................   Passed    1.11 sec
        Start  97: WeakImportClass
 97/190 Test  #97: WeakImportClass .................................   Passed    0.00 sec
        Start  98: WeakImportClass_optimised
 98/190 Test  #98: WeakImportClass_optimised .......................   Passed    0.00 sec
        Start  99: WeakImportClass_legacy
 99/190 Test  #99: WeakImportClass_legacy ..........................   Passed    0.00 sec
        Start 100: WeakImportClass_legacy_optimised
100/190 Test #100: WeakImportClass_legacy_optimised ................   Passed    0.00 sec
        Start 101: ivar_arc
101/190 Test #101: ivar_arc ........................................   Passed    0.00 sec
        Start 102: ivar_arc_optimised
102/190 Test #102: ivar_arc_optimised ..............................   Passed    0.00 sec
        Start 103: ivar_atomic
103/190 Test #103: ivar_atomic .....................................   Passed    0.00 sec
        Start 104: ivar_atomic_optimised
104/190 Test #104: ivar_atomic_optimised ...........................   Passed    0.00 sec
        Start 105: ivar_atomic_legacy
105/190 Test #105: ivar_atomic_legacy ..............................   Passed    0.00 sec
        Start 106: ivar_atomic_legacy_optimised
106/190 Test #106: ivar_atomic_legacy_optimised ....................   Passed    0.00 sec
        Start 107: IVarOverlap
107/190 Test #107: IVarOverlap .....................................   Passed    0.00 sec
        Start 108: IVarOverlap_optimised
108/190 Test #108: IVarOverlap_optimised ...........................   Passed    0.00 sec
        Start 109: IVarOverlap_legacy
109/190 Test #109: IVarOverlap_legacy ..............................   Passed    0.00 sec
        Start 110: IVarOverlap_legacy_optimised
110/190 Test #110: IVarOverlap_legacy_optimised ....................   Passed    0.00 sec
        Start 111: IVarSuperclassOverlap
111/190 Test #111: IVarSuperclassOverlap ...........................   Passed    0.00 sec
        Start 112: IVarSuperclassOverlap_optimised
112/190 Test #112: IVarSuperclassOverlap_optimised .................   Passed    0.00 sec
        Start 113: IVarSuperclassOverlap_legacy
113/190 Test #113: IVarSuperclassOverlap_legacy ....................   Passed    0.00 sec
        Start 114: IVarSuperclassOverlap_legacy_optimised
114/190 Test #114: IVarSuperclassOverlap_legacy_optimised ..........   Passed    0.00 sec
        Start 115: objc_msgSend
115/190 Test #115: objc_msgSend ....................................   Passed    0.00 sec
        Start 116: objc_msgSend_optimised
116/190 Test #116: objc_msgSend_optimised ..........................   Passed    0.00 sec
        Start 117: objc_msgSend_legacy
117/190 Test #117: objc_msgSend_legacy .............................   Passed    0.00 sec
        Start 118: objc_msgSend_legacy_optimised
118/190 Test #118: objc_msgSend_legacy_optimised ...................   Passed    0.00 sec
        Start 119: msgInterpose
119/190 Test #119: msgInterpose ....................................   Passed    0.00 sec
        Start 120: msgInterpose_optimised
120/190 Test #120: msgInterpose_optimised ..........................   Passed    0.00 sec
        Start 121: msgInterpose_legacy
121/190 Test #121: msgInterpose_legacy .............................   Passed    0.00 sec
        Start 122: msgInterpose_legacy_optimised
122/190 Test #122: msgInterpose_legacy_optimised ...................   Passed    0.00 sec
        Start 123: NilException
123/190 Test #123: NilException ....................................   Passed    0.00 sec
        Start 124: NilException_optimised
124/190 Test #124: NilException_optimised ..........................   Passed    0.00 sec
        Start 125: NilException_legacy
125/190 Test #125: NilException_legacy .............................   Passed    0.00 sec
        Start 126: NilException_legacy_optimised
126/190 Test #126: NilException_legacy_optimised ...................   Passed    0.00 sec
        Start 127: MethodArguments
127/190 Test #127: MethodArguments .................................   Passed    0.00 sec
        Start 128: MethodArguments_optimised
128/190 Test #128: MethodArguments_optimised .......................   Passed    0.00 sec
        Start 129: MethodArguments_legacy
129/190 Test #129: MethodArguments_legacy ..........................   Passed    0.00 sec
        Start 130: MethodArguments_legacy_optimised
130/190 Test #130: MethodArguments_legacy_optimised ................   Passed    0.00 sec
        Start 131: zeroSizedIVar
131/190 Test #131: zeroSizedIVar ...................................   Passed    0.00 sec
        Start 132: zeroSizedIVar_optimised
132/190 Test #132: zeroSizedIVar_optimised .........................   Passed    0.00 sec
        Start 133: zeroSizedIVar_legacy
133/190 Test #133: zeroSizedIVar_legacy ............................   Passed    0.00 sec
        Start 134: zeroSizedIVar_legacy_optimised
134/190 Test #134: zeroSizedIVar_legacy_optimised ..................   Passed    0.00 sec
        Start 135: exchange
135/190 Test #135: exchange ........................................   Passed    0.00 sec
        Start 136: exchange_optimised
136/190 Test #136: exchange_optimised ..............................   Passed    0.00 sec
        Start 137: exchange_legacy
137/190 Test #137: exchange_legacy .................................   Passed    0.00 sec
        Start 138: exchange_legacy_optimised
138/190 Test #138: exchange_legacy_optimised .......................   Passed    0.00 sec
        Start 139: hash_table_delete
139/190 Test #139: hash_table_delete ...............................   Passed    0.00 sec
        Start 140: hash_table_delete_optimised
140/190 Test #140: hash_table_delete_optimised .....................   Passed    0.00 sec
        Start 141: hash_table_delete_legacy
141/190 Test #141: hash_table_delete_legacy ........................   Passed    0.00 sec
        Start 142: hash_table_delete_legacy_optimised
142/190 Test #142: hash_table_delete_legacy_optimised ..............   Passed    0.00 sec
        Start 143: hash_test
143/190 Test #143: hash_test .......................................   Passed    1.72 sec
        Start 144: hash_test_optimised
144/190 Test #144: hash_test_optimised .............................   Passed    0.17 sec
        Start 145: hash_test_legacy
145/190 Test #145: hash_test_legacy ................................   Passed    1.76 sec
        Start 146: hash_test_legacy_optimised
146/190 Test #146: hash_test_legacy_optimised ......................   Passed    0.16 sec
        Start 147: setSuperclass
147/190 Test #147: setSuperclass ...................................   Passed    0.00 sec
        Start 148: setSuperclass_optimised
148/190 Test #148: setSuperclass_optimised .........................   Passed    0.00 sec
        Start 149: setSuperclass_legacy
149/190 Test #149: setSuperclass_legacy ............................   Passed    0.00 sec
        Start 150: setSuperclass_legacy_optimised
150/190 Test #150: setSuperclass_legacy_optimised ..................   Passed    0.00 sec
        Start 151: UnexpectedException
151/190 Test #151: UnexpectedException .............................***Skipped   0.00 sec
        Start 152: UnexpectedException_optimised
152/190 Test #152: UnexpectedException_optimised ...................***Skipped   0.00 sec
        Start 153: UnexpectedException_legacy
153/190 Test #153: UnexpectedException_legacy ......................***Skipped   0.00 sec
        Start 154: UnexpectedException_legacy_optimised
154/190 Test #154: UnexpectedException_legacy_optimised ............***Skipped   0.00 sec
        Start 155: BoxedForeignException
155/190 Test #155: BoxedForeignException ...........................   Passed    0.00 sec
        Start 156: BoxedForeignException_optimised
156/190 Test #156: BoxedForeignException_optimised .................   Passed    0.00 sec
        Start 157: BoxedForeignException_legacy
157/190 Test #157: BoxedForeignException_legacy ....................   Passed    0.00 sec
        Start 158: BoxedForeignException_legacy_optimised
158/190 Test #158: BoxedForeignException_legacy_optimised ..........   Passed    0.00 sec
        Start 159: ForeignException
159/190 Test #159: ForeignException ................................   Passed    0.00 sec
        Start 160: ForeignException_optimised
160/190 Test #160: ForeignException_optimised ......................   Passed    0.00 sec
        Start 161: ForeignException_legacy
161/190 Test #161: ForeignException_legacy .........................   Passed    0.00 sec
        Start 162: ForeignException_legacy_optimised
162/190 Test #162: ForeignException_legacy_optimised ...............   Passed    0.00 sec
        Start 163: ARCTest_arc
163/190 Test #163: ARCTest_arc .....................................   Passed    0.00 sec
        Start 164: ARCTest_arc_optimised
164/190 Test #164: ARCTest_arc_optimised ...........................   Passed    0.00 sec
        Start 165: PropertyIntrospectionTest2_arc
165/190 Test #165: PropertyIntrospectionTest2_arc ..................   Passed    0.00 sec
        Start 166: PropertyIntrospectionTest2_arc_optimised
166/190 Test #166: PropertyIntrospectionTest2_arc_optimised ........   Passed    0.00 sec
        Start 167: category_properties
167/190 Test #167: category_properties .............................   Passed    0.00 sec
        Start 168: category_properties_optimised
168/190 Test #168: category_properties_optimised ...................   Passed    0.00 sec
        Start 169: DirectMethods
169/190 Test #169: DirectMethods ...................................   Passed    0.00 sec
        Start 170: DirectMethods_optimised
170/190 Test #170: DirectMethods_optimised .........................   Passed    0.00 sec
        Start 171: FastPathAlloc
171/190 Test #171: FastPathAlloc ...................................***Skipped   0.00 sec
        Start 172: FastPathAlloc_optimised
172/190 Test #172: FastPathAlloc_optimised .........................***Skipped   0.00 sec
        Start 173: CXXExceptions
173/190 Test #173: CXXExceptions ...................................   Passed    0.00 sec
        Start 174: CXXExceptions_optimised
174/190 Test #174: CXXExceptions_optimised .........................   Passed    0.00 sec
        Start 175: CXXExceptions_legacy
175/190 Test #175: CXXExceptions_legacy ............................   Passed    0.00 sec
        Start 176: CXXExceptions_legacy_optimised
176/190 Test #176: CXXExceptions_legacy_optimised ..................   Passed    0.00 sec
        Start 177: ForwardDeclareProtocolAccess
177/190 Test #177: ForwardDeclareProtocolAccess ....................   Passed    0.00 sec
        Start 178: ForwardDeclareProtocolAccess_optimised
178/190 Test #178: ForwardDeclareProtocolAccess_optimised ..........   Passed    0.00 sec
        Start 179: ForwardDeclareProtocolAccess_legacy
179/190 Test #179: ForwardDeclareProtocolAccess_legacy .............   Passed    0.00 sec
        Start 180: ForwardDeclareProtocolAccess_legacy_optimised
180/190 Test #180: ForwardDeclareProtocolAccess_legacy_optimised ...   Passed    0.00 sec
        Start 181: ObjCXXEHInterop
181/190 Test #181: ObjCXXEHInterop .................................   Passed    0.00 sec
        Start 182: ObjCXXEHInterop_optimised
182/190 Test #182: ObjCXXEHInterop_optimised .......................   Passed    0.00 sec
        Start 183: ObjCXXEHInterop_legacy
183/190 Test #183: ObjCXXEHInterop_legacy ..........................   Passed    0.00 sec
        Start 184: ObjCXXEHInterop_legacy_optimised
184/190 Test #184: ObjCXXEHInterop_legacy_optimised ................   Passed    0.00 sec
        Start 185: ObjCXXEHInteropTwice
185/190 Test #185: ObjCXXEHInteropTwice ............................   Passed    0.00 sec
        Start 186: ObjCXXEHInteropTwice_optimised
186/190 Test #186: ObjCXXEHInteropTwice_optimised ..................   Passed    0.00 sec
        Start 187: ObjCXXEHInteropTwice_legacy
187/190 Test #187: ObjCXXEHInteropTwice_legacy .....................   Passed    0.00 sec
        Start 188: ObjCXXEHInteropTwice_legacy_optimised
188/190 Test #188: ObjCXXEHInteropTwice_legacy_optimised ...........   Passed    0.00 sec
        Start 189: ObjCXXEHInterop_arc
189/190 Test #189: ObjCXXEHInterop_arc .............................   Passed    0.00 sec
        Start 190: ObjCXXEHInterop_arc_optimised
190/190 Test #190: ObjCXXEHInterop_arc_optimised ...................   Passed    0.00 sec

100% tests passed, 0 tests failed out of 190

Total Test time (real) =  10.01 sec

The following tests did not run:
	151 - UnexpectedException (Skipped)
	152 - UnexpectedException_optimised (Skipped)
	153 - UnexpectedException_legacy (Skipped)
	154 - UnexpectedException_legacy_optimised (Skipped)
	171 - FastPathAlloc (Skipped)
	172 - FastPathAlloc_optimised (Skipped)
hmelder@ubuntu:/Users/hmelder/libobjc2$

@hmelder
Copy link
Collaborator Author

hmelder commented Apr 18, 2024

I updated the function name to objc_msgSend_stret2.

davidchisnall pushed a commit to llvm/llvm-project that referenced this pull request Apr 25, 2024
…8671)

Linked to gnustep/libobjc2#289.

More information can be found in issue: #88273.

My solution involves creating a new message-send function for this
calling convention when targeting MSVC. Additional information is
available in the libobjc2 pull request.

I am unsure whether we should check for a runtime version where
objc_msgSend_stret2_np is guaranteed to be present or leave it as is,
considering it remains a critical bug. What are your thoughts about this
@davidchisnall?

set(ARCHITECTURE ${ARCHITECTURE} CACHE STRING "Architecture Type")
message(STATUS "Architecture: ${ARCHITECTURE}")
message(STATUS "Architecture as detected by CMake: ${CMAKE_SYSTEM_PROCESSOR}")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can’t remember why this was needed, are you sure it no longer is?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is still an issue when using CMake x86_64 on Windows on ARM64, as CMake reports AMD64 while using an ARM64 compiler.

The problem with this hack is that it searches for any occurrence in the output of the compiler. Other paths (like /c/Program Files/python3-arm/) are erroneously selected.

I think we should stick to the standard CMAKE_SYSTEM_PROCESSOR variable, but put a warning in README.md or INSTALL. CMake is not willing to fix this broken behaviour on Windows.

objc/message.h Outdated
@@ -52,8 +52,18 @@ id objc_msgSend(id self, SEL _cmd, ...);
OBJC_PUBLIC
#ifdef __cplusplus
id objc_msgSend_stret(id self, SEL _cmd, ...);

# if defined(_WIN32) && defined(__ARM_ARCH_ISA_A64)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An you add a doc comment explaining why this one exists?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure!

@davidchisnall
Copy link
Member

Once this is in, can you cherry pick it into the release branch and we’ll cut a new point release for it.

@hmelder
Copy link
Collaborator Author

hmelder commented Apr 26, 2024

the release branch

I assume 2.2?

llvmbot pushed a commit to llvmbot/llvm-project that referenced this pull request Apr 26, 2024
…vm#88671)

Linked to gnustep/libobjc2#289.

More information can be found in issue: llvm#88273.

My solution involves creating a new message-send function for this
calling convention when targeting MSVC. Additional information is
available in the libobjc2 pull request.

I am unsure whether we should check for a runtime version where
objc_msgSend_stret2_np is guaranteed to be present or leave it as is,
considering it remains a critical bug. What are your thoughts about this
@davidchisnall?

(cherry picked from commit 3dcd2cc)
@davidchisnall
Copy link
Member

Yup, let's do a 2.2.2 that includes this.

@hmelder hmelder merged commit dc031d2 into master Apr 26, 2024
59 checks passed
@hmelder hmelder deleted the non-pod-sret-woa64 branch April 26, 2024 10:47
hmelder added a commit that referenced this pull request Apr 26, 2024
…ivial data types (#289)

* Add objc_msgSend_stret2

* Guard and Export objc_msgSend_stret2

* Remove architecture hackery in CMake

* Add objc_msgSend test for WoA64

* Add doc comment for objc_msgSend_stret2
tstellar pushed a commit to llvmbot/llvm-project that referenced this pull request Apr 29, 2024
…vm#88671)

Linked to gnustep/libobjc2#289.

More information can be found in issue: llvm#88273.

My solution involves creating a new message-send function for this
calling convention when targeting MSVC. Additional information is
available in the libobjc2 pull request.

I am unsure whether we should check for a runtime version where
objc_msgSend_stret2_np is guaranteed to be present or leave it as is,
considering it remains a critical bug. What are your thoughts about this
@davidchisnall?

(cherry picked from commit 3dcd2cc)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants