Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
WIP Leverage monovm_initialize_preparsed
  • Loading branch information
mdh1418 authored and github-actions committed Sep 1, 2022
commit 1cdcdc1b41989499e5b16b1e39aa071c15a12518
2 changes: 2 additions & 0 deletions src/mono/mono/mini/monovm.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ static MonoCoreTrustedPlatformAssemblies *trusted_platform_assemblies;
static MonoCoreLookupPaths *native_lib_paths;
static MonoCoreLookupPaths *app_paths;
static MonoCoreLookupPaths *platform_resource_roots;
static MonoCoreLocalTime *local_time;

static void
mono_core_trusted_platform_assemblies_free (MonoCoreTrustedPlatformAssemblies *a)
Expand Down Expand Up @@ -220,6 +221,7 @@ monovm_initialize_preparsed (MonoCoreRuntimeProperties *parsed_properties, int p
trusted_platform_assemblies = parsed_properties->trusted_platform_assemblies;
app_paths = parsed_properties->app_paths;
native_lib_paths = parsed_properties->native_dll_search_directories;
local_time = parsed_properties->local_time;
mono_loader_install_pinvoke_override (parsed_properties->pinvoke_override);

finish_initialization ();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,16 @@ typedef struct {
char **dirs;
} MonoCoreLookupPaths;

typedef struct {
uint64_t current_local_time;
uint64_t kernel_monotonic_clock;
} MonoCoreLocalTime;

typedef struct {
MonoCoreTrustedPlatformAssemblies *trusted_platform_assemblies;
MonoCoreLookupPaths *app_paths;
MonoCoreLookupPaths *native_dll_search_directories;
MonoCoreLocalTime *local_time;
PInvokeOverrideFn pinvoke_override;
} MonoCoreRuntimeProperties;

Expand Down
10 changes: 9 additions & 1 deletion src/tasks/AndroidAppBuilder/Templates/monodroid.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,14 @@ mono_droid_runtime_init (const char* executable, int managed_argc, char* managed
const char* mitch_two = strdup (buffer_two);
appctx_values[3] = mitch_two;

MonoCoreLocalTime mclt = {
local_date_time_offset,
kernel_monotonic_clock,
};
MonoCoreRuntimeProperties mcrp = {
&mclt,
};

char *file_name = RUNTIMECONFIG_BIN_FILE;
int str_len = strlen (bundle_path) + strlen (file_name) + 1; // +1 is for the "/"
char *file_path = (char *)malloc (sizeof (char) * (str_len +1)); // +1 is for the terminating null character
Expand All @@ -267,7 +275,7 @@ mono_droid_runtime_init (const char* executable, int managed_argc, char* managed
free (file_path);
}

monovm_initialize(4, appctx_keys, appctx_values);
monovm_initialize_preparsed(&mcrp, 4, appctx_keys, appctx_values);

mono_debug_init (MONO_DEBUG_FORMAT_MONO);
mono_install_assembly_preload_hook (mono_droid_assembly_preload_hook, NULL);
Expand Down