Граф коммитов

23 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 598dbc8ae3
Use pointer-sized GCHandles everywhere. (#10597)
* Convert the GCHandles interface from 32-bit ints to pointer size types

This involves:

* Stop using some bits of the GCHandle to store extra flags, instead add an extra
  field to store those flags.
* Define a INVALID_GCHANDLE constant and use it instead of 0/NULL. This is not
  strictly required, but it makes the code more self-documenting.
* Define a GCHandle type (typedef'ed to void*) and change all variables and parameters
  to use it instead of guint32.
* Use our own xamarin_gchandle_* methods (with pointer-sized types) that wraps
  the mono_gchandle_* embedding API (which uses 32-bit types) everywhere.
* Update managed code (registrars, runtime code, etc) accordingly.

* [runtime] Make debug code compile.

* Fix typo.

* Fix signature of xamarin_create_gchandle.

Co-authored-by: Aaron R Robinson <arobins@microsoft.com>
2021-02-11 08:18:38 +01:00
Manuel de la Pena 481d5ef9ab
[Runtime] Enable the -Wsign-conversion on trampolines-x86_64.m files. (#7455)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-15 14:34:36 -05:00
Manuel de la Pena 63ab48e679
[Runtime] Enable the -Wsign-conversion warnings flag and fix some of the warnings. (#7405)
The flag adds a lot (A LOT) of warnings. The diff would be huge and
dangerous to review. We enable the flag and fix file by file.
2019-11-12 15:10:16 -05:00
Manuel de la Pena 2e5b64893f
[Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings. (#7353)
* [Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings.

We want to enable the -Wconversion but that will raise too many warning
for a single commit. We are enabiling one by one the flags included in
-Wconversion so that we have smaller diffs.

-Wshorten-64-to-32 adds warnings when there is a implicit conversion that
loses integer precision. We are moving all the 32 to 64 conversions to
use 64. Expecially since most of the code changed is related with sizes,
legths and params counts that are never going to be negative.


Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2019-11-05 11:00:14 -05:00
Manuel de la Pena 8b45260ee4
[Runtime] Ensure that all comparisons between signed and unsigned values are fixed. (#7339)
Enable the -Wsign-compare which will raise issues when a comparison
between signed and unsigned values could produce an incorrect result
and fix all the raised warnings.
2019-10-30 15:58:13 -04:00
Rolf Bjarne Kvinge 37a280d974
[runtime] Put LOGZ directive in a header to not duplicate it everywhere. (#6001) 2019-05-06 19:29:28 +02:00
Rolf Bjarne Kvinge 82f288a135
[runtime] Refactor a bit to share code between files. (#6000) 2019-05-06 16:19:56 +02:00
Rolf Bjarne Kvinge 4be637aa8e
[registrar] Fix marshalling of structs with a single member. (#5986) 2019-05-06 07:26:54 +02:00
Rolf Bjarne Kvinge 83058e339c
[runtime] Fix crash in the x86_64 dynamic registrar. (#5989)
In [this][1] innocuous-looking commit I made the x86_64 dynamic registrar
crash when TRACE is defined. The underlying problem is that CallState's rsi
field is re-used as rax upon exit of the trampoline. This means that the
CallState.sel () function that gets the selector, will instead get the return
value upon exit. When TRACE is defined, we try to print the selector upon
exiting the trampoline, and since the rsi field is now the rax field, we end
up trying to print the return value as if it were a selector, and things go
slightly sideways.

[1]: https://github.com/xamarin/xamarin-macios/commit/464882d14a83
2019-05-06 07:25:49 +02:00
Rolf Bjarne Kvinge c8ed014af7
[runtime] Improve exception creation. (#5944)
* [runtime] Add an inner exception parameter to Runtime.CreateProductException.

This allows us to simplify code by using inner (and outer) exceptions as
a means to provide information instead of passing extra information
around in order to create decent exceptions.

One example is how we pass the selector and method name to the method
that converts from a native id to a managed NSObject instance: passing
this information is not necessary anymore if we can use two exceptions,
one for the failure to convert from an id to a NSObject instance,
wrapped in a second that tells which method/selector call ran into this
conversion problem.

* [runtime] Throw better exceptions when the dynamic registrar can't marshal something.

* [runtime] Throw a better exception when something goes wrong when trying to marshal a return value.

* [runtime] Use inner exceptions to convey failure information instead of trying to create a single exception with all we know.

* Fix merge problem.
2019-04-26 11:16:23 +02:00
Rolf Bjarne Kvinge df85569d23
[runtime] Rename CallState to XamarinCallState to keep the public namespace cleaner. (#5940)
Also ignore the corresponding public symbols in the PublicSymbols test.

This was introduced in 464882d14a (changes to
the CallState struct made the compiler create public symbols).

Fixes these test failures:

    1) Failed : Xamarin.Tests.Misc.PublicSymbols(iOS)
      Failed libraries
      Expected: <empty>
      But was:  "/work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphoneos.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/MonoTouch.iphonesimulator.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    "
      at Xamarin.Tests.Misc.PublicSymbols (Xamarin.Tests.Profile profile) [0x00259] in /work/maccore/master/xamarin-macios/tests/mtouch/MiscTests.cs:196

    2) Failed : Xamarin.Tests.Misc.PublicSymbols(tvOS)
      Failed libraries
      Expected: <empty>
      But was:  "/work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.AppleTVOS.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.AppleTVSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    "
      at Xamarin.Tests.Misc.PublicSymbols (Xamarin.Tests.Profile profile) [0x00259] in /work/maccore/master/xamarin-macios/tests/mtouch/MiscTests.cs:196

    3) Failed : Xamarin.Tests.Misc.PublicSymbols(watchOS)
      Failed libraries
      Expected: <empty>
      But was:  "/work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchOS.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/SDKs/Xamarin.WatchSimulator.sdk/usr/lib/libxamarin-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    "
      at Xamarin.Tests.Misc.PublicSymbols (Xamarin.Tests.Profile profile) [0x00259] in /work/maccore/master/xamarin-macios/tests/mtouch/MiscTests.cs:196

    4) Failed : Xamarin.Tests.Misc.PublicSymbols(macOSMobile)
      Failed libraries
      Expected: <empty>
      But was:  "/work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-system-debug.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac-system.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    /work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac.a:
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    	__ZN9CallState3selEv
    	__ZN9CallState4selfEv
    	__ZN9CallState8is_stretEv
    "
      at Xamarin.Tests.Misc.PublicSymbols (Xamarin.Tests.Profile profile) [0x00259] in /work/maccore/master/xamarin-macios/tests/mtouch/MiscTests.cs:196
2019-04-23 16:53:35 +01:00
Rolf Bjarne Kvinge 464882d14a
[runtime] Refactor a little bit to avoid code duplication. (#5924) 2019-04-23 06:29:20 +01:00
Rolf Bjarne Kvinge 02fe5339a4
[runtime] Clean up public symbols. Fixes #5124. (#5155)
* [runtime] Clean up public symbols. Fixes #5124.

Clean up public symbols, by:

* Symbols that don't need to be public (most of them), can be private.
* Prefix all public symbols with `xamarin_`.
* Add a test to ensure we don't introduce new public symbols.
* Use C symbols instead of mangled C++ symbols, since those are easier to
  handle in the test.

This minimizes the chance of getting into a symbol clash with another native library.

Fixes https://github.com/xamarin/xamarin-macios/issues/5124.

* Some test fixes.
2018-11-21 11:48:15 -05:00
Rolf Bjarne Kvinge a979a10412 Merge remote-tracking branch 'origin/master' into bindas-registrar-support 2017-09-22 10:50:07 +02:00
Rolf Bjarne Kvinge f2d0a80699 [runtime] Parameters passed on the stack use at least 8 bytes on x86-64. Fixes #58367. (#2393)
* [runtime] Make debug spew compile.

* [tests] Add test case for bug #58367.

https://bugzilla.xamarin.com/show_bug.cgi?id=58367

* [runtime] Parameters passed on the stack use at least 8 bytes on x86-64. Fixes #58367.

https://bugzilla.xamarin.com/show_bug.cgi?id=58367
2017-08-02 08:26:29 +02:00
Rolf Bjarne Kvinge 7ecbc7abee [registrar] Add support for the BindAs attribute. 2017-07-04 07:35:29 +02:00
Rolf Bjarne Kvinge bf36860c1e [runtime] Make the clang's static analyzer happy. (#1722)
trampolines-i386.m:126:19: warning: Assigned value is garbage or undefined
                            it->state->edx = v[1];
                                           ^ ~~~~
    trampolines-x86_64.m:410:16: warning: Assigned value is garbage or undefined
                                                    *reg_ptr = v [stores];
                                                             ^ ~~~~~~~~~~
    trampolines-x86_64.m:447:14: warning: Assigned value is garbage or undefined
                                    *reg_ptr = v [stores++];
                                             ^ ~~~~~~~~~~~~
2017-02-20 17:20:13 +01:00
Rolf Bjarne Kvinge a9188a3bf3 [runtime] Fix returning structs with size < 8. 2016-10-13 17:35:51 +02:00
Rolf Bjarne Kvinge f448f6d55c [runtime] Fix returning 'float,float' and 'double' structs on x86_64. 2016-10-13 17:35:50 +02:00
Rolf Bjarne Kvinge c660307b55 [runtime] Simplify stret check in the x86_64 trampolines. 2016-10-13 17:35:50 +02:00
Rolf Bjarne Kvinge 2d28e24837 [runtime] Handle any exceptions whenever we return from managed code. 2016-06-08 20:05:54 +02:00
Rolf Bjarne Kvinge af0d01c93a Initial review pass for COOP for watchOS. 2016-05-26 17:47:10 +02:00
Rolf Bjarne Kvinge ac418df815 Build our runtime. 2016-04-24 14:47:24 -04:00