Skip to content

Commit

Permalink
Fix ARM64-based CPU detection logic; take #3. (#5683)
Browse files Browse the repository at this point in the history
The previous implementation was broken, because:

* We called GetIsARM64CallingConvention in Runtime's static constructor.
* Runtime.Arch hadn't been set yet in the static constructor, which means it
  was Arch.DEVICE (0).
* This meant GetIsARM64CallingConvention would return true on iOS/tvOS x86-64
  simulator.

So delay the initialization of the IsARM64CallingConvention field until we've
been initialized.
  • Loading branch information
rolfbjarne authored Feb 28, 2019
1 parent a5232f8 commit 564628a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ObjCRuntime/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ unsafe static void Initialize (InitializationOptions* options)
#if !XAMMAC_SYSTEM_MONO
UseAutoreleasePoolInThreadPool = true;
#endif
IsARM64CallingConvention = GetIsARM64CallingConvention (); // Can only be done after Runtime.Arch is set (i.e. InitializePlatform has been called).

objc_exception_mode = options->MarshalObjectiveCExceptionMode;
managed_exception_mode = options->MarshalManagedExceptionMode;
Expand Down Expand Up @@ -1739,7 +1740,7 @@ public string Description {
[DllImport (Constants.libSystemLibrary)]
static unsafe extern NXArchInfo* NXGetLocalArchInfo ();

public readonly static bool IsARM64CallingConvention = GetIsARM64CallingConvention ();
public static bool IsARM64CallingConvention;

[BindingImpl (BindingImplOptions.Optimizable)]
static bool GetIsARM64CallingConvention ()
Expand Down

4 comments on commit 564628a

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Test run, Test run' 🔥

Build succeeded
✅ Packages: xamarin.ios-12.7.0.193.pkg xamarin.mac-5.7.0.193.pkg
API Diff (from stable)
🔥 Failed to compare API and create generator diff 🔥
    Failed to update apidiff references
    Search for Comparing API & creating generator diff in the log to view the complete log.
🔥 Test run failed 🔥

Test results

6 tests failed, 0 tests skipped, 326 tests passed.

Failed tests

  • xammac tests/Mac/Debug: Failed (Test run failed.)
  • xammac tests/Mac/Debug (all optimizations): Failed (Test run failed.)
  • xammac tests/Mac/Release: Failed (Test run failed.)
  • xammac tests/Mac/Release (all optimizations): Failed (Test run failed.)
  • [NUnit] Mono SystemServiceModelTests/watchOS - simulator/Debug: Crashed
  • [xUnit] Mono CorlibXunit/watchOS - simulator/Debug: Crashed

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Test run' 🔥 : org.jenkinsci.plugins.workflow.steps.FlowInterruptedException

Build succeeded
✅ Packages: xamarin.ios-12.7.0.193.pkg xamarin.mac-5.7.0.193.pkg
API Diff (from stable)
🔥 Failed to compare API and create generator diff 🔥
    Failed to update apidiff references
    Search for Comparing API & creating generator diff in the log to view the complete log.

@xamarin-release-manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Build was (probably) aborted

🔥 Jenkins job (on internal Jenkins) failed in stage(s) 'Test run, Test run' 🔥

Build succeeded
✅ Packages: xamarin.ios-12.7.0.193.pkg xamarin.mac-5.7.0.193.pkg
API Diff (from stable)
🔥 Failed to compare API and create generator diff 🔥
    Failed to update apidiff references
    Search for Comparing API & creating generator diff in the log to view the complete log.
Test run succeeded

@dalexsoto
Copy link
Member

@dalexsoto dalexsoto commented on 564628a Mar 4, 2019

Choose a reason for hiding this comment

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

Setting state to success where context is continuous-integration/jenkins/branch.

No blocking issues found

Please sign in to comment.