Permalink
Browse files

Merge pull request #28 from Unity-Technologies/mono-bisect

Mono bisect
  • Loading branch information...
2 parents fc98465 + db0ce70 commit 9ee5f9da4a99fd0b14a55d4b2aabd92e0a5dfeb1 @Tak Tak committed May 29, 2012
Showing with 48 additions and 4 deletions.
  1. +1 −0 build_runtime_iphone.sh
  2. +11 −3 build_runtime_linux.pl
  3. +24 −1 mono/mini/aot-compiler.c
  4. +11 −0 mono/mini/aot-runtime.c
  5. +1 −0 mono/mini/mini.h
View
@@ -133,6 +133,7 @@ build_iphone_simulator ()
export MACSDKOPTIONS="-miphoneos-version-min=3.0 $MACSYSROOT"
export CC="$SIMULATOR_ASPEN_ROOT/usr/bin/gcc -arch i386"
export CXX="$SIMULATOR_ASPEN_ROOT/usr/bin/g++ -arch i386"
+ export LIBTOOLIZE=`which glibtoolize`
perl build_runtime_osx.pl -iphone_simulator=1 || exit 1
echo "Copying iPhone simulator static lib to final destination";
mkdir -p builds/embedruntimes/iphone
View
@@ -9,14 +9,18 @@
my $debug = 0;
my $minimal = 0;
my $build64 = 0;
+my $build_armel = 0;
GetOptions(
"skipbuild=i"=>\$skipbuild,
"debug=i"=>\$debug,
"minimal=i"=>\$minimal,
"build64=i"=>\$build64,
+ "build-armel=i"=>\$build_armel,
) or die ("illegal cmdline options");
+die ("illegal cmdline options") if ($build64 and $build_armel);
+
my $teamcity=0;
if ($ENV{UNITY_THISISABUILDMACHINE})
{
@@ -31,7 +35,7 @@
}
}
-my $platform = $build64 ? 'linux64' : 'linux32' ;
+my $platform = $build64 ? 'linux64' : $buildarm ? 'linux-armel' : 'linux32' ;
my $bintarget = "$root/builds/monodistribution/bin-$platform";
my $libtarget = "$root/builds/embedruntimes/$platform";
@@ -52,10 +56,14 @@
my $archflags = '';
- if (not $build64)
+ if (not $build64 and not $build_armel)
{
$archflags = '-m32';
}
+ if ($build_armel)
+ {
+ $archflags = '-marm -DARM_FPU_NONE';
+ }
if ($debug)
{
$ENV{CFLAGS} = "$archflags -g -O0";
@@ -86,7 +94,7 @@
unshift(@autogenparams, "--with-glib=embedded");
unshift(@autogenparams, "--disable-nls"); #this removes the dependency on gettext package
unshift(@autogenparams, "--disable-parallel-mark"); #this causes crashes
- if(not $build64)
+ if(not $build64 and not $build_armel)
{
unshift(@autogenparams, "--build=i686-pc-linux-gnu"); #Force x86 build
}
View
@@ -2696,7 +2696,8 @@ emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, gui
MonoCompile *callee_cfg = g_hash_table_lookup (acfg->method_to_cfg, patch_info->data.method);
//printf ("DIRECT: %s %s\n", method ? mono_method_full_name (method, TRUE) : "", mono_method_full_name (callee_cfg->method, TRUE));
direct_call = TRUE;
- sprintf (direct_call_target, "%sm_%x", acfg->temp_prefix, get_method_index (acfg, callee_cfg->orig_method));
+ sprintf (direct_call_target, "%sm_%x", "_", get_method_index (acfg, callee_cfg->orig_method));
+ callee_cfg->asm_symbol = g_strdup(direct_call_target);
patch_info->type = MONO_PATCH_INFO_NONE;
acfg->stats.direct_calls ++;
}
@@ -2866,6 +2867,10 @@ emit_method_code (MonoAotCompile *acfg, MonoCompile *cfg)
emit_label (acfg, debug_sym);
}
+ sprintf (symbol, "%sm_%x", "_", method_index);
+ cfg->asm_symbol = g_strdup(symbol);
+ emit_label (acfg, symbol);
+
if (cfg->verbose_level > 0)
g_print ("Method %s emitted as %s\n", mono_method_full_name (method, TRUE), symbol);
@@ -4329,6 +4334,24 @@ emit_code (MonoAotCompile *acfg)
emit_method_code (acfg, acfg->cfgs [i]);
}
+ sprintf (symbol, "method_addresses");
+ emit_section_change (acfg, ".text", 1);
+ emit_alignment (acfg, 8);
+ emit_label (acfg, symbol);
+
+ for (i = 0; i < acfg->nmethods; ++i) {
+ if (acfg->cfgs [i]) {
+ if (acfg->cfgs [i]->asm_symbol)
+ emit_pointer (acfg, acfg->cfgs [i]->asm_symbol);
+ else {
+ sprintf (symbol, "%sm_%x", acfg->temp_prefix, i);
+ emit_pointer (acfg, symbol);
+ }
+ } else {
+ emit_pointer (acfg, NULL);
+ }
+ }
+
sprintf (symbol, "methods_end");
emit_section_change (acfg, ".text", 0);
emit_global (acfg, symbol, FALSE);
View
@@ -94,6 +94,7 @@ typedef struct MonoAotModule {
guint8 *plt;
guint8 *plt_end;
guint32 *code_offsets;
+ gpointer *method_addresses;
guint8 *method_info;
guint32 *method_info_offsets;
guint8 *got_info;
@@ -1075,6 +1076,7 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
/* Read method and method_info tables */
find_symbol (sofile, globals, "method_offsets", (gpointer*)&amodule->code_offsets);
+ find_symbol (sofile, globals, "method_addresses", (gpointer*)&amodule->method_addresses);
find_symbol (sofile, globals, "methods", (gpointer*)&amodule->code);
find_symbol (sofile, globals, "methods_end", (gpointer*)&amodule->code_end);
find_symbol (sofile, globals, "method_info_offsets", (gpointer*)&amodule->method_info_offsets);
@@ -1102,6 +1104,15 @@ load_aot_module (MonoAssembly *assembly, gpointer user_data)
find_symbol (sofile, globals, "plt", (gpointer*)&amodule->plt);
find_symbol (sofile, globals, "plt_end", (gpointer*)&amodule->plt_end);
+ /* Compute code_offsets from the method addresses */
+ amodule->code_offsets = g_malloc0 (amodule->info.nmethods * sizeof (gint32));
+ for (i = 0; i < amodule->info.nmethods; ++i) {
+ if (!amodule->method_addresses [i])
+ amodule->code_offsets [i] = 0xffffffff;
+ else
+ amodule->code_offsets [i] = (char*)amodule->method_addresses [i] - (char*)amodule->code;
+ }
+
if (make_unreadable) {
#ifndef PLATFORM_WIN32
guint8 *addr;
View
@@ -1114,6 +1114,7 @@ typedef struct {
/* Used by AOT */
guint32 got_offset;
+ char *asm_symbol;
} MonoCompile;
typedef enum {

0 comments on commit 9ee5f9d

Please sign in to comment.