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

150 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot b2e6aba41c
[mtouch][mmp] Add better easier, more complete timestamps to see where time is spent (#4150)
* Share the stopwatch code between `mtouch` and `mmp`;

* Add more details on linker steps. Sadly substeps are executed on the
  metadata so they can't be reported individually;

* Add a few places where timestamps where missing to get better precision
  on the linking part;
2018-05-29 13:08:34 -04:00
Sebastien Pouliot 68151d61c9
[mtouch] Cache result of IsArchEnabled in targets and application (#4149)
On my test project we were calling `IsArchEnabled` 334,713 times which
made the enumerator called enough to show on the memory usage (13MB),
even if each instance is only 40 bytes.

Caching the result makes the method called only 5 times.
2018-05-29 11:14:10 -04:00
Bernhard Urban 394117885c
[runtime] add support for mono runtime interpreter (#3058)
* [runtime] build interp-, icalltable- and ilgen libraries so they can be consumed in interpreter configuration

* [mtouch] add --interpreter configuration support

* [xharness] Add support for removing defines from cloned project files.

* [xharness] Run monotouch-test, mscorlib and mini tests with the interpreter too.

They're ignored for now, which means we won't run them on the bots.

* [mtouch] We're using dlsym when using the interpreter.

* [xharness] enable mini regression tests with interpreter on CI
2018-05-04 23:59:31 +02:00
Sebastien Pouliot b09c04352d
[mtouch] Use full path to mono-symbolicate instead of UseShellExecute (#3825)
Fix https://github.com/xamarin/xamarin-macios/issues/3653 differently as
`UseShellExecute` cannot be used when redirecting output so the original
fix [1] caused an exception which affected it from both macOS and windows
(thru XMA) instead of being an issue only with the later.

It's not clear how the original [1] fix was validated successfully, it's
possible than an older version of mono did not throw (since that
limitation seems windows specific).

[1] https://github.com/xamarin/xamarin-macios/pull/3781
2018-03-29 17:30:29 -04:00
Manuel de la Pena e10ae0d323
[Mtouch] Pass ShellExceute true in CopyMSymData. Fixes 3653 (#3781) 2018-03-23 16:59:30 +01:00
Rolf Bjarne Kvinge f3055ddd6d
[mtouch] Move native code sharing check for the remove-dynamic-registrar optimization until after checking the linker settings. (#3643)
Fixes this test failure:

1) Failed : Xamarin.MTouch.MT0113_linker
The error 'MT0113: Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).' was not found in the output:
	Message #1 did not match:
		actual:   'Native code sharing has been disabled for the extension 'testServiceExtension' because the remove-dynamic-registrar optimization differ between the container app (default) and the extension (false).'
		expected: 'Native code sharing has been disabled for the extension 'testServiceExtension' because the managed linker settings are different between the container app (None) and the extension (All).'

which happens because:

* Removing the dynamic registrar requires the linker, so removal of the dynamic registrar is disabled if the linker is not disabled
* This results in the app and appex having different values for the remove-dynamic-registrar option
* Thus the error message.

Technically either error is correct, but I prefer the previous one (about the
linker), because it directly assigns blame (the linker setting). Figuring out
what has to change (the linker setting) when the error message complains about
an optimization is not so straight forward for users.
2018-03-02 18:28:07 +01:00
Rolf Bjarne Kvinge a106cd7520
[mtouch] Bundle duplicated assemblies in the container app. Fixes #58873. (#3626)
Assemblies that satisfy all of these conditions:

* Are not in the container project.
* Are in multiple app extensions.

can (and should) be bundled in the container app.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58873
2018-03-02 09:39:42 +01:00
Chris Hamons ca4360116c
[mmp] Add stripping of 32-bit dylibs to work with new App Store restrictions (#3387)
- https://github.com/xamarin/xamarin-macios/issues/3367
- App Store will now fail builds if you add in a 32-bit dylib
- If you are a 32-bit app you don't need the 64-bit part of your fat
dylib anyway
- Add --optimize=-trim-architectures to allow customization of behavior, as not everyone
uses app store

In addition, while writing tests for this is was noticed that mmp tests did not "really" run Release configuration correctly in most cases. Fixing this turned out to be a bit of a pain, but necessary to correctly test this (and other things).

- Turns out that /p:configuration:debug is not sufficient to tell mmp to
do the right thing
- That, in most projects, sets the DebugSymbols property, which really
is what is checked.
- However, two of our projects did not have that, so we always did
release mmp work.
- Removed configuration property for tests and added real "Release"
configuration option
2018-03-01 09:36:06 -06:00
Rolf Bjarne Kvinge de15337f61
[mtouch] Propagate the computed value for removal of the dynamic registrar to code shared app extensions. (#3622)
This fixes a startup crash in code shared app extensions due to having the
wrong value set in the runtime (the dynamic registrar was removed, but the
executable didn't know it).
2018-03-01 14:59:54 +01:00
Rolf Bjarne Kvinge c0c0e63a3b
[mtouch] Find the link context for code shared app extensions in the static registrar. Fixes #3514. (#3545)
When code sharing is enabled, only the container app/target will have a
LinkContext.

So make sure the static registrar finds that link context when it needs
information from the linker.

https://github.com/xamarin/xamarin-macios/issues/3514
2018-02-21 09:27:26 +01:00
Rolf Bjarne Kvinge 0561618460
[mtouch/mmp] Simplify and unify the code to select/create the static registrar. (#3461)
There's only one static registrar now, so there's no need for code to select
which one, just create the one and only.

Also unify this code between mtouch and mmp.
2018-02-12 14:42:19 +01:00
Rolf Bjarne Kvinge af03020eef
[mtouch/mmp] Give users more control over optimizations, and share more code between mtouch and mmp. (#3242)
* [mtouch/mmp] Give users more control over optimizations, and share more code between mtouch and mmp.

1. Add an --optimize flag to mtouch/mmp that allows users to select which
   optimizations to apply (or not). This makes it easier to add future
   optimizations, and allow users to disable any optimization that causes
   problems without having to disable many other features.

2. Share as much optimization code as possible between mtouch and mmp. This
   immediately gives a benefit to mmp, which has three new optimizations only
   mtouch had: NSObject.IsDirectBinding inlining, IntPtr.Size inlining and
   dead code elimination.

   This results in ~6kb of disk space saved for a linked Xamarin.Mac app:

   * link sdk: [Debug][1], [Release][2]
   * link all: [Debug][3], [Release][4]

Testing also verifies that monotouchtest ([Debug][5], [Release][6]) has not
changed size at all, which means that no default optimizations have changed
inadvertedly.

[1]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-sdk-mac--debug
[2]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-sdk-mac--release
[3]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-all-mac--debug
[4]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-all-mac--release
[5]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#monotouchtest-iphonedebug64
[6]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#monotouchtest-iphonerelease64

* [tools] Don't enable the IsDirectBinding optimization by default for Xamarin.Mac apps, it's not safe.

* Fix whitespace issues.

* [doc] Document optimizations.

* Officially support optimizations by adding them to the Versions.plist.

* [linker] Improve IntPtr.Size inliner + dead code eliminatior and add tests.

* Properly handle operands for the ldc_i4_s instruction (they're sbyte).
* Fix less-than condition to actually do a less-than comparison.
* Make sure to look up the bitness in the Target, not the Application, since
  the Application's value will be incorrect when building fat apps (both
  Is32Build and Is64Build will be true).
* Remove unnecessary checks for the IntPtr.Size inliner: this optimization
  does not depend on other instructions than the IntPtr.get_Size call, so
  remove the checks that verify surrounding instructions. This makes the
  IntPtr.Size inliner kick in in more scenarios (such as the new tests).
* Add tests.

* [tests] Add mmp tests for optimizations.

* [tests] Fix XM optimization tests.

* [tests] Fix test build error.
2018-01-23 11:33:48 +01:00
Timothy Risi 6ff74c5854 [MMP][60534] MMP Should check that Deployment Target is not below min version (#3122)
Return a build error if Deployment Target is too low
Add an mmptest for the change
2018-01-04 15:19:44 -05:00
Manuel de la Pena 1a7712f595
[MTouch] If we are building a shared code extension, do not build the msym dir. #60415 (#3016)
* [MTouch] If we are building a shared code extension, do not build the msym dir.
2017-11-17 18:24:09 +01:00
Chris Hamons c3d8555217 Move MT0091 to common code so Xamarin.Mac can benefit from the more f… (#2780)
- https://bugzilla.xamarin.com/show_bug.cgi?id=59186
2017-09-29 12:45:53 -05:00
Sebastien Pouliot 05eb96d0a7 Merge branch 'xcode9' into xcode9-master-merge 2017-09-15 11:05:30 -04:00
Manuel de la Pena 809978aa35 [mtouch] Do state why we did not copy the aot (msym) files. (#2594) 2017-09-07 13:14:53 -04:00
Rolf Bjarne Kvinge 981af59058 [mtouch] Don't allow building for 32-bit when deployment target is >= 11. Fixes #57966. (#2303)
* [mtouch] Don't allow building for 32-bit when deployment target is >= 11. Fixes #57966.

Also bump maccore to get an mlaunch error for launching a 32-bit app in a 64-bit-only simulator.

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

* [tests][msbuild] Make sure all Info.plists have deployment targets.

Otherwise we get different behavior (32-bit allowed or not) depending on which
Xcode is used to build.

* [mtouch] Default to 64-bit arch if not specified and targeting iOS 11+.

* [tests] Tweak tests to either specify a deployment target < 11 or not build a 32-bit arch.
2017-07-11 08:54:50 +02:00
Timothy Risi 25468bf617 Merge Quote methods into a single class instead of multiple versions (#2153) 2017-06-06 12:32:25 -08:00
Rolf Bjarne Kvinge d17cb6556a [mtouch] Improve how we make sure native symbols aren't stripped away. Fixes #51710 and #54417. (#2162)
* [mtouch] Improve how we make sure native symbols aren't stripped away. Fixes #51710 and #54417.

* Refactor required symbol collection to store more information about each
  symbol (field, function, Objective-C class), and in general make the code
  more straight forward.
* Implement support for generating source code that references these symbols,
  and do this whenever we can't ask the native linker to keep these symbols
  (when using bitcode). Additionally make it possible to do this manually, so
  that the source code can be generated for non-bitcode platforms too (which
  is useful if the number of symbols is enormous, in which case we might
  surpass the maximum command-line length).
* Also make it possible to completely ignore native symbols, or ignore them on
  a per-symbol basis. This provides a fallback for users if we get something
  right and we try to preserve something that shouldn't be preserved (for
  instance if it doesn't exist), and the user ends up with unfixable linker
  errors.
* Don't collect Objective-C classes unless they're in an assembly with
  LinkWith attributes. We don't need to preserve Objective-C classes in any
  other circumstances.
* Implement everything for both Xamarin.iOS and Xamarin.Mac, and share the
  code between them.
* Remove previous workaround for bug #51710, since it's no longer needed.
* Add tests.

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

* [mtouch] Make sure to only keep symbols from the current app when code sharing.

This fixes a build problem with the interdependent-binding-projects test when
testing in Today Extension mode.
2017-06-02 18:29:19 +02:00
Rolf Bjarne Kvinge 1189a5b94c [mtouch] Set the force flag again when the cache is invalid. Fixes #54973. (#2163)
In 11390f119c we stopped setting the force flag
when the cache was invalid, because we'd delete the cache anyway, and it was
determined that deleting the cache was enough.

Unfortunately it's not, because some output is not in the cache, and might not
get correctly updated.

Scenario:

* User builds app.
* User changes some build option (for instance switching off incremental
  builds).
* User does an insignificant change in a source file for the executable
  process.
* User builds app again (without cleaning). This will rebuild the exe, but
  since the change was insignificant, all the IL, except the MVID, would
  remain identical.
* mtouch would see that the command-line options changed, and invalidate the
  cache. This would delete the cache, and everything would be rebuilt,
  including AOT-compiling the assemblies again.
* When the time came for mtouch to copy assemblies to the app directory,
  mtouch would realize that the existing .exe in the app (which was not
  deleted because it's not in the cache, but the actual output directory) was
  only insignificantly different (only the MVID was different, which our cache
  logic knows to ignore when comparing assemblies), so it wouldn't copy the
  .exe to the .app.
* At runtime we'd assert, because the MVID in the aot-compiled code was
  different from the MVID in the assembly:

      error: Failed to load AOT module '(null)' while running in aot-only mode: doesn't match assembly.

* The exact assert varies depending on which build option changed. Other
  variations:

      Failed to load AOT module '(null)' while running in aot-only mode: compiled against GC (4, while the current runtime uses GC sgen)

      * Assertion at /Users/builder/data/lanes/4691/0719ced1/source/xamarin-macios/external/mono/mono/metadata/metadata.c:1118, condition `idx < t->rows' not met

Because of this I'm reverting 11390f119c, and
once again setting the force flag when the cache is invalid. It might be
overkill, but it's the safest option (cache invalidation is after all the only
hard problem in computer science), and bugs are very annoying and
timeconsuming to track down.

https://bugzilla.xamarin.com/show_bug.cgi?id=54973
2017-06-02 15:23:30 +02:00
Rolf Bjarne Kvinge 1548594e7b [mtouch] Allow code sharing assemblies from multiple locations if they're identical. Fixes #56513. (#2119)
* [mtouch] Allow code sharing assemblies from multiple locations if they're identical. Fixes #56498.

We disallow code sharing when the same assembly (based on name) is referenced
from multiple paths, but poke a hole in this logic by allowing the same
assembly from multiple paths when those assemblies are 100% identical, since
that should be 100% safe.

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

* [tests] Comment out assert that asserts due to another bug.
2017-05-25 07:10:56 +02:00
Rolf Bjarne Kvinge 4b8047977b [mtouch] Fix condition to detect a mix of dylibs and frameworks for the same library. Fixes #56679. (#2116)
https://bugzilla.xamarin.com/show_bug.cgi?id=56679
2017-05-22 19:11:34 +02:00
Rolf Bjarne Kvinge 0c87730ff1 [mtouch] Fix linking with the same third-party framework from both extension and container app. Fixes #56635. (#2112)
If both an extension and the container app (or multiple extensions) reference
the same binding assembly for a framework, then we'd error out with an
internal error when trying to copy the framework from both locations to the
container app.

So instead detect when we're trying to copy multiple identical (by comparing
the on-disk contents) frameworks, and only copy one of them.

We'll still show an error if the frameworks are different, but now a nice
MT1035 error with a proper error description instead of an internal error.

https://bugzilla.xamarin.com/show_bug.cgi?id=56635
2017-05-19 17:05:38 +02:00
Rolf Bjarne Kvinge 47319eb878 [mtouch] Strip less when running in embeddinator mode. (#2085)
Passing -x (not remove global symbols) to strip seems to work fine.
2017-05-11 10:27:27 +02:00
Rolf Bjarne Kvinge d811ef4c39 [mtouch] Fix stripping of embeddinator frameworks. (#2075) 2017-05-10 10:10:49 +02:00
Rolf Bjarne Kvinge 1eb6c335a6 [mtouch] Disable incremental builds for the simulator. Fixes #55712. (#2054)
It does not make sense to support incremental builds for the simulator (since
no AOT compilation is done), it just makes the test matrix more complicated.

So simplify things by removing support for incremental builds.

We also ignore any (other) --assembly-build-target arguments, because building
to frameworks doesn't make sense either in the simulator.

https://bugzilla.xamarin.com/show_bug.cgi?id=55712
2017-04-28 13:34:37 -04:00
Rolf Bjarne Kvinge f445856652 Merge pull request #2039 from rolfbjarne/e4k-static-registrar
Add support for the embeddinator in the static registrar.
2017-04-27 06:54:34 +02:00
Sebastien Pouliot 63a67b5287 Merge pull request #2040 from rolfbjarne/bug55555
[mtouch] Don't remove information when collecting all architectures. Fixes #55555.
2017-04-25 21:29:53 -04:00
Rolf Bjarne Kvinge d8d9a96254 [mtouch] Add support for stripping bitcode from frameworks when not needed. Fixes #55256. (#2037)
This dramatically decreases the size of watchOS apps built for debug when
using frameworks, because it ends up removing all the bitcode from
Mono.framework.

https://bugzilla.xamarin.com/show_bug.cgi?id=55256
2017-04-25 17:46:41 +02:00
Rolf Bjarne Kvinge 9cd3ab1206 [mtouch/mmp] Move --embeddinator to shared code so mmp gets it as well. 2017-04-25 16:06:41 +02:00
Rolf Bjarne Kvinge f6cbea8545 [mtouch] Don't remove information when collecting all architectures. Fixes #55555.
Of particular importance is if we're building for LLVM or not: this fixes a
bug where we wouldn't pass --llvm to the AOT compiler when compiling
assemblies to frameworks (which we do when sharing code).

https://bugzilla.xamarin.com/show_bug.cgi?id=55555
2017-04-25 14:32:08 +02:00
Rolf Bjarne Kvinge 144ff1a6ba [mtouch] A few adjustments after allowing multiple root assemblies.
* Remove the MT0008 test, since the error will never be shown again.
* Check non-existent root assemblies and report MT0018 instead of MT0007 if
  they look like command-line arguments.
* Collect all MT0018/MT0007 errors before reporting any of them.
2017-04-19 19:08:59 +02:00
Rolf Bjarne Kvinge 488cccb8d4 [mtouch] Put simulator assemblies into MonoBundle/simulator for frameworks.
Put simulator assemblies in MonoBundle/simulator for frameworks, so that we
can have a single framework that contains both device and simulator
assemblies without assemblies conflicting between device and simulator.

The device assemblies continue in the same place, in the MonoBundle directory,
so no additional checks are needed on device.
2017-04-18 15:18:46 +02:00
Rolf Bjarne Kvinge fceb49c4cd [mtouch] We need to create a fat simulator framework in embeddinator mode. 2017-04-18 11:36:29 +02:00
Rolf Bjarne Kvinge 5f1778298d [mtouch] Refactor lipo logic to a separate method. 2017-04-18 11:36:29 +02:00
Rolf Bjarne Kvinge c43eedf781 [mtouch] Make sure the platform assembly is always included in the app when in embeddinator mode. 2017-04-18 11:36:28 +02:00
Rolf Bjarne Kvinge 08ba65ce67 [mtouch] Don't try to lipo the main executable in embeddinator mode.
Don't try to lipo the main executable in embeddinator mode, because there
isn't a main executable.
2017-04-18 11:36:28 +02:00
Rolf Bjarne Kvinge ca3fc72d38 [mtouch] When in embeddinator mode, create the NOTICE in the framework instead of the app. 2017-04-18 11:36:27 +02:00
Rolf Bjarne Kvinge 4c2419f993 [mtouch] When in embeddinator mode, libxamarin and libmono are linked statically into the target framework. 2017-04-18 11:36:27 +02:00
Rolf Bjarne Kvinge d1ebaa94db [mtouch] Add an embeddinator mode. 2017-04-18 11:36:27 +02:00
Rolf Bjarne Kvinge 392deaca30 [mtouch] Refactor NOTICE writing a little bit to make it possible to write NOTICE to any directory. 2017-04-18 11:36:27 +02:00
Rolf Bjarne Kvinge 38960a5b9a [mtouch] Add support for multiple root assemblies from the command line. 2017-04-18 11:13:41 +02:00
Sebastien Pouliot d9fc5cf837 [mtouch] Update code that only considered .mdb (not .pdb) (#2003)
Also stop using `mdb` as the name for debug symbols and remove

> static MdbReader mdb_reader;

since we're not mkbundl'ing mtouch anymore.

Related to https://github.com/xamarin/xamarin-macios/pull/2002 for mmp
2017-04-17 12:48:35 +02:00
Rolf Bjarne Kvinge e61e5cce98 [mtouch] Make code sharing work on watchOS. (#1988)
* [mtouch] Only iOS has version 8 (and earlier OS versions that don't support frameworks).

* [mtouch] Update logging to be less confusing when logging about WatchKit extensions.

* [mtouch] Don't compile P/Invoke wrappers for extensions that are sharing code.

The container app already has the P/Invoke wrappers.
2017-04-11 19:20:22 +02:00
Alex Soto 2a85ec1674 [mtouch] Remove workaround for bug 43462, this fixes slow builds (bug 52545) (#1976)
https://bugzilla.xamarin.com/show_bug.cgi?id=52545

Some projects took a lot of time to build with the workaround for
bug 43462 but now that it is fixed we can remove it and stop the slowness
2017-04-10 08:20:13 +02:00
Rolf Bjarne Kvinge 0a89324b16 [mtouch] Copy aot data to the app even for assemblies that aren't copied. Fixes #54499. (#1964)
We want to copy the aot data for both the 32-bit and the 64-bit versions of an
assembly even if the 32-bit and 64-bit versions of the assembly are identical.

https://bugzilla.xamarin.com/show_bug.cgi?id=54499
2017-04-06 14:29:38 +02:00
Sebastien Pouliot 153056cf7f [mtouch] Provide a more accurate description of the MT0091 error (#1938)
The old one makes it sounds the linker is doing magic ;-)
2017-03-30 07:36:20 -05:00
Rolf Bjarne Kvinge f27ad3d413 [mtouch] Fix bundling frameworks in WatchKit 1 extensions.
No frameworks should be bundled in WatchKit 1 extensions, they should be
bundled in the container (iOS) app.

This broke when merging the equivalent fix for master into the framework-sdk
branch (i.e. a broken merge).
2017-03-15 18:34:32 +01:00
Rolf Bjarne Kvinge 65ad42cce0 Merge remote-tracking branch 'origin/master' into framework-sdk 2017-03-14 19:25:11 +01:00