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

[WIP] Libcore10 - Android10 runtime #527

Draft
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

dkimitsa
Copy link
Contributor

@dkimitsa dkimitsa commented Oct 7, 2020

This PR proposes replaces Java Runtime classes used in RoboVM (Android 4.4 base) with ones from Android10 (R45)

Scope of changes

  • Java RT classes were completely replaced (check TODO section bellow);
  • JNI code was replaced
  • RoboVM core/boot code was adapted to Java RT

Highlights

TODO/FIXME

  • core lang classes (like Object, String, Thread) were left and adapted from Android 4.4 as corresponding JNI code significantly differs that requires big effort for adaptation (will be done later). As result some API might be missing;
  • several places in code are not implemented/adapted yet (marked as RoboVM TODO: FIXME) that might affect particular APIs;

Test builds

There are several options to get test build:

  1. Build from source code
  2. Download pre-build Idea plugin from Releases section;
  3. Setup Custom plugin repository as described by link:
  • add https://dkimitsa.github.io/assets/updatePlugins.xml as custom plugin repository;
  • in marketplace's search bar enter repository: https://dkimitsa.github.io/assets/updatePlugins.xml;
  • install RoboVM - Libcore 10 plugin from there.

Issue reporting

Please open the issue in the robovm-libcore10-smoketest tracker that was created for testing of libcore10.

Updates/tech notes

Will be post technical details in blog under libcore10 tag

…, removed shade plugin as it will be not required.
- dalvik
- libart
- luni
- ojluni
- json
- xml

What was not copied:
- tests
- ojluni/annotataions
- all native code (as its subject for VM folder)
…ere three folders of sources:

common, openjdk, platform, publicapi. Sources from them were copied into single folder. There were conflicts for files: Platform.java and NativeCryptoJni.java ones from platform/ folder were preferred

What was not copied:
- tests
…che-http, apache-xml (FIXME: return if once detected that these are required)
- bouncycastle
- javasqlite
- okhttp

What was not copied:
- tests
- samples
- native code
…able in LC10, copied implementation to ArrayUtils
…s. As it requires support for SerializedLambda which is missing (due not full support of dynamic invoke in RoboVM). Otherwise it breaks compilation with error message:

> error: cannot find symbol
> symbol: method getImplMethodKind()
> location: interface SerializedLambda
…ot supported/not used code(more to go later):

- removed everything related to dynamic invoke -- as not supported by compiler and RoboVM uses own stubs.
- removed not used classes that break compilation
… one from R45, copied mostly required source codes. CMakeFiles were built from Android.bp. Not compilable for now. Also openssl replaced with boringssl.

Code just was copied. No changes or compilation yet
…e folders: luni, ojluni and libnativehelper. Also there was conflict in function names. This is solved by moving all constants to single file to libnativehelper
…changes:

- OsConstants -- all linux constants that are not available on MAC/iOS are put behind #ifdef
- Portability.h -- copied workarounds from old RoboVM
- Linux related code -- removed from compilation (as uses not available on MAC apis)
- Openjdk_Jvm -- remove unused and unsupported code, not implemented stubs marked with TODO
… code to be changed as it relies on ART implementation. Quickest way to get Libcore10 running is to reuse old primitives that run on existing Dalvik/RoboVM implementation.

Warning: This commit makes Java classes not compilable intentionally and allows to track changes done to files from RoboVM/Dalvik tree
…able as it is not part of temporally used reflect package from luni4
- System.arraycopy reverted to RoboVM implementation to use existing native code
- project wide applied `RoboVM` marked changes from RoboVM project
…ion from luni4 as Linux implementation required lot of API not available on MacOS/iOS. Libcore10 code adapted to it. android.system.Os commented out as mostly duplicates OS class (and has same dependency to Linux issues)
…ve to be C functions as being called from C code. Also separated register_ and onLoad calls (as onLoad should be called once all native methods are registered)
…m OpenJDK, also copied KQueue implementations from there. As existing android code works against Linux one that is not available on MAC/iOS
…itialized from embedded and packed one. Also icu4j adapted to use .dat file from native part. As its expensive to keep two copies: for native part and icu java resources for icu4j
…e to use URI instead of File for certificate store. This allows to use certificates packed into jar as it was in luni4 RoboVM.
…reflect Libcore10. Can run basic console app (Hooray!)
…'` when compiling native part for release, using recent Xcode
Root case: wrong application path was set for console target when running under debugger.
# Conflicts:
#	compiler/compiler/src/main/java/org/robovm/compiler/plugin/debug/DebuggerLaunchPlugin.java
#	compiler/rt/libcore/crypto/src/main/java/org/conscrypt/NativeCrypto.java
#	compiler/rt/libcore/crypto/src/main/java/org/conscrypt/OpenSSLSocketImpl.java
#	compiler/rt/libcore/libdvm/src/main/java/java/lang/Daemons.java
#	compiler/vm/rt/android/external/openssl/ssl/t1_lib.c
#	compiler/vm/rt/android/libcore/crypto/src/main/native/org_conscrypt_NativeCrypto.cpp
@ice1000
Copy link

ice1000 commented Apr 30, 2023

Many thanks for making this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants