Matthew Mondor | 9 Feb 11:10

MP stability improvement

Hello,

Some time ago, when I had important stability issues with ECL and an
HTTPd I wrote for it, I worked out a reimplementation of POSIX mutexes
for ECL.  However, most of my issues were actually related to boehm-gc,
so although I had posted the new implementation on this list back then,
I didn't really pursue it.

It seems that I am having less issues with boehm, but on a 4 cores
system I have I have been hitting odd concurrency issues causing
general instability when I stress-test the HTTPd using Apache's ab(8).

So I again tested my simplified mutex.d implementation and
interestingly, stability improved this time.  So what I did is to merge
it along with the Windows support, which still uses the old
holder/counter dance.  The new POSIX implementation avoids this and
simply relies on the POSIX primitives as directly as possible in order
to avoid race conditions.  I'm not familiar enough with Windows to
suggest patches to its implementation, though.

I here attach the diff for review, testing and comments.

Thanks,
--

-- 
Matt
diff --git a/src/c/threads/mutex.d b/src/c/threads/mutex.d
index c1c9f1e..4384c7a 100644
--- a/src/c/threads/mutex.d
(Continue reading)

KDr2 | 9 Feb 02:33
Picon
Gravatar

error on compiling function

$ecl 
ECL (Embeddable Common-Lisp) 12.2.1 (git:446a5ff95d143aa9726326882d7e37b3c0ce9526)
Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya
Copyright (C) 1993 Giuseppe Attardi
Copyright (C) 2000 Juan J. Garcia-Ripoll
ECL is free software, and you are welcome to redistribute it
under certain conditions; see file 'Copyright' for details.
Type :h for Help.  
Top level in: #<process TOP-LEVEL>.
> (defun x ()())

X
> (compile 'x)

;;; Loading #P"/opt/ecl/lib/ecl-12.2.1/cmp.fas"
;;; OPTIMIZE levels: Safety=2, Space=0, Speed=3, Debug=0
;;;
;;; End of Pass 1.In file included from ./ecl/ecl.h:35,
                 from ./ecl/ecl-cmp.h:18,
                 from /private/var/folders/wy/hrmb8g3j37d11721mk55jmx80000gn/T/ecl0012PDlYX.c:5:
./ecl/config.h:485:27: error: arch/fpe_x86.c: No such file or directory

;;; Internal error:
;;;   ** Error code 1 when executing
;;; (RUN-PROGRAM "gcc" ("-I." "-I/opt/ecl/include/" "-g" "-O2" "-fPIC" "-fno-common" "-g" "-O2" "-fPIC" "-fno-common" "-D_THREAD_SAFE" "-Ddarwin" "-O2" "-w" "-c" "/private/var/folders/wy/hrmb8g3j37d11721mk55jmx80000gn/T/ecl0012PDlYX.c" "-o" "/private/var/folders/wy/hrmb8g3j37d11721mk55jmx80000gn/T/ecl0012PDlYX.o"))
X
NIL
NIL
> ^D
 
I configure ecl with the '--with-fpe=NO' option, and this still happens both with ecl v11.1.1 and v12.2.1 on macosx(darwin11 x86_64) and linux-2.6.33(x86_64)

Anyone met this?

--
Best Regards,
            ----  KDr2
/***************************************
 *    site   : http://kdr2.net         *   
 *    skype  : zhuoql                  *   
 ***************************************/


------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
Ecls-list mailing list
Ecls-list@...
https://lists.sourceforge.net/lists/listinfo/ecls-list
Raymond Toy | 8 Feb 06:59
Picon

Ecl version of with-float-traps-masked and vector-sap?

Does ecl have the equivalent of cmucl's (and sbcl's)
with-float-traps-masked and vector-sap?

With-float-traps-masked sets up the fpu state to mask certain
floating-point exceptions.

Vector-sap basically takes a specialized array and returns the address
of where the data actually is.  This assumes that (simple-array
double-float (*)) is stored in memory as one or more header words
followed by consecutive double-floats.

Oh, I also need the equivalent of without-gcing.

I'm looking at trying to get matlisp to run with ecl, and now that
someone has contributed an ffi using cffi, I thought getting matlisp
working with ecl would be nice.

Thanks,

Ray

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Picon

How to pass arguments to the C compiler?

Hi.

How do I change which arguments that are passed to the C compiler?

I tried changing ecl-cc.bat which is in the ecl folder, but didn't
seem to result in anything different.

I am running ECL 11.1.1, on Windows 7, compiled by MS VC++ 2008, ECL
is using CL (I am refering to the C/C++ compiler on MS VC++).

Thx.

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
KDr2 | 7 Feb 09:44
Picon
Gravatar

The latest version from git(e3af03e02) crash with 'EXT:STACK-OVERFLOW'.

I compiled ecl from the source at git reversion: e3af03e02f375e6fc935cbd929936961374c1b50, and it seems can't be run.

The error message:

$ ./bin/ecl
;;; Unhandled lisp initialization error
;;; Message:
EXT:STACK-OVERFLOW
;;; Arguments:
Internal or unrecoverable error in:
Lisp initialization error.
  [2: No such file or directory]
;;; ECL C Backtrace
;;; 0   libecl.12.2.dylib                   0x000000010d9ab014 si_dump_c_backtrace + 36
Abort trap: 6

More Info:

* OS: macosx 10.7.3, Darwin Kernel Version 11.3.0
* compiler: gcc-mp-4.6
* configure arguments: ./configure  --enable-threads --with-x
* source git reversion: e3af03e02f375e6fc935cbd929936961374c1b50

Anyone help me? Thanks!

--
Best Regards,
            ----  KDr2
/***************************************
 *    site   : http://kdr2.net         *   
 *    skype  : zhuoql                  *   
 ***************************************/


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Ecls-list mailing list
Ecls-list@...
https://lists.sourceforge.net/lists/listinfo/ecls-list
red plait | 7 Feb 09:36
Picon
Gravatar

[Patch] ecl 12.2.1 sse2 support for msvc

Hi
I recently tied to build subj and get following errors:
        cl /Feecl_min.exe cinit.obj c\all_symbols.obj eclmin.lib /link
/incremental:no /nologo /nodefaultlib:libcmt
/nodefaultlib:libcmtd/nodefaultlib:libc /nodefaultlib:libcd
/nodefaultlib:msvcrtd.lib eclgc.lib eclgmp.lib user32.lib ws2_32.lib
shell32.lib
   Creating library ecl_min.lib and object ecl_min.exp
all_symbols.obj : error LNK2001: unresolved external symbol
_si_sse_pack_element_type
all_symbols.obj : error LNK2001: unresolved external symbol
_si_sse_pack_to_vector
all_symbols.obj : error LNK2001: unresolved external symbol
_si_vector_to_sse_pack
all_symbols.obj : error LNK2001: unresolved external symbol
_si_sse_pack_as_elt_type
all_symbols.obj : error LNK2001: unresolved external symbol _si_sse_pack_p
ecl_min.exe : fatal error LNK1120: 5 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio
8\VC\BIN\cl.EXE"' : return code '0x2'

So this is the patch to fix this problem:
*** msvc/c/Makefile.old	Tue Feb  7 08:02:51 2012
--- msvc/c/Makefile	Tue Feb  7 08:23:08 2012
*************** ECL_UNICODE_FLAG=0
*** 31,38 ****
--- 31,40 ----

  !if "$(ECL_SSE)" != ""
  ECL_SSE_FLAG=1
+ ECL_SSE_OBJ=sse2.obj
  !else
  ECL_SSE_FLAG=0
+ ECL_SSE_OBJ=
  !endif

  # Programs used by "make":
*************** OBJS	= main.obj symbol.obj package.obj c
*** 98,104 ****
          mapfun.obj multival.obj hash.obj format.obj pathname.obj\
          structure.obj load.obj unixfsys.obj unixsys.obj \
          ffi.obj alloc_2.obj tcp.obj $(THREADS_OBJ) serialize.obj \
!         $(ECL_FFI_OBJ) $(ECL_UCD_OBJ) mmap.obj cdata.obj

  all:    $(DPP) ..\eclmin.lib ..\cinit.obj

--- 100,106 ----
          mapfun.obj multival.obj hash.obj format.obj pathname.obj\
          structure.obj load.obj unixfsys.obj unixsys.obj \
          ffi.obj alloc_2.obj tcp.obj $(THREADS_OBJ) serialize.obj \
!         $(ECL_SSE_OBJ) $(ECL_FFI_OBJ) $(ECL_UCD_OBJ) mmap.obj cdata.obj

  all:    $(DPP) ..\eclmin.lib ..\cinit.obj

------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
Jerry James | 6 Feb 19:29
Picon

Small patch to disassembler.d

GCC complains about use of an uninitialized variable in si_bc_join().
It looks like the wrong variable name is being used.  See the attached
patch.  Regards,
-- 
Jerry James
http://www.jamezone.org/
diff --git a/src/c/disassembler.d b/src/c/disassembler.d
index 36d97e0..2c81655 100644
--- a/src/c/disassembler.d
+++ b/src/c/disassembler.d
@@ -667,7 +667,7 @@ si_bc_join(cl_object lex, cl_object code, cl_object data, cl_object name)
                 unlikely_if (!ECL_VECTORP(code) ||
                              (data->vector.elttype != aet_object)) {
                         FEwrong_type_nth_arg(@[si::bc-join],
-                                             0, output,
+                                             0, code,
                                              cl_list(2,
                                                      @'simple-array',
                                                      Ct));
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ecls-list mailing list
Ecls-list@...
https://lists.sourceforge.net/lists/listinfo/ecls-list
Jerry James | 6 Feb 19:22
Picon

sharp_asterisk_reader patch

In sharp_asterisk_reader, if the number of dimensions is not
specified, then the local variable "last" can be used uninitialized.
I *think* the attached patch is the right fix.  Regards,
-- 
Jerry James
http://www.jamezone.org/
diff --git a/src/c/read.d b/src/c/read.d
index 3e4863d..509055c 100644
--- a/src/c/read.d
+++ b/src/c/read.d
@@ -891,8 +891,8 @@ sharp_asterisk_reader(cl_object in, cl_object c, cl_object d)
 			FEreader_error("Too many elements in #*.", in, 0);
 		unlikely_if (dim && (dimcount == 0))
 			FEreader_error("Cannot fill the bit-vector #*.", in, 0);
-		last = ECL_STACK_REF(env,-1);
 	}
+	last = ECL_STACK_REF(env,-1);
 	x = ecl_alloc_simple_vector(dim, aet_bit);
 	for (i = 0; i < dim; i++) {
 		elt = (i < dimcount) ? env->stack[sp+i] : last;
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ecls-list mailing list
Ecls-list@...
https://lists.sourceforge.net/lists/listinfo/ecls-list
Jerry James | 6 Feb 19:06
Picon

Patch for partial mmap of a file

If a filename and a length are passed to ext::mmap, then the actual
length value passed to mmap() comes from an uninitialized stack
variable.  The attached patch fixes the problem.  Regards,
-- 
Jerry James
http://www.jamezone.org/
diff --git a/src/c/ffi/mmap.d b/src/c/ffi/mmap.d
index f907fc8..513ac74 100644
--- a/src/c/ffi/mmap.d
+++ b/src/c/ffi/mmap.d
@@ -61,6 +61,8 @@
                 fd = ecl_to_int(si_file_stream_fd(stream));
                 if (Null(length))
                         len = ecl_to_unsigned_integer(ecl_file_length(stream));
+                else
+                        len = ecl_to_unsigned_integer(length);
         }
         output = si_make_vector(element_type, MAKE_FIXNUM(0), Cnil,
                                 Cnil, Cnil, Cnil);
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ecls-list mailing list
Ecls-list@...
https://lists.sourceforge.net/lists/listinfo/ecls-list
Jerry James | 6 Feb 18:59
Picon

Patch for missing #includes

GCC complains about some functions with no prototypes.  The attached
patch fixes the problem.

cdata.d calls memcmp() and memcpy(), so needs <string.h>.

main.d calls memcpy(), so needs <string.h>.

num_rand.d calls read() and close() if !defined(ECL_MS_WINDOWS_HOST),
so needs <unistd.h>.

Regards,
-- 
Jerry James
http://www.jamezone.org/
diff --git a/src/c/ffi/cdata.d b/src/c/ffi/cdata.d
index c6a89c9..1a15e09 100644
--- a/src/c/ffi/cdata.d
+++ b/src/c/ffi/cdata.d
@@ -13,6 +13,7 @@
     See file '../Copyright' for full details.
 */

+#include <string.h>
 #include <ecl/ecl.h>
 #include <ecl/ecl-inl.h>

diff --git a/src/c/main.d b/src/c/main.d
index fffab2b..a603ca0 100644
--- a/src/c/main.d
+++ b/src/c/main.d
@@ -40,6 +40,7 @@
 #endif
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <ecl/cache.h>
 #include <ecl/internal.h>
 #include <ecl/ecl-inl.h>
diff --git a/src/c/num_rand.d b/src/c/num_rand.d
index 3e6d76f..f4a4cb5 100644
--- a/src/c/num_rand.d
+++ b/src/c/num_rand.d
@@ -21,6 +21,9 @@
 #include <stdlib.h>
 #include <ecl/internal.h>
 #include <fcntl.h>
+#if !defined(ECL_MS_WINDOWS_HOST)
+# include <unistd.h>
+#endif
 #if !defined(_MSC_VER) && !defined(__MINGW32__)
 # include <sys/stat.h>
 /* it isn't pulled in by fcntl.h */
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ecls-list mailing list
Ecls-list@...
https://lists.sourceforge.net/lists/listinfo/ecls-list
Jerry James | 6 Feb 18:51
Picon

Patch for FEtype_error_index calls

In ECL 12.2.1, there are several calls to FEtype_error_index that pass
a cl_object as the second argument instead of a cl_fixnum.  I'm not
totally sure of the best way to solve this in all cases, but the
attached patch is one attempt.

Regards,
-- 
Jerry James
http://www.jamezone.org/
diff --git a/src/c/array.d b/src/c/array.d
index be9f330..d8e91dd 100644
--- a/src/c/array.d
+++ b/src/c/array.d
@@ -99,13 +99,11 @@ ecl_to_index(cl_object n)
 	case t_fixnum: {
 		cl_fixnum out = fix(n);
 		if (out < 0 || out >= ADIMLIM)
-			FEtype_error_index(Cnil, n);
+			FEtype_error_index(Cnil, out);
 		return out;
 	}
-	case t_bignum:
-		FEtype_error_index(Cnil, n);
 	default:
-                FEwrong_type_only_arg(@[coerce], n, @[integer]);
+		FEwrong_type_only_arg(@[coerce], n, @[fixnum]);
 	}
 }

diff --git a/src/c/instance.d b/src/c/instance.d
index e433153..ae19466 100644
--- a/src/c/instance.d
+++ b/src/c/instance.d
@@ -90,9 +90,11 @@ si_instance_ref(cl_object x, cl_object index)

 	if (ecl_unlikely(!ECL_INSTANCEP(x)))
                 FEwrong_type_nth_arg(@[si::instance-ref], 1, x, @[ext::instance]);
-	if (ecl_unlikely(!FIXNUMP(index) ||
-                         (i = fix(index)) < 0 || i >= (cl_fixnum)x->instance.length))
-	        FEtype_error_index(x, index);
+	if (ecl_unlikely(!FIXNUMP(index)))
+		FEwrong_type_nth_arg(@[si::instance-ref], 2, index, @[fixnum]);
+	i = fix(index);
+	if (ecl_unlikely(i < 0 || i >= (cl_fixnum)x->instance.length))
+		FEtype_error_index(x, i);
 	@(return x->instance.slots[i])
 }

@@ -103,9 +105,11 @@ si_instance_ref_safe(cl_object x, cl_object index)

 	if (ecl_unlikely(!ECL_INSTANCEP(x)))
                 FEwrong_type_nth_arg(@[si::instance-ref], 1, x, @[ext::instance]);
-	if (ecl_unlikely(!FIXNUMP(index) ||
-                         (i = fix(index)) < 0 || i >= x->instance.length))
-	        FEtype_error_index(x, index);
+	if (ecl_unlikely(!FIXNUMP(index)))
+		FEwrong_type_nth_arg(@[si::instance-ref], 2, index, @[fixnum]);
+	i = fix(index);
+	if (ecl_unlikely(i < 0 || i >= x->instance.length))
+		FEtype_error_index(x, i);
 	x = x->instance.slots[i];
 	if (ecl_unlikely(x == ECL_UNBOUND))
 		cl_error(5, @'unbound-slot', @':name', index, @':instance', x);
@@ -130,9 +134,11 @@ si_instance_set(cl_object x, cl_object index, cl_object value)

 	if (ecl_unlikely(!ECL_INSTANCEP(x)))
                 FEwrong_type_nth_arg(@[si::instance-set], 1, x, @[ext::instance]);
-	if (ecl_unlikely(!FIXNUMP(index) ||
-                         (i = fix(index)) >= (cl_fixnum)x->instance.length || i < 0))
-		FEtype_error_index(x, index);
+	if (ecl_unlikely(!FIXNUMP(index)))
+		FEwrong_type_nth_arg(@[si::instance-set], 2, index, @[fixnum]);
+	i = fix(index);
+	if (ecl_unlikely(i >= (cl_fixnum)x->instance.length || i < 0))
+		FEtype_error_index(x, i);
 	x->instance.slots[i] = value;
 	@(return value)
 }
@@ -164,9 +170,11 @@ si_sl_makunbound(cl_object x, cl_object index)

 	if (ecl_unlikely(!ECL_INSTANCEP(x)))
                 FEwrong_type_nth_arg(@[si::sl-makunbound], 1, x, @[ext::instance]);
-	if (ecl_unlikely(!FIXNUMP(index) ||
-                         (i = fix(index)) >= x->instance.length || i < 0))
-		FEtype_error_index(x, index);
+	if (ecl_unlikely(!FIXNUMP(index)))
+		FEwrong_type_nth_arg(@[si::sl-makunbound], 2, index, @[fixnum]);
+	i = fix(index);
+	if (ecl_unlikely((i >= x->instance.length || i < 0))
+		FEtype_error_index(x, i);
 	x->instance.slots[i] = ECL_UNBOUND;
 	@(return x)
 }
------------------------------------------------------------------------------
Try before you buy = See our experts in action!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-dev2
_______________________________________________
Ecls-list mailing list
Ecls-list@...
https://lists.sourceforge.net/lists/listinfo/ecls-list

Gmane