Merge pull request #4621 from alexanderkyte/strdup_env
[mono.git] / mono / mini / mini-llvm.c
index 745c29f13e48c77af959d7d831544421eda14bcf..0500f102a5729388457926e6b6554c9ab7ca574c 100644 (file)
@@ -1,5 +1,6 @@
-/*
- * mini-llvm.c: llvm "Backend" for the mono JIT
+/**
+ * \file
+ * llvm "Backend" for the mono JIT
  *
  * Copyright 2009-2011 Novell Inc (http://www.novell.com)
  * Copyright 2011 Xamarin Inc (http://www.xamarin.com)
@@ -9,7 +10,7 @@
 #include "config.h"
 
 #include <mono/metadata/debug-helpers.h>
-#include <mono/metadata/debug-mono-symfile.h>
+#include <mono/metadata/debug-internals.h>
 #include <mono/metadata/mempool-internals.h>
 #include <mono/metadata/environment.h>
 #include <mono/metadata/object-internals.h>
@@ -483,13 +484,9 @@ type_to_llvm_type (EmitContext *ctx, MonoType *t)
                return LLVMInt16Type ();
        case MONO_TYPE_U4:
                return LLVMInt32Type ();
-       case MONO_TYPE_BOOLEAN:
-               return LLVMInt8Type ();
        case MONO_TYPE_I8:
        case MONO_TYPE_U8:
                return LLVMInt64Type ();
-       case MONO_TYPE_CHAR:
-               return LLVMInt16Type ();
        case MONO_TYPE_R4:
                return LLVMFloatType ();
        case MONO_TYPE_R8:
@@ -498,10 +495,6 @@ type_to_llvm_type (EmitContext *ctx, MonoType *t)
        case MONO_TYPE_U:
                return IntPtrType ();
        case MONO_TYPE_OBJECT:
-       case MONO_TYPE_CLASS:
-       case MONO_TYPE_ARRAY:
-       case MONO_TYPE_SZARRAY:
-       case MONO_TYPE_STRING:
        case MONO_TYPE_PTR:
                return ObjRefType ();
        case MONO_TYPE_VAR:
@@ -6937,13 +6930,16 @@ emit_method_inner (EmitContext *ctx)
                static int count = 0;
                count ++;
 
-               if (g_getenv ("LLVM_COUNT")) {
-                       if (count == atoi (g_getenv ("LLVM_COUNT"))) {
+               char *llvm_count_str = g_getenv ("LLVM_COUNT");
+               if (llvm_count_str) {
+                       int lcount = atoi (llvm_count_str);
+                       g_free (llvm_count_str);
+                       if (count == lcount) {
                                printf ("LAST: %s\n", mono_method_full_name (cfg->method, TRUE));
                                fflush (stdout);
                                last = TRUE;
                        }
-                       if (count > atoi (g_getenv ("LLVM_COUNT"))) {
+                       if (count > lcount) {
                                set_failure (ctx, "count");
                                return;
                        }
@@ -9020,7 +9016,7 @@ emit_dbg_subprogram (EmitContext *ctx, MonoCompile *cfg, LLVMValueRef method, co
        if (!minfo)
                return NULL;
 
-       mono_debug_symfile_get_seq_points (minfo, &source_file, NULL, NULL, &sym_seq_points, &n_seq_points);
+       mono_debug_get_seq_points (minfo, &source_file, NULL, NULL, &sym_seq_points, &n_seq_points);
        if (!source_file)
                source_file = g_strdup ("<unknown>");
        dir = g_path_get_dirname (source_file);
@@ -9116,7 +9112,7 @@ emit_dbg_loc (EmitContext *ctx, LLVMBuilderRef builder, const unsigned char *cil
                MonoDebugSourceLocation *loc;
                LLVMValueRef loc_md;
 
-               loc = mono_debug_symfile_lookup_location (ctx->minfo, cil_code - cfg->header->code);
+               loc = mono_debug_method_lookup_location (ctx->minfo, cil_code - cfg->header->code);
 
                if (loc) {
 #if LLVM_API_VERSION > 100
@@ -9134,7 +9130,7 @@ emit_dbg_loc (EmitContext *ctx, LLVMBuilderRef builder, const unsigned char *cil
                        loc_md = LLVMMDNode (md_args, nmd_args);
                        LLVMSetCurrentDebugLocation (builder, loc_md);
 #endif
-                       mono_debug_symfile_free_location (loc);
+                       mono_debug_free_source_location (loc);
                }
        }
 }