From 704964093fe9d9d991936b5338a05ab08bc21eab Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Mon, 14 Nov 2011 23:35:45 +0100 Subject: [PATCH] If a file does not use MMAPed data, allow it. --- src/c/ffi/cdata.d | 7 ++++--- src/c/load.d | 8 ++------ src/cmp/cmpwt.lsp | 8 ++++---- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/src/c/ffi/cdata.d b/src/c/ffi/cdata.d index 2638f8d30..c6a89c92a 100644 --- a/src/c/ffi/cdata.d +++ b/src/c/ffi/cdata.d @@ -14,6 +14,7 @@ */ #include +#include #define HEADER_PREFIX "eClDaTa20110719" #define HEADER_PREFIX_LENGTH 15 @@ -23,6 +24,8 @@ typedef struct { cl_index offset, size; } cdata_header; +ecl_def_ct_base_string(str_no_data,"",0,static,const); + cl_object si_get_cdata(cl_object filename) { @@ -38,9 +41,7 @@ si_get_cdata(cl_object filename) } if (memcmp(header->code, HEADER_PREFIX, HEADER_PREFIX_LENGTH)) { - si_munmap(map); - map = Cnil; - displaced = Cnil; + displaced = str_no_data; } else { displaced = cl_funcall(8, @'make-array', MAKE_FIXNUM(header->size), diff --git a/src/c/load.d b/src/c/load.d index b724d7385..35ee8d867 100755 --- a/src/c/load.d +++ b/src/c/load.d @@ -67,15 +67,11 @@ si_load_binary(cl_object filename, cl_object verbose, goto OUTPUT; } -GO_ON: +GO_ON: /* Try to load the compiled data */ map = si_get_cdata(filename); array = VALUES(1); - if (Null(map)) { - output = make_base_string_copy("Unable to load compiled data."); - ecl_library_close(block); - goto OUTPUT; - } + block->cblock.data_text = array->base_string.self; block->cblock.data_text_size = array->base_string.dim; diff --git a/src/cmp/cmpwt.lsp b/src/cmp/cmpwt.lsp index 8955a63b1..e8e91ef7d 100644 --- a/src/cmp/cmpwt.lsp +++ b/src/cmp/cmpwt.lsp @@ -95,10 +95,10 @@ (princ "#define compiler_data_text NULL #define compiler_data_text_size 0" stream))))) -(defun data-binary-dump (filename &optional (string (if *compile-in-constants* - "" - (data-dump-array)))) - (si::add-cdata filename string)) +(defun data-binary-dump (filename &optional (string (unless *compile-in-constants* + (data-dump-array)))) + (unless *compile-in-constants* + (si::add-cdata filename string))) (defun wt-data-begin (stream) nil)