Mon Oct 13 11:00:49 CEST 2008 Paolo Molaro <lupus@ximian.com>
authorPaolo Molaro <lupus@oddwiz.org>
Mon, 13 Oct 2008 09:04:45 +0000 (09:04 -0000)
committerPaolo Molaro <lupus@oddwiz.org>
Mon, 13 Oct 2008 09:04:45 +0000 (09:04 -0000)
* domain.c, assembly.c, debug-mono-symfile.c, debug-mono-symfile.h,
monosn.c, Makefile.am, pedump.c, image.c, metadata-internals.h,
reflection.c: remove rawbuffer usage: mmap support is more sanely
provided by utils/mono-mmap.

svn path=/trunk/mono/; revision=115639

mono/metadata/ChangeLog
mono/metadata/Makefile.am
mono/metadata/assembly.c
mono/metadata/debug-mono-symfile.c
mono/metadata/debug-mono-symfile.h
mono/metadata/domain.c
mono/metadata/image.c
mono/metadata/metadata-internals.h
mono/metadata/monosn.c
mono/metadata/pedump.c
mono/metadata/reflection.c

index daee8ff580c932aa42ed238df5fcf53e86b1b701..edea28d5fc5ff38626e49cdc410e26050f48525d 100644 (file)
@@ -1,4 +1,11 @@
 
+Mon Oct 13 11:00:49 CEST 2008 Paolo Molaro <lupus@ximian.com>
+
+       * domain.c, assembly.c, debug-mono-symfile.c, debug-mono-symfile.h,
+       monosn.c, Makefile.am, pedump.c, image.c, metadata-internals.h,
+       reflection.c: remove rawbuffer usage: mmap support is more sanely
+       provided by utils/mono-mmap.
+
 Sat Oct 11 19:46:19 CEST 2008 Paolo Molaro <lupus@ximian.com>
 
        * gc.c: use posix semaphores when possible so that
index cfc2cbb5ed3a3c8d19112d8c1ab218690973a890..2cc60a1682f282f9a3b9b27d46e0c189fda34145 100644 (file)
@@ -130,8 +130,6 @@ libmonoruntime_la_SOURCES = \
        mono-endian.c   \
        mono-endian.h   \
        mono-config.c   \
-       rawbuffer.c     \
-       rawbuffer.h     \
        loader.c        \
        class.c         \
        class-internals.h               \
index 1f2cc23f2004e0fedf5c4c7ddb05539860538b62..1aa863d6af16f078c1d810015af72f1d47c1de6f 100644 (file)
@@ -15,7 +15,6 @@
 #include <stdlib.h>
 #include "assembly.h"
 #include "image.h"
-#include "rawbuffer.h"
 #include "object-internals.h"
 #include <mono/metadata/loader.h>
 #include <mono/metadata/tabledefs.h>
index 73aefd52b1f936cf9d5b3b8011078107e3dce423..a1490eabdcb897ab7efa549036a0d280f227c185 100644 (file)
@@ -10,7 +10,6 @@
 #include <sys/stat.h>
 #include <mono/metadata/metadata.h>
 #include <mono/metadata/tabledefs.h>
-#include <mono/metadata/rawbuffer.h>
 #include <mono/metadata/tokentype.h>
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/exception.h>
@@ -21,6 +20,7 @@
 #include <mono/metadata/mono-endian.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/class-internals.h>
+#include <mono/utils/mono-mmap.h>
 
 #include <fcntl.h>
 #ifdef HAVE_UNISTD_H
@@ -128,7 +128,7 @@ mono_debug_open_mono_symbols (MonoDebugHandle *handle, const guint8 *raw_content
                                                   symfile->filename,  g_strerror (errno));
                        } else {
                                symfile->raw_contents_size = stat_buf.st_size;
-                               symfile->raw_contents = mono_raw_buffer_load (fileno (f), FALSE, 0, stat_buf.st_size);
+                               symfile->raw_contents = mono_file_map (stat_buf.st_size, MONO_MMAP_READ|MONO_MMAP_PRIVATE, fileno (f), 0, &symfile->raw_contents_handle);
                        }
 
                        fclose (f);
@@ -159,7 +159,7 @@ mono_debug_close_mono_symbol_file (MonoSymbolFile *symfile)
                g_hash_table_destroy (symfile->method_hash);
 
        if (symfile->raw_contents)
-               mono_raw_buffer_free ((gpointer) symfile->raw_contents);
+               mono_file_unmap ((gpointer) symfile->raw_contents, symfile->raw_contents_handle);
 
        if (symfile->filename)
                g_free (symfile->filename);
index 53078948e9c359b509e1a8f3e0ec2a9c8f10a2c2..0fed5239946c5fce04a2d4842f0b85f8425a9205 100644 (file)
@@ -85,6 +85,7 @@ struct _MonoDebugLineNumberEntry {
 struct _MonoSymbolFile {
        const guint8 *raw_contents;
        int raw_contents_size;
+       void *raw_contents_handle;
        int major_version;
        int minor_version;
        gchar *filename;
index ea3e19c272f18aadaaece22b2aaf83a6c2da8d2f..62e09e60fae2b3c349df976c4610b5ad27a09fe6 100644 (file)
@@ -25,7 +25,6 @@
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/exception.h>
-#include <mono/metadata/rawbuffer.h>
 #include <mono/metadata/metadata-internals.h>
 #include <mono/metadata/gc-internal.h>
 #include <mono/metadata/appdomain.h>
@@ -1245,7 +1244,6 @@ mono_init_internal (const char *filename, const char *exe_filename, const char *
        InitializeCriticalSection (&appdomains_mutex);
 
        mono_metadata_init ();
-       mono_raw_buffer_init ();
        mono_images_init ();
        mono_assemblies_init ();
        mono_classes_init ();
@@ -1686,7 +1684,6 @@ mono_cleanup (void)
        mono_assemblies_cleanup ();
        mono_images_cleanup ();
        mono_debug_cleanup ();
-       mono_raw_buffer_cleanup ();
        mono_metadata_cleanup ();
 
        TlsFree (appdomain_thread_id);
index 9565ee8d42a45fa8c292a92f0e63bce0b71c160f..8fbf110ae78137ac5b4849bf57f6eef912339423 100644 (file)
@@ -17,7 +17,6 @@
 #include <string.h>
 #include "image.h"
 #include "cil-coff.h"
-#include "rawbuffer.h"
 #include "mono-endian.h"
 #include "tabledefs.h"
 #include "tokentype.h"
@@ -29,6 +28,7 @@
 #include <mono/io-layer/io-layer.h>
 #include <mono/utils/mono-logger.h>
 #include <mono/utils/mono-path.h>
+#include <mono/utils/mono-mmap.h>
 #include <mono/utils/mono-io-portability.h>
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/assembly.h>
@@ -932,7 +932,7 @@ do_mono_image_open (const char *fname, MonoImageOpenStatus *status,
        image = g_new0 (MonoImage, 1);
        image->raw_buffer_used = TRUE;
        image->raw_data_len = stat_buf.st_size;
-       image->raw_data = mono_raw_buffer_load (fileno (filed), FALSE, 0, stat_buf.st_size);
+       image->raw_data = mono_file_map (stat_buf.st_size, MONO_MMAP_READ|MONO_MMAP_PRIVATE, fileno (filed), 0, &image->raw_data_handle);
        iinfo = g_new0 (MonoCLIImageInfo, 1);
        image->image_info = iinfo;
        image->name = mono_path_resolve_symlinks (fname);
@@ -1414,7 +1414,7 @@ mono_image_close (MonoImage *image)
 
        if (image->raw_buffer_used) {
                if (image->raw_data != NULL)
-                       mono_raw_buffer_free (image->raw_data);
+                       mono_file_unmap (image->raw_data, image->raw_data_handle);
        }
        
        if (image->raw_data_allocated) {
index be2968f0f2e9775d8c378a1db9de9870bec52653..71a3ec875aee2de0ea7a83e62ac87f80f25d98a5 100644 (file)
@@ -79,6 +79,7 @@ struct _MonoImage {
         * this image between calls of mono_image_open () and mono_image_close ().
         */
        int   ref_count;
+       void *raw_data_handle;
        char *raw_data;
        guint32 raw_data_len;
        guint8 raw_buffer_used    : 1;
index a4aeea3fe41633e46f97166d788b87b19545dc98..225ea05f8f73908b42fedc949d21534f275d542a 100644 (file)
@@ -70,7 +70,6 @@ show_token (const char *file, int is_assembly, int show_pubkey) {
                guint32 len;
 
                mono_metadata_init ();
-        mono_raw_buffer_init ();
         mono_images_init ();
         mono_assemblies_init ();
         mono_loader_init ();
index 39f9630e9dcbba774fb9d6156082b498a0403bfe..ae3d26b5ba9f47f89312ac1d9ac1f6086c11b648 100644 (file)
@@ -21,7 +21,6 @@
 #include <mono/metadata/appdomain.h>
 #include <mono/metadata/assembly.h>
 #include <mono/metadata/metadata-internals.h>
-#include <mono/metadata/rawbuffer.h>
 #include <mono/metadata/class-internals.h>
 #include <mono/metadata/verify-internals.h>
 #include "mono/utils/mono-digest.h"
@@ -434,7 +433,6 @@ main (int argc, char *argv [])
                usage ();
 
        mono_metadata_init ();
-       mono_raw_buffer_init ();
        mono_images_init ();
        mono_assemblies_init ();
        mono_loader_init ();
index db31865e9a2eea6f21fc4b689394a5b5507fd929..c9d97cda831182f552b90962f8b0073b1130f8e8 100644 (file)
@@ -32,7 +32,6 @@
 #include <ctype.h>
 #include "image.h"
 #include "cil-coff.h"
-#include "rawbuffer.h"
 #include "mono-endian.h"
 #include <mono/metadata/gc-internal.h>
 #include <mono/metadata/mempool-internals.h>