-
Notifications
You must be signed in to change notification settings - Fork 562
[nativeaot] Next steps for the NAOT runtime #10476
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
Merged
Merged
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
dc5765a
NativeAOT runtime skeleton
grendello 08662fc
Slowly figuring out NativeAOT build complexities
grendello d0800ce
Link libc++ statically, include Android naot runtime in linking
grendello 418015d
Don't link static libc++, it causes duplicate symbol errors with libs…
grendello 42f7e10
Add logging to the naot android runtime
grendello 1e0fc7f
Typo
grendello 66fcd10
Shared code (gc bridge, os bridge), p/invokes
grendello 178745b
Host code sharing tweaks
grendello 9c5245d
Hook up NAOT-specific GC bridge code
grendello 002d827
Enable ManagedTypeManager
grendello be644f8
Bring in the rest of relevant changes from #10402
grendello 5fe1fb7
Temporarily add this, to be removed before merging
grendello 7089008
Support logger configuration via the standard XA properties
grendello f9e0d9b
Beginnings of support for calling custom JNI_OnLoad functions
grendello a3eabc9
Assembly source generation
grendello 01bc983
JNI on-load initialization of libraries
grendello e58d84b
Support for environment variables, TBC
grendello 1c90315
[WIP] environment variables + system properties support
grendello c76ef87
Environment variables support complete
grendello 0cc262a
Address feedback
grendello afa83ee
Remove log spam
grendello 12c07d1
Initialize max gref count
grendello c2bda46
[WIP] System properties
grendello 593a075
Partial support for system properties
grendello 1d6b5dc
Fix after rebase
grendello 5365266
Post-rebase fixes
grendello bc4134d
System properties work now
grendello 6300544
Share env & sys prop code with CoreCLR
grendello e95a7a2
Statically link libc++, shrink apk by around 8mb
grendello 350e543
not needed
grendello 25083df
Fixlet
grendello f3e1b3b
Shared libc++ is no longer packaged (or needed)
grendello File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
naot.system.property=testing 1 2 3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#pragma once | ||
|
||
#include <xamarin-app.hh> | ||
#include <host/host-environment.hh> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#pragma once | ||
|
||
#include <cerrno> | ||
#include <cstdlib> | ||
#include <cstring> | ||
#include <string_view> | ||
|
||
#include <runtime-base/logger.hh> | ||
|
||
struct AppEnvironmentVariable; | ||
|
||
namespace xamarin::android { | ||
class HostEnvironment | ||
{ | ||
public: | ||
static void init () noexcept; | ||
|
||
[[gnu::flatten, gnu::always_inline]] | ||
static void set_variable (const char *name, const char *value) noexcept | ||
{ | ||
log_debug (LOG_DEFAULT, " Variable {} = '{}'", optional_string (name), optional_string (value)); | ||
if (::setenv (name, value, 1) < 0) { | ||
log_warn (LOG_DEFAULT, "Failed to set environment variable '{}': {}", name, ::strerror (errno)); | ||
} | ||
} | ||
|
||
[[gnu::flatten, gnu::always_inline]] | ||
static void set_variable (std::string_view const& name, std::string_view const& value) noexcept | ||
{ | ||
set_variable (name.data (), value.data ()); | ||
} | ||
|
||
[[gnu::flatten, gnu::always_inline]] | ||
static void set_system_property (const char *name, const char *value) noexcept | ||
{ | ||
// TODO: should we **actually** try to set the system property here? Would that even work? Needs testing | ||
log_debug (LOG_DEFAULT, " System property {} = '{}'", optional_string (name), optional_string (value)); | ||
} | ||
|
||
[[gnu::flatten, gnu::always_inline]] | ||
static auto lookup_system_property (std::string_view const& name, size_t &value_len, | ||
uint32_t const count, AppEnvironmentVariable const (&entries)[], | ||
const char (&contents)[]) noexcept -> const char* | ||
{ | ||
if (count == 0) { | ||
return nullptr; | ||
} | ||
|
||
for (size_t i = 0; i < count; i++) { | ||
AppEnvironmentVariable const& sys_prop = entries[i]; | ||
const char *prop_name = &contents[sys_prop.name_index]; | ||
if (name.compare (prop_name) != 0) { | ||
continue; | ||
} | ||
|
||
const char *prop_value = &contents[sys_prop.value_index]; | ||
value_len = strlen (prop_value); | ||
return prop_value; | ||
} | ||
|
||
return nullptr; | ||
} | ||
|
||
template<void (*setter)(const char *name, const char *value) noexcept> [[gnu::flatten, gnu::always_inline]] | ||
static void set_values (uint32_t const& count, AppEnvironmentVariable const (&entries)[], const char (&contents)[]) noexcept | ||
grendello marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
for (size_t i = 0; i < count; i++) { | ||
AppEnvironmentVariable const& env_var = entries[i]; | ||
const char *var_name = &contents[env_var.name_index]; | ||
const char *var_value = &contents[env_var.value_index]; | ||
|
||
setter (var_name, var_value); | ||
} | ||
} | ||
}; | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.