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

[monodroid] Add libjava-interop sources to runtime sources #1675

Merged

Conversation

radekdoulik
Copy link
Member

@radekdoulik radekdoulik commented May 11, 2018

Also add MonoThread and mono_thread_current to dylib.

Fixed monodroid_mono_class_get_field_from_name_fptr signature, where
we were missing const for 2nd argument.

Used relevant types in the monodroid_mono_class_from_mono_type_fptr
signature.

@radekdoulik radekdoulik added the do-not-merge PR should not be merged. label May 11, 2018
@radekdoulik radekdoulik requested a review from jonpryor May 11, 2018 21:15
@radekdoulik
Copy link
Member Author

It depends on dotnet/java-interop#319, so it will not build yet.

<_HostUnixCFlags>$(_CommonCFlags) -Wa,--noexecstack</_HostUnixCFlags>
<_HostUnixLdFlags>-Wall -lstdc++ -lz -shared -fpic</_HostUnixLdFlags>
<_HostCommonWinCFlags>$(_CommonCFlags) -DWINDOWS -DNTDDI_VERSION=NTDDI_VISTA -D_WIN32_WINNT=_WIN32_WINNT_VISTA -fomit-frame-pointer</_HostCommonWinCFlags>
<_HostCommonWinLdFlags>-Wall -lstdc++ -lz -shared -fpic -ldl -lmman -pthread -lwsock32 -lole32 -luuid -lshlwapi -lpsapi</_HostCommonWinLdFlags>
<_UnixAdditionalSourceFiles>$(MonoSourceFullPath)\support\nl.c jni\debug.c jni\monodroid-networkinfo.c jni\xamarin_getifaddrs.c</_UnixAdditionalSourceFiles>
<_HostAdditionalSourceFiles>$(JavaInteropSourceDirectory)\src\java-interop\java-interop-gc-bridge-mono.c $(JavaInteropSourceDirectory)\src\java-interop\java-interop.c $(JavaInteropSourceDirectory)\src\java-interop\java-interop-mono.c</_HostAdditionalSourceFiles>
Copy link
Member

Choose a reason for hiding this comment

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

These files shouldn't be limited to "the host"; they should be present in all versions, i.e. part of @(_CFile).

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't want to increase the device runtime size yet. I have added it to all runtimes then. Let see if it works.

On desktop the jnimarshalmethod-gen.exe crashes now, hopefully I can fix it today.

@radekdoulik radekdoulik force-pushed the pr-add-java-interop-to-host-runtimes branch from 2eabca6 to 53b4bd3 Compare May 15, 2018 09:06
@radekdoulik radekdoulik changed the title [monodroid] Add libjava-interop sources to host runtime sources [monodroid] Add libjava-interop sources to runtime sources May 15, 2018
@radekdoulik radekdoulik force-pushed the pr-add-java-interop-to-host-runtimes branch from 53b4bd3 to 38285a3 Compare May 16, 2018 11:55
@@ -249,6 +250,7 @@ typedef void (*monodroid_mono_set_signal_chaining_fptr)(mono_bool cha
typedef MonoString* (*monodroid_mono_string_new_fptr)(MonoDomain *domain, const char *text);
typedef void* (*monodroid_mono_thread_attach_fptr) (MonoDomain *domain);
typedef void (*monodroid_mono_thread_create_fptr) (MonoDomain *domain, void* func, void* arg);
typedef MonoThread* (*monodroid_mono_thread_current) (void);
Copy link
Member

Choose a reason for hiding this comment

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

This typedef should have an _fptr suffix.

@@ -312,6 +314,7 @@ struct DylibMono {

monodroid_mono_domain_foreach_fptr mono_domain_foreach;
monodroid_mono_thread_create_fptr mono_thread_create;
monodroid_mono_thread_current mono_thread_current;
Copy link
Member

Choose a reason for hiding this comment

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

This line should be last in the struct, as per the comment at the beginning of the struct.

Copy link
Member Author

Choose a reason for hiding this comment

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

Doh, I missed that comment. It is needed for ABI compatibility I guess. Fixed.

Also add `MonoThread` and `mono_thread_current` to *dylib*.

Fixed `monodroid_mono_class_get_field_from_name_fptr` signature, where
we were missing *const* for 2nd argument.

Used relevant types in the `monodroid_mono_class_from_mono_type_fptr`
signature.
@radekdoulik radekdoulik force-pushed the pr-add-java-interop-to-host-runtimes branch from 38285a3 to 2da3bcd Compare May 17, 2018 07:15
@radekdoulik radekdoulik removed the do-not-merge PR should not be merged. label May 17, 2018
@jonpryor jonpryor merged commit 88ef36b into dotnet:master May 17, 2018
jonpryor added a commit that referenced this pull request May 18, 2018
This reverts commit 88ef36b.

Commit 88ef36b broke the [full master build][0] because the
`java-interop` sources don't build under Windows:

[0]: https://jenkins.mono-project.com/view/Xamarin.Android/job/xamarin-android/1010/

	"/Users/builder/android-toolchain/mxe-b9cbb53/bin/x86_64-w64-mingw32.static-gcc" -o "…/xamarin-android/bin/Debug/lib/xamarin.android/xbuild/Xamarin/Android/lib/host-mxe-Win64/libmono-android.debug.dll" ...
	/var/folders/x8/jnqh86dn7t90f9wccp0g0hqh0000gn/T//ccpnkdsJ.o: In function `ji_realpath': (TaskId:1201)
	…/xamarin-android/external/Java.Interop/src/java-interop/java-interop-gc-bridge-mono.c:158: undefined reference to `realpath'
	collect2 : error : ld returned 1 exit status […/xamarin-android/src/monodroid/monodroid.csproj]

Revert the inclusion of `java-interop` sources until they're buildable
under MXE/Windows.
radekdoulik added a commit to radekdoulik/xamarin-android that referenced this pull request May 23, 2018
Context: https://github.com/xamarin/xamarin-android/projects/1

Bumps to Java.Interop/master/5c35bcb0

Begin merging the `Java.Interop/src/java-interop` library code into
`src/monodroid` so that we can eventually unify the GC Bridge logic
between the two repos.

Add `MonoThread` and `mono_thread_current()` to `dylib-mono.h`.

Fixed `monodroid_mono_class_get_field_from_name_fptr()` signature,
where we were missing `const` for 2nd argument.

Used relevant types in the
`monodroid_mono_class_from_mono_type_fptr()` signature.
radekdoulik added a commit to radekdoulik/xamarin-android that referenced this pull request May 24, 2018
Context: https://github.com/xamarin/xamarin-android/projects/1

Bumps to Java.Interop/master/5c35bcb0

Begin merging the `Java.Interop/src/java-interop` library code into
`src/monodroid` so that we can eventually unify the GC Bridge logic
between the two repos.

Add `MonoThread` and `mono_thread_current()` to `dylib-mono.h`.

Fixed `monodroid_mono_class_get_field_from_name_fptr()` signature,
where we were missing `const` for 2nd argument.

Used relevant types in the
`monodroid_mono_class_from_mono_type_fptr()` signature.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants