1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 06:01:15 +00:00

* Merged r13888 (ATerm cleanup) from the stdenv branch back into the

trunk.

svn path=/nixpkgs/trunk/; revision=14605
This commit is contained in:
Eelco Dolstra 2009-03-19 12:29:14 +00:00
commit 33a5e03bfe
10 changed files with 101 additions and 982 deletions

View file

@ -1,13 +0,0 @@
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "aterm-2.3.1";
configureFlags = "--with-gcc";
src = fetchurl {
url = http://nixos.org/tarballs/aterm-2.3.1.tar.gz;
md5 = "5a2d70acc45a9d301e0dba12fcaf77e7";
};
patches = [ ./aterm-alias-fix.patch ];
}

View file

@ -2,11 +2,19 @@
stdenv.mkDerivation {
name = "aterm-2.4.2-fixes-r2";
src = fetchurl {
url = http://nixos.org/tarballs/aterm-2.4.2-fixes-r2.tar.bz2;
sha256 = "1w3bxdpc2hz29li5ssmdcz3x0fn47r7g62ns0v8nazxwf40vff4j";
};
patches = [
# Fix for http://bugzilla.sen.cwi.nl:8080/show_bug.cgi?id=841
./max-long.patch
];
doCheck = true;
meta = {
homepage = http://www.cwi.nl/htbin/sen1/twiki/bin/view/SEN1/ATerm;
license = "LGPL";

View file

@ -1,17 +0,0 @@
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "aterm-2.4.2";
src = fetchurl {
url = http://nixos.org/tarballs/aterm-2.4.2.tar.gz;
md5 = "18617081dd112d85e6c4b1b552628114";
};
patches =
[./aterm-alias-fix-2.patch] ++
(if stdenv ? isMinGW && stdenv.isMinGW then [./mingw-asm.patch] else []);
meta = {
homepage = http://www.cwi.nl/htbin/sen1/twiki/bin/view/SEN1/ATerm;
license = "LGPL";
description = "Library for manipulation of term data structures in C";
};
}

View file

@ -8,6 +8,11 @@ stdenv.mkDerivation {
md5 = "33ddcb1a229baf406ad1f603eb1d5995";
};
patches = [
# Fix for http://bugzilla.sen.cwi.nl:8080/show_bug.cgi?id=841
./max-long.patch
];
doCheck = true;
meta = {

View file

@ -1,13 +1,18 @@
{stdenv, fetchurl}:
stdenv.mkDerivation {
name = "aterm-2.7";
name = "aterm-2.8";
src = fetchurl {
url = http://homepages.cwi.nl/~daybuild/releases//aterm-2.7.tar.gz;
sha256 = "0zhs0rncn4iankr70kbms64dwxm9i0956gs02dbw7ylx4mln8ynn";
url = http://www.meta-environment.org/releases/aterm-2.8.tar.gz;
sha256 = "1vq4qpmcww3n9v7bklgp7z1yqi9gmk6hcahqjqdzc5ksa089rdms";
};
patches = [
# Fix for http://bugzilla.sen.cwi.nl:8080/show_bug.cgi?id=841
./max-long.patch
];
doCheck = true;
meta = {

View file

@ -1,224 +0,0 @@
diff -rc aterm-1142707243.10633/aterm/aterm.c aterm/aterm/aterm.c
*** aterm-1142707243.10633/aterm/aterm.c 2006-02-08 11:35:28.000000000 +0100
--- aterm/aterm/aterm.c 2006-04-25 17:10:52.000000000 +0200
***************
*** 193,198 ****
--- 193,199 ----
/* that have char == 2 bytes, and sizeof(header_type) == 2 */
assert(sizeof(header_type) == sizeof(ATerm *));
assert(sizeof(header_type) >= 4);
+ assert(sizeof(ATerm) == sizeof(MachineWord));
/*}}} */
/*{{{ Initialize buffer */
diff -rc aterm-1142707243.10633/aterm/memory.c aterm/aterm/memory.c
*** aterm-1142707243.10633/aterm/memory.c 2006-03-09 15:02:56.000000000 +0100
--- aterm/aterm/memory.c 2006-04-25 18:22:00.000000000 +0200
***************
*** 119,130 ****
hash_number(tmp,3))
*/
#define HASHNUMBER3(t)\
! FINISH(COMBINE(START(((MachineWord*)t)[0]), ((MachineWord*)t)[2]))
#define HASHNUMBER4(t)\
! FINISH(COMBINE(COMBINE(START(((MachineWord*)t)[0]), \
! ((MachineWord*)t)[2]),((MachineWord*)t)[3]))
#define HASHINT(val) \
FINISH(COMBINE(START( (AT_INT<<SHIFT_TYPE) ), val))
--- 119,171 ----
hash_number(tmp,3))
*/
+ /* The ATerm library use some heavy aliasing. For instance, the
+ various ATermXXX structures are referenced through MachineWord
+ arrays. This is not generally allowed by the C standard --- see
+ C99, section 6.5, clause 7. In particular, this means that you
+ cannot assign something through an ATermXXX pointer, e.g.,
+
+ protoAppl->header = header;
+
+ and then read it through a MachineWord*, e.g.,
+
+ hnr = hash_number((ATerm) protoAppl, 2);
+
+ (hash_number walks over the term by casting it to a MachineWord*).
+
+ However, the same clause of the C standard also specifies that you
+ *can* read the memory location through a union type that contains
+ both the original type (e.g. ATermAppl) and the type used to read
+ the memory location (e.g. MachineWord). That's what we do
+ below: we have a union of all the types that occur in the various
+ ATerm types. We then read the "w" element of the union. The
+ compiler is not allowed to assume absence of aliasing with the
+ other types in the union.
+
+ A better solution would be to hash the term through a character
+ pointer (since *any* memory location can be legally read as a
+ character), but I'm too lazy right now. Performance might also
+ suffer if we do that. */
+
+ typedef union
+ {
+ MachineWord w;
+ header_type header;
+ ATerm term;
+ ATermList list;
+ int i;
+ double d;
+ void* p;
+ } Aliaser;
+
+ #define GET_WORD(t, n) (((Aliaser*) (((MachineWord*) t) + n))->w)
+
#define HASHNUMBER3(t)\
! FINISH(COMBINE(START(GET_WORD(t, 0)), GET_WORD(t, 2)))
#define HASHNUMBER4(t)\
! FINISH(COMBINE(COMBINE(START(GET_WORD(t, 0)), \
! GET_WORD(t, 2)), GET_WORD(t, 3)))
#define HASHINT(val) \
FINISH(COMBINE(START( (AT_INT<<SHIFT_TYPE) ), val))
***************
*** 132,144 ****
#endif /* HASHPEM */
! #define PROTO_APPL_ARGS ((ATerm *) (protoTerm + ARG_OFFSET))
#define SET_PROTO_APPL_ARG(i, a) \
! (PROTO_APPL_ARGS[(i)] = (a))
#define GET_PROTO_APPL_ARG(i) \
! (PROTO_APPL_ARGS[(i)])
#define CHECK_TERM(t) \
assert((t) != NULL \
--- 173,185 ----
#endif /* HASHPEM */
! #define PROTO_APPL_ARGS (protoTerm + ARG_OFFSET)
#define SET_PROTO_APPL_ARG(i, a) \
! (PROTO_APPL_ARGS[(i)] = (MachineWord) (a))
#define GET_PROTO_APPL_ARG(i) \
! ((ATerm) PROTO_APPL_ARGS[(i)])
#define CHECK_TERM(t) \
assert((t) != NULL \
***************
*** 323,336 ****
#else
static HashNumber hash_number(ATerm t, int size)
{
- MachineWord *words = (MachineWord *) t;
int i;
HashNumber hnr;
! hnr = START(HIDE_AGE_MARK(words[0]));
for (i=2; i<size; i++) {
! hnr = COMBINE(hnr, words[i]);
}
return FINISH(hnr);
--- 364,376 ----
#else
static HashNumber hash_number(ATerm t, int size)
{
int i;
HashNumber hnr;
! hnr = START(HIDE_AGE_MARK(GET_WORD(t, 0)));
for (i=2; i<size; i++) {
! hnr = COMBINE(hnr, GET_WORD(t, i));
}
return FINISH(hnr);
***************
*** 338,351 ****
static HashNumber hash_number_anno(ATerm t, int size, ATerm anno)
{
- MachineWord *words = (MachineWord *) t;
int i;
HashNumber hnr;
! hnr = START(HIDE_AGE_MARK(words[0]));
for (i=2; i<size; i++) {
! hnr = COMBINE(hnr, words[i]);
}
hnr = COMBINE(hnr, (MachineWord)anno);
--- 378,390 ----
static HashNumber hash_number_anno(ATerm t, int size, ATerm anno)
{
int i;
HashNumber hnr;
! hnr = START(HIDE_AGE_MARK(GET_WORD(t, 0)));
for (i=2; i<size; i++) {
! hnr = COMBINE(hnr, GET_WORD(t, i));
}
hnr = COMBINE(hnr, (MachineWord)anno);
***************
*** 1639,1645 ****
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! if (args != PROTO_APPL_ARGS) {
for (i=0; i<arity; i++) {
CHECK_TERM(args[i]);
SET_PROTO_APPL_ARG(i, args[i]);
--- 1678,1684 ----
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! if (args != (ATerm *) PROTO_APPL_ARGS) {
for (i=0; i<arity; i++) {
CHECK_TERM(args[i]);
SET_PROTO_APPL_ARG(i, args[i]);
***************
*** 1680,1686 ****
hashtable[hnr] = cur;
}
! if (args != PROTO_APPL_ARGS) {
for (i=0; i<arity; i++) {
protected_buffer[i] = NULL;
}
--- 1719,1725 ----
hashtable[hnr] = cur;
}
! if (args != (ATerm *) PROTO_APPL_ARGS) {
for (i=0; i<arity; i++) {
protected_buffer[i] = NULL;
}
***************
*** 2144,2150 ****
}
SET_PROTO_APPL_ARG(n, arg);
! result = ATmakeApplArray(sym, PROTO_APPL_ARGS);
annos = AT_getAnnotations((ATerm)appl);
if (annos != NULL) {
result = (ATermAppl)AT_setAnnotations((ATerm)result, annos);
--- 2183,2189 ----
}
SET_PROTO_APPL_ARG(n, arg);
! result = ATmakeApplArray(sym, (ATerm *) PROTO_APPL_ARGS);
annos = AT_getAnnotations((ATerm)appl);
if (annos != NULL) {
result = (ATermAppl)AT_setAnnotations((ATerm)result, annos);

View file

@ -1,445 +0,0 @@
diff -rc aterm-2.3.1-orig/aterm/aterm.c aterm-2.3.1/aterm/aterm.c
*** aterm-2.3.1-orig/aterm/aterm.c 2004-06-01 10:29:01.000000000 +0200
--- aterm-2.3.1/aterm/aterm.c 2005-05-02 18:32:52.000000000 +0200
***************
*** 191,196 ****
--- 191,197 ----
/* that have char == 2 bytes, and sizeof(header_type) == 2 */
assert(sizeof(header_type) == sizeof(ATerm *));
assert(sizeof(header_type) >= 4);
+ assert(sizeof(ATerm) == sizeof(MachineWord));
/*}}} */
/*{{{ Initialize buffer */
diff -rc aterm-2.3.1-orig/aterm/memory.c aterm-2.3.1/aterm/memory.c
*** aterm-2.3.1-orig/aterm/memory.c 2004-06-09 10:52:33.000000000 +0200
--- aterm-2.3.1/aterm/memory.c 2005-05-02 18:32:52.000000000 +0200
***************
*** 176,182 ****
* Static arrays are not guaranteed to be sizeof(double)-aligned.
*/
static MachineWord *protoTerm = NULL;
- static ATerm *arg_buffer = NULL;
static ATerm protected_buffer[MAX_ARITY] = { NULL };
--- 176,181 ----
***************
*** 495,501 ****
HashNumber hnr;
protoTerm = (MachineWord *) calloc(MAX_TERM_SIZE, sizeof(MachineWord));
- arg_buffer = (ATerm *) (protoTerm + 2);
/*{{{ Analyze arguments */
--- 494,499 ----
***************
*** 1032,1043 ****
va_list args;
protoAppl = (ATermAppl) protoTerm;
-
va_start(args, sym);
for (i=0; i<arity; i++) {
! arg_buffer[i] = va_arg(args, ATerm);
! protected_buffer[i] = arg_buffer[i];
! CHECK_TERM(arg_buffer[i]);
}
va_end(args);
--- 1030,1040 ----
va_list args;
protoAppl = (ATermAppl) protoTerm;
va_start(args, sym);
for (i=0; i<arity; i++) {
! protected_buffer[i] = va_arg(args, ATerm);
! protoTerm[ARG_OFFSET + i] = (MachineWord) protected_buffer[i];
! CHECK_TERM(protected_buffer[i]);
}
va_end(args);
***************
*** 1055,1061 ****
appl = (ATermAppl)cur;
found = ATtrue;
for (i=0; i<arity; i++) {
! if (!ATisEqual(ATgetArgument(appl, i), arg_buffer[i])) {
found = ATfalse;
break;
}
--- 1052,1058 ----
appl = (ATermAppl)cur;
found = ATtrue;
for (i=0; i<arity; i++) {
! if (!ATisEqual(ATgetArgument(appl, i), protoTerm[ARG_OFFSET + i])) {
found = ATfalse;
break;
}
***************
*** 1073,1079 ****
cur->header = header;
CHECK_HEADER(cur->header);
for (i=0; i<arity; i++) {
! ATgetArgument(cur, i) = arg_buffer[i];
CHECK_ARGUMENT(cur, i);
}
cur->next = hashtable[hnr];
--- 1070,1076 ----
cur->header = header;
CHECK_HEADER(cur->header);
for (i=0; i<arity; i++) {
! ATgetArgument(cur, i) = (ATerm) protoTerm[ARG_OFFSET + i];
CHECK_ARGUMENT(cur, i);
}
cur->next = hashtable[hnr];
***************
*** 1164,1170 ****
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! arg_buffer[0] = arg0;
hnr = HASHNUMBER3((ATerm) protoAppl);
prev = NULL;
--- 1161,1167 ----
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! protoTerm[ARG_OFFSET + 0] = (MachineWord) arg0;
hnr = HASHNUMBER3((ATerm) protoAppl);
prev = NULL;
***************
*** 1225,1232 ****
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! arg_buffer[0] = arg0;
! arg_buffer[1] = arg1;
hnr = HASHNUMBER4((ATerm) protoAppl);
prev = NULL;
--- 1222,1229 ----
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! protoTerm[ARG_OFFSET + 0] = (MachineWord) arg0;
! protoTerm[ARG_OFFSET + 1] = (MachineWord) arg1;
hnr = HASHNUMBER4((ATerm) protoAppl);
prev = NULL;
***************
*** 1287,1295 ****
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! arg_buffer[0] = arg0;
! arg_buffer[1] = arg1;
! arg_buffer[2] = arg2;
hnr = hash_number((ATerm) protoAppl, 5);
cur = hashtable[hnr & table_mask];
--- 1284,1292 ----
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! protoTerm[ARG_OFFSET + 0] = (MachineWord) arg0;
! protoTerm[ARG_OFFSET + 1] = (MachineWord) arg1;
! protoTerm[ARG_OFFSET + 2] = (MachineWord) arg2;
hnr = hash_number((ATerm) protoAppl, 5);
cur = hashtable[hnr & table_mask];
***************
*** 1347,1356 ****
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! arg_buffer[0] = arg0;
! arg_buffer[1] = arg1;
! arg_buffer[2] = arg2;
! arg_buffer[3] = arg3;
hnr = hash_number((ATerm) protoAppl, 6);
cur = hashtable[hnr & table_mask];
--- 1344,1353 ----
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! protoTerm[ARG_OFFSET + 0] = (MachineWord) arg0;
! protoTerm[ARG_OFFSET + 1] = (MachineWord) arg1;
! protoTerm[ARG_OFFSET + 2] = (MachineWord) arg2;
! protoTerm[ARG_OFFSET + 3] = (MachineWord) arg3;
hnr = hash_number((ATerm) protoAppl, 6);
cur = hashtable[hnr & table_mask];
***************
*** 1411,1421 ****
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! arg_buffer[0] = arg0;
! arg_buffer[1] = arg1;
! arg_buffer[2] = arg2;
! arg_buffer[3] = arg3;
! arg_buffer[4] = arg4;
hnr = hash_number((ATerm) protoAppl, 7);
cur = hashtable[hnr & table_mask];
--- 1408,1418 ----
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! protoTerm[ARG_OFFSET + 0] = (MachineWord) arg0;
! protoTerm[ARG_OFFSET + 1] = (MachineWord) arg1;
! protoTerm[ARG_OFFSET + 2] = (MachineWord) arg2;
! protoTerm[ARG_OFFSET + 3] = (MachineWord) arg3;
! protoTerm[ARG_OFFSET + 4] = (MachineWord) arg4;
hnr = hash_number((ATerm) protoAppl, 7);
cur = hashtable[hnr & table_mask];
***************
*** 1479,1490 ****
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! arg_buffer[0] = arg0;
! arg_buffer[1] = arg1;
! arg_buffer[2] = arg2;
! arg_buffer[3] = arg3;
! arg_buffer[4] = arg4;
! arg_buffer[5] = arg5;
hnr = hash_number((ATerm) protoAppl, 8);
cur = hashtable[hnr & table_mask];
--- 1476,1487 ----
protoAppl = (ATermAppl) protoTerm;
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! protoTerm[ARG_OFFSET + 0] = (MachineWord) arg0;
! protoTerm[ARG_OFFSET + 1] = (MachineWord) arg1;
! protoTerm[ARG_OFFSET + 2] = (MachineWord) arg2;
! protoTerm[ARG_OFFSET + 3] = (MachineWord) arg3;
! protoTerm[ARG_OFFSET + 4] = (MachineWord) arg4;
! protoTerm[ARG_OFFSET + 5] = (MachineWord) arg5;
hnr = hash_number((ATerm) protoAppl, 8);
cur = hashtable[hnr & table_mask];
***************
*** 1552,1558 ****
CHECK_HEADER(protoAppl->header);
for (i=0; i<arity; i++) {
! arg_buffer[i] = ATgetFirst(args);
args = ATgetNext(args);
}
--- 1549,1555 ----
CHECK_HEADER(protoAppl->header);
for (i=0; i<arity; i++) {
! protoTerm[ARG_OFFSET + i] = (MachineWord) ATgetFirst(args);
args = ATgetNext(args);
}
***************
*** 1567,1573 ****
found = ATtrue;
for(i=0; i<arity; i++)
{
! if(!ATisEqual(ATgetArgument(appl, i), arg_buffer[i]))
{
found = ATfalse;
break;
--- 1564,1570 ----
found = ATtrue;
for(i=0; i<arity; i++)
{
! if(!ATisEqual(ATgetArgument(appl, i), protoTerm[ARG_OFFSET + i]))
{
found = ATfalse;
break;
***************
*** 1587,1593 ****
cur->header = header;
CHECK_HEADER(cur->header);
for (i=0; i<arity; i++) {
! ATgetArgument(cur, i) = arg_buffer[i];
CHECK_ARGUMENT(cur, i);
}
cur->next = hashtable[hnr];
--- 1584,1590 ----
cur->header = header;
CHECK_HEADER(cur->header);
for (i=0; i<arity; i++) {
! ATgetArgument(cur, i) = (ATerm) protoTerm[ARG_OFFSET + i];
CHECK_ARGUMENT(cur, i);
}
cur->next = hashtable[hnr];
***************
*** 1623,1632 ****
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! if (args != arg_buffer) {
for (i=0; i<arity; i++) {
CHECK_TERM(args[i]);
! arg_buffer[i] = args[i];
protected_buffer[i] = args[i];
}
}
--- 1620,1629 ----
protoAppl->header = header;
CHECK_HEADER(protoAppl->header);
! if (args != (ATerm *) (protoTerm + ARG_OFFSET)) {
for (i=0; i<arity; i++) {
CHECK_TERM(args[i]);
! protoTerm[ARG_OFFSET + i] = (MachineWord) args[i];
protected_buffer[i] = args[i];
}
}
***************
*** 1639,1645 ****
appl = (ATermAppl)cur;
found = ATtrue;
for(i=0; i<arity; i++) {
! if(!ATisEqual(ATgetArgument(appl, i), arg_buffer[i])) {
found = ATfalse;
break;
}
--- 1636,1642 ----
appl = (ATermAppl)cur;
found = ATtrue;
for(i=0; i<arity; i++) {
! if(!ATisEqual(ATgetArgument(appl, i), protoTerm[ARG_OFFSET + i])) {
found = ATfalse;
break;
}
***************
*** 1657,1670 ****
cur->header = header;
CHECK_HEADER(cur->header);
for (i=0; i<arity; i++) {
! ATgetArgument(cur, i) = arg_buffer[i];
CHECK_ARGUMENT(cur, i);
}
cur->next = hashtable[hnr];
hashtable[hnr] = cur;
}
! if (args != arg_buffer) {
for (i=0; i<arity; i++) {
protected_buffer[i] = NULL;
}
--- 1654,1667 ----
cur->header = header;
CHECK_HEADER(cur->header);
for (i=0; i<arity; i++) {
! ATgetArgument(cur, i) = (ATerm) protoTerm[ARG_OFFSET + i];
CHECK_ARGUMENT(cur, i);
}
cur->next = hashtable[hnr];
hashtable[hnr] = cur;
}
! if (args != (ATerm *) (protoTerm + ARG_OFFSET)) {
for (i=0; i<arity; i++) {
protected_buffer[i] = NULL;
}
***************
*** 2122,2132 ****
assert(n >= 0 && n < arity);
for (i=0; i<arity; i++) {
! arg_buffer[i] = ATgetArgument(appl, i);
}
! arg_buffer[n] = arg;
! result = ATmakeApplArray(sym, arg_buffer);
annos = AT_getAnnotations((ATerm)appl);
if (annos != NULL) {
result = (ATermAppl)AT_setAnnotations((ATerm)result, annos);
--- 2119,2129 ----
assert(n >= 0 && n < arity);
for (i=0; i<arity; i++) {
! protoTerm[ARG_OFFSET + i] = (MachineWord) ATgetArgument(appl, i);
}
! protoTerm[ARG_OFFSET + n] = (MachineWord) arg;
! result = ATmakeApplArray(sym, (ATerm *) (protoTerm + ARG_OFFSET));
annos = AT_getAnnotations((ATerm)appl);
if (annos != NULL) {
result = (ATermAppl)AT_setAnnotations((ATerm)result, annos);
diff -rc aterm-2.3.1-orig/configure aterm-2.3.1/configure
*** aterm-2.3.1-orig/configure 2004-12-01 23:03:59.000000000 +0100
--- aterm-2.3.1/configure 2005-05-02 18:36:24.000000000 +0200
***************
*** 2890,2896 ****
INCL_PROF=""
CC_NS=gcc
! CFLAGS_NS="-Wall -DNDEBUG -O -DXGC_VERBOSE -DWITH_STATS" # " -O2" disabled due to gcc optimizer bugs
LFLAGS_NS=""
DEFS_NS="\$(DEFS) -DNO_SHARING"
INCL_NS=""
--- 2890,2896 ----
INCL_PROF=""
CC_NS=gcc
! CFLAGS_NS="-Wall -DNDEBUG -O3 -DXGC_VERBOSE -DWITH_STATS" # " -O2" disabled due to gcc optimizer bugs
LFLAGS_NS=""
DEFS_NS="\$(DEFS) -DNO_SHARING"
INCL_NS=""
***************
*** 3379,3385 ****
CFLAGS=${withval}
else
if test "a${GCC}" = "ayes"; then
! CFLAGS="-Wall -DNDEBUG -O -DXGC_VERBOSE -DXHASHPEM -DWITH_STATS" # " -O2" disabled due to gcc optimizer bugs
fi;
fi;
--- 3379,3385 ----
CFLAGS=${withval}
else
if test "a${GCC}" = "ayes"; then
! CFLAGS="-Wall -DNDEBUG -O3 -DXGC_VERBOSE -DXHASHPEM -DWITH_STATS" # " -O2" disabled due to gcc optimizer bugs
fi;
fi;
diff -rc aterm-2.3.1-orig/README aterm-2.3.1/README
*** aterm-2.3.1-orig/README 2002-01-16 14:19:35.000000000 +0100
--- aterm-2.3.1/README 2005-05-02 18:37:48.000000000 +0200
***************
*** 1,27 ****
- ***NOTE on COMPILER OPTIMIZATIONS:
-
- (added Wed, 16 Jan 2002, <jong@cwi.nl>)
-
- Due to several pending issues with the optimizer in the GNU C Compiler
- (most noticable to everyone using gcc version over 2.95), we strongly
- advise AGAINST passing gcc any of its '-O' optimization flags.
-
- More information on GCC optimization bugs can be found at:
- http://gcc.gnu.org/cgi-bin/gnatsweb.pl?database=gcc&cmd=query
-
- and subsequently selecting the Category:
- "optimization -- Issues related to optimization"
-
- As a result, the default configuration of the ATerm Library does not
- pass any optimizer flags to gcc anymore. Should you wish to experiment
- with specific compiler flags anyway, you can use the "--with-cflags"
- configure option. Your mileage may vary from the stress-test failing,
- to coredumps and spontaneous aborts in your program.
-
-
-
-
README with this version of the aterm library.
==============================================
--- 1,4 ----

View file

@ -0,0 +1,77 @@
diff -rc aterm-2.8-orig/aterm/hash.c aterm-2.8/aterm/hash.c
*** aterm-2.8-orig/aterm/hash.c 2008-11-10 13:54:22.000000000 +0100
--- aterm-2.8/aterm/hash.c 2009-01-27 18:14:14.000000000 +0100
***************
*** 93,146 ****
}
/*}}} */
- /*{{{ static long calc_long_max() */
- static long calc_long_max()
- {
- long try_long_max;
- long long_max;
- long delta;
-
- try_long_max = 1;
- do {
- long_max = try_long_max;
- try_long_max = long_max * 2;
- } while (try_long_max > 0);
-
- delta = long_max;
- while (delta > 1) {
- while (long_max + delta < 0) {
- delta /= 2;
- }
- long_max += delta;
- }
-
- return long_max;
-
- }
- /*}}} */
/*{{{ static long calculateNewSize(sizeMinus1, nrdel, nrentries) */
static long calculateNewSize
(long sizeMinus1, long nr_deletions, long nr_entries)
{
-
- /* Hack: LONG_MAX (limits.h) is often unreliable, we need to find
- * out the maximum possible value of a signed long dynamically.
- */
- static long st_long_max = 0;
-
- /* the resulting length has the form 2^k-1 */
-
if (nr_deletions >= nr_entries/2) {
return sizeMinus1;
}
! if (st_long_max == 0) {
! st_long_max = calc_long_max();
! }
!
! if (sizeMinus1 > st_long_max / 2) {
! return st_long_max-1;
}
return (2*sizeMinus1)+1;
--- 93,109 ----
}
/*}}} */
/*{{{ static long calculateNewSize(sizeMinus1, nrdel, nrentries) */
static long calculateNewSize
(long sizeMinus1, long nr_deletions, long nr_entries)
{
if (nr_deletions >= nr_entries/2) {
return sizeMinus1;
}
! if (sizeMinus1 > LONG_MAX / 2) {
! return LONG_MAX-1;
}
return (2*sizeMinus1)+1;

View file

@ -1,269 +0,0 @@
diff -urN aterm-2.4.2-old/aterm/gc.c aterm-2.4.2/aterm/gc.c
--- aterm-2.4.2-old/aterm/gc.c 2004-06-01 10:29:02.000000000 +0200
+++ aterm-2.4.2/aterm/gc.c 2006-08-17 15:17:28.000000000 +0200
@@ -230,71 +230,17 @@
AFun oddSym;
#endif
-#ifdef WIN32
-
- unsigned int r_eax, r_ebx, r_ecx, r_edx, \
- r_esi, r_edi, r_esp, r_ebp;
- ATerm reg[8], *real_term;
-
- __asm {
- /* Get the registers into local variables to check them
- for aterms later. */
- mov r_eax, eax
- mov r_ebx, ebx
- mov r_ecx, ecx
- mov r_edx, edx
- mov r_esi, esi
- mov r_edi, edi
- mov r_esp, esp
- mov r_ebp, ebp
- }
- /* Put the register-values into an array */
- reg[0] = (ATerm) r_eax;
- reg[1] = (ATerm) r_ebx;
- reg[2] = (ATerm) r_ecx;
- reg[3] = (ATerm) r_edx;
- reg[4] = (ATerm) r_esi;
- reg[5] = (ATerm) r_edi;
- reg[6] = (ATerm) r_esp;
- reg[7] = (ATerm) r_ebp;
-
- for(i=0; i<8; i++) {
- real_term = AT_isInsideValidTerm(reg[i]);
- if (real_term != NULL) {
- AT_markTerm(real_term);
- }
- if (AT_isValidSymbol((Symbol)reg[i])) {
- AT_markSymbol((Symbol)reg[i]);
- }
- }
-
- /* The register variables are on the stack aswell
- I set them to zero so they won't be processed again when
- the stack is traversed. The reg-array is also in the stack
- but that will be adjusted later */
- r_eax = 0;
- r_ebx = 0;
- r_ecx = 0;
- r_edx = 0;
- r_esi = 0;
- r_edi = 0;
- r_esp = 0;
- r_ebp = 0;
-
-#else
- sigjmp_buf env;
+ jmp_buf env;
/* Traverse possible register variables */
- sigsetjmp(env,0);
+ setjmp(env);
start = (ATerm *)env;
- stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf)));
+ stop = ((ATerm *)(((char *)env) + sizeof(jmp_buf)));
mark_memory(start, stop);
-#endif
stackTop = stack_top();
-
start = MIN(stackTop, stackBot);
stop = MAX(stackTop, stackBot);
@@ -343,67 +289,14 @@
AFun oddSym;
#endif
-#ifdef WIN32
-
- unsigned int r_eax, r_ebx, r_ecx, r_edx, \
- r_esi, r_edi, r_esp, r_ebp;
- ATerm reg[8], *real_term;
-
- __asm {
- /* Get the registers into local variables to check them
- for aterms later. */
- mov r_eax, eax
- mov r_ebx, ebx
- mov r_ecx, ecx
- mov r_edx, edx
- mov r_esi, esi
- mov r_edi, edi
- mov r_esp, esp
- mov r_ebp, ebp
- }
- /* Put the register-values into an array */
- reg[0] = (ATerm) r_eax;
- reg[1] = (ATerm) r_ebx;
- reg[2] = (ATerm) r_ecx;
- reg[3] = (ATerm) r_edx;
- reg[4] = (ATerm) r_esi;
- reg[5] = (ATerm) r_edi;
- reg[6] = (ATerm) r_esp;
- reg[7] = (ATerm) r_ebp;
-
- for(i=0; i<8; i++) {
- real_term = AT_isInsideValidTerm(reg[i]);
- if (real_term != NULL) {
- AT_markTerm_young(real_term);
- }
- if (AT_isValidSymbol((Symbol)reg[i])) {
- AT_markSymbol_young((Symbol)reg[i]);
- }
- }
-
- /* The register variables are on the stack aswell
- I set them to zero so they won't be processed again when
- the stack is traversed. The reg-array is also in the stack
- but that will be adjusted later */
- r_eax = 0;
- r_ebx = 0;
- r_ecx = 0;
- r_edx = 0;
- r_esi = 0;
- r_edi = 0;
- r_esp = 0;
- r_ebp = 0;
-
-#else
- sigjmp_buf env;
+ jmp_buf env;
/* Traverse possible register variables */
- sigsetjmp(env,0);
+ setjmp(env);
start = (ATerm *)env;
- stop = ((ATerm *)(((char *)env) + sizeof(sigjmp_buf)));
+ stop = ((ATerm *)(((char *)env) + sizeof(jmp_buf)));
mark_memory_young(start, stop);
-#endif
stackTop = stack_top();
start = MIN(stackTop, stackBot);
diff -urN aterm-2.4.2-old/test/randgen.c aterm-2.4.2/test/randgen.c
--- aterm-2.4.2-old/test/randgen.c 2002-06-06 10:16:29.000000000 +0200
+++ aterm-2.4.2/test/randgen.c 2006-08-17 16:09:47.000000000 +0200
@@ -14,8 +14,13 @@
#if HAVE_LRAND48 && HAVE_SRAND48
/* Use the rand48() suite */
#else
-#define lrand48() random()
-#define srand48(s) srandom(s)
+# ifdef WIN32
+# define lrand48() rand()
+# define srand48(s) srand(s)
+# else
+# define lrand48() random()
+# define srand48(s) srandom(s)
+# endif
#endif
/*}}} */
diff -urN aterm-2.4.2-old/test/termstats.c aterm-2.4.2/test/termstats.c
--- aterm-2.4.2-old/test/termstats.c 2001-10-09 16:35:21.000000000 +0200
+++ aterm-2.4.2/test/termstats.c 2006-08-17 17:15:53.000000000 +0200
@@ -1,7 +1,9 @@
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
+#ifndef WIN32
#include <sys/times.h>
+#endif
#include <time.h>
#include <limits.h>
@@ -14,7 +16,9 @@
int main(int argc, char *argv[])
{
+#ifndef WIN32
struct tms start, end;
+#endif
ATerm top = NULL;
ATerm t, t2;
ATbool dobafsize = ATfalse;
@@ -29,16 +33,24 @@
ATinit(argc, argv, &top);
+#ifndef WIN32
times(&start);
+#endif
t = ATreadFromFile(stdin);
+#ifndef WIN32
times(&end);
textread = end.tms_utime-start.tms_utime;
+#endif
tmp_file = tmpfile();
+#ifndef WIN32
times(&start);
+#endif
ATwriteToTextFile(t, tmp_file);
+#ifndef WIN32
times(&end);
textwrite = end.tms_utime-start.tms_utime;
+#endif
subterms = AT_calcSubterms(t);
symbols = AT_calcUniqueSymbols(t);
@@ -56,37 +68,52 @@
printf(" bytes p/node : %8.2f\n", ((double)incore)/((double)subterms));
printf("text size : %8d\n",textsize);
printf(" bytes p/node : %8.2f\n", ((double)textsize)/((double)subterms));
+
+#ifndef WIN32
printf("text read time : %8.2fs\n", ((double)textread)/((double)CLK_TCK));
printf(" per node : %8.2fus\n", ((double)textread*1000000.0/subterms)/((double)CLK_TCK));
printf("text write time : %8.2fs\n", ((double)textwrite)/((double)CLK_TCK));
printf(" per node : %8.2fus\n", ((double)textwrite*1000000.0/subterms)/((double)CLK_TCK));
+#endif
if(dobafsize) {
struct stat stats;
+#ifndef WIN32
clock_t bafread, bafwrite;
+#endif
FILE *file = fopen("/tmp/test.baf", "wb+");
int fd = fileno(file);
+#ifndef WIN32
times(&start);
+#endif
ATwriteToBinaryFile(t, file);
+#ifndef WIN32
times(&end);
bafwrite = end.tms_utime-start.tms_utime;
+#endif
fflush(file);
fstat(fd, &stats);
bafsize = (int)stats.st_size;
fseek(file, 0, SEEK_SET);
+#ifndef WIN32
times(&start);
+#endif
t2 = ATreadFromBinaryFile(file);
+#ifndef WIN32
times(&end);
bafread = end.tms_utime-start.tms_utime;
+#endif
printf("baf size : %8d\n", bafsize);
printf(" bytes p/node : %8.2f\n", ((double)bafsize)/((double)subterms));
printf(" bits p/node : %8.2f\n", ((double)bafsize*8)/((double)subterms));
printf(" comp.wrs.text : %8.2f%%\n", 100.0-((double)bafsize*100)/((textsize)));
+#ifndef WIN32
printf("baf write time : %8.2fs\n", ((double)bafwrite)/((double)CLK_TCK));
printf(" per node : %8.2fus\n", ((double)bafwrite*1000000.0/subterms)/((double)CLK_TCK));
printf("baf read time : %8.2fs\n", ((double)bafread)/((double)CLK_TCK));
printf(" per node : %8.2fus\n", ((double)bafread*1000000.0/subterms)/((double)CLK_TCK));
+#endif
fclose(file);
}

View file

@ -2716,15 +2716,7 @@ let
inherit fetchurl stdenv aspell which;
});
aterm = aterm24;
aterm23 = import ../development/libraries/aterm/2.3.nix {
inherit fetchurl stdenv;
};
aterm24 = lowPrio (import ../development/libraries/aterm/2.4.nix {
inherit fetchurl stdenv;
});
aterm = aterm28;
aterm242fixes = import ../development/libraries/aterm/2.4.2-fixes.nix {
inherit fetchurl stdenv;
@ -2734,9 +2726,9 @@ let
inherit fetchurl stdenv;
};
aterm27 = lowPrio (import ../development/libraries/aterm/2.7.nix {
aterm28 = import ../development/libraries/aterm/2.8.nix {
inherit fetchurl stdenv;
});
};
attr = useFromStdenv "attr"
(import ../development/libraries/attr {