Thread: [pure-lang-svn] SF.net SVN: pure-lang: [15] pure/trunk/runtime.cc
Status: Beta
Brought to you by:
agraef
|
From: <ag...@us...> - 2008-05-01 08:50:28
|
Revision: 15
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=15&view=rev
Author: agraef
Date: 2008-05-01 01:50:27 -0700 (Thu, 01 May 2008)
Log Message:
-----------
More OSX compatibility fixes.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-01 08:49:49 UTC (rev 14)
+++ pure/trunk/runtime.cc 2008-05-01 08:50:27 UTC (rev 15)
@@ -1398,11 +1398,13 @@
interp.defn("GLOB_NOSORT", pure_int(GLOB_NOSORT));
interp.defn("GLOB_NOCHECK", pure_int(GLOB_NOCHECK));
interp.defn("GLOB_NOESCAPE", pure_int(GLOB_NOESCAPE));
+#ifndef __APPLE__
interp.defn("GLOB_PERIOD", pure_int(GLOB_PERIOD));
+ interp.defn("GLOB_ONLYDIR", pure_int(GLOB_ONLYDIR));
+#endif
interp.defn("GLOB_BRACE", pure_int(GLOB_BRACE));
interp.defn("GLOB_NOMAGIC", pure_int(GLOB_NOMAGIC));
interp.defn("GLOB_TILDE", pure_int(GLOB_TILDE));
- interp.defn("GLOB_ONLYDIR", pure_int(GLOB_ONLYDIR));
// regex stuff
interp.defn("REG_SIZE", pure_int(sizeof(regex_t))); // not in POSIX
interp.defn("REG_EXTENDED", pure_int(REG_EXTENDED));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-17 12:39:04
|
Revision: 92
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=92&view=rev
Author: agraef
Date: 2008-05-17 05:39:04 -0700 (Sat, 17 May 2008)
Log Message:
-----------
Add code for debugging expression allocations.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-17 06:39:30 UTC (rev 91)
+++ pure/trunk/runtime.cc 2008-05-17 12:39:04 UTC (rev 92)
@@ -19,6 +19,26 @@
>= interpreter::stackmax) \
pure_throw(stack_exception())
+// Debug expression allocations.
+#if DEBUG>2
+set<pure_expr*> mem_allocations;
+#define MEMDEBUG_NEW(x) mem_allocations.insert(x); \
+ cerr << "NEW: " << (void*)x << ": " << x << endl;
+#define MEMDEBUG_FREE(x) mem_allocations.erase(x); \
+ cerr << "FREE: " << (void*)x << ": " << x << endl;
+#define MEMDEBUG_INIT mem_allocations.clear();
+#define MEMDEBUG_SUMMARY cerr << "SUMMARY:\n"; \
+ for (set<pure_expr*>::iterator x = mem_allocations.begin(); \
+ x != mem_allocations.end(); x++) \
+ cerr << (void*)(*x) << ": " << (*x) << endl; \
+ mem_allocations.clear();
+#else
+#define MEMDEBUG_NEW(x)
+#define MEMDEBUG_FREE(x)
+#define MEMDEBUG_INIT
+#define MEMDEBUG_SUMMARY
+#endif
+
// Expression pointers are allocated in larger chunks for better performance.
// NOTE: Only internal fields get initialized by new_expr(), the remaining
// fields *must* be initialized as appropriate by the caller.
@@ -49,6 +69,7 @@
interpreter& interp = *interpreter::g_interp;
x->xp = interp.exps;
interp.exps = x;
+ MEMDEBUG_FREE(x)
}
static inline
@@ -209,6 +230,7 @@
}
va_end(ap);
}
+ MEMDEBUG_NEW(x)
return x;
}
@@ -220,6 +242,7 @@
pure_expr *x = new_expr();
x->tag = tag;
x->data.clos = 0;
+ MEMDEBUG_NEW(x)
return x;
}
@@ -229,6 +252,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::INT;
x->data.i = i;
+ MEMDEBUG_NEW(x)
return x;
}
@@ -253,6 +277,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::BIGINT;
make_bigint(x->data.z, size, limbs);
+ MEMDEBUG_NEW(x)
return x;
}
@@ -262,6 +287,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::BIGINT;
mpz_init_set(x->data.z, z);
+ MEMDEBUG_NEW(x)
return x;
}
@@ -271,6 +297,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::DBL;
x->data.d = d;
+ MEMDEBUG_NEW(x)
return x;
}
@@ -280,6 +307,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::PTR;
x->data.p = p;
+ MEMDEBUG_NEW(x)
return x;
}
@@ -290,6 +318,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::STR;
x->data.s = strdup(s);
+ MEMDEBUG_NEW(x)
return x;
}
@@ -300,6 +329,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::STR;
x->data.s = toutf8(s, 0);
+ MEMDEBUG_NEW(x)
return x;
}
@@ -310,6 +340,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::STR;
x->data.s = s;
+ MEMDEBUG_NEW(x)
return x;
}
@@ -438,6 +469,7 @@
f->tag = EXPR::APP;
f->data.x[0] = x;
f->data.x[1] = y;
+ MEMDEBUG_NEW(f)
return f;
}
}
@@ -545,6 +577,7 @@
#if DEBUG>1
cerr << "pure_invoke: calling " << f << endl;
#endif
+ MEMDEBUG_INIT
// Push an exception.
pure_exception ex; ex.e = 0; interp.estk.push_front(ex);
// Call the function now. Catch exceptions generated by the runtime.
@@ -559,11 +592,13 @@
if (tmps != e) pure_freenew(tmps);
tmps = next;
}
+ MEMDEBUG_SUMMARY
return 0;
} else {
pure_expr *res = fp();
// normal return
interp.estk.pop_front();
+ MEMDEBUG_SUMMARY
#if DEBUG>1
pure_expr *tmps = interp.tmps;
while (tmps) {
@@ -958,6 +993,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::STR;
x->data.s = buf;
+ MEMDEBUG_NEW(x)
return x;
}
@@ -1004,6 +1040,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::STR;
x->data.s = buf;
+ MEMDEBUG_NEW(x)
return x;
}
@@ -1018,6 +1055,7 @@
pure_expr *x = new_expr();
x->tag = EXPR::STR;
x->data.s = buf;
+ MEMDEBUG_NEW(x)
return x;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-17 12:43:30
|
Revision: 93
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=93&view=rev
Author: agraef
Date: 2008-05-17 05:43:37 -0700 (Sat, 17 May 2008)
Log Message:
-----------
Optimize argument refcounting in pure_apply.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-17 12:39:04 UTC (rev 92)
+++ pure/trunk/runtime.cc 2008-05-17 12:43:37 UTC (rev 93)
@@ -453,8 +453,10 @@
}
// collect arguments
f = x;
- for (size_t j = 1; f->tag == EXPR::APP; j++, f = f->data.x[0])
- argv[i+n-j] = pure_new_internal(f->data.x[1]);
+ for (size_t j = 1; f->tag == EXPR::APP; j++, f = f->data.x[0]) {
+ assert(f->data.x[1]->refc > 0);
+ argv[i+n-j] = f->data.x[1]; f->data.x[1]->refc++;
+ }
i += n; argv[i++] = y;
assert(i == k);
pure_free_internal(x);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-17 20:06:45
|
Revision: 95
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=95&view=rev
Author: agraef
Date: 2008-05-17 13:06:47 -0700 (Sat, 17 May 2008)
Log Message:
-----------
Bugfixes in memory debugging code.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-17 19:45:28 UTC (rev 94)
+++ pure/trunk/runtime.cc 2008-05-17 20:06:47 UTC (rev 95)
@@ -21,6 +21,7 @@
// Debug expression allocations.
#if DEBUG>2
+int mem_level = 0;
set<pure_expr*> mem_allocations;
#if DEBUG>9
#define MEMDEBUG_NEW(x) mem_allocations.insert(x); \
@@ -31,15 +32,15 @@
#define MEMDEBUG_NEW(x) mem_allocations.insert(x);
#define MEMDEBUG_FREE(x) mem_allocations.erase(x);
#endif
-#define MEMDEBUG_INIT mem_allocations.clear();
-#define MEMDEBUG_SUMMARY(ret) mem_mark(ret); \
+#define MEMDEBUG_INIT if (mem_level++==0) mem_allocations.clear();
+#define MEMDEBUG_SUMMARY(ret) if (--mem_level==0) { mem_mark(ret); \
if (!mem_allocations.empty()) { cerr << "POSSIBLE LEAKS:\n"; \
for (set<pure_expr*>::iterator x = mem_allocations.begin(); \
x != mem_allocations.end(); x++) \
cerr << (void*)(*x) << " (refc = " << (*x)->refc << "): " \
<< (*x) << endl; \
mem_allocations.clear(); \
- }
+ } }
static void mem_mark(pure_expr *x)
{
mem_allocations.erase(x);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-06-18 20:32:37
|
Revision: 261
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=261&view=rev
Author: agraef
Date: 2008-06-18 13:32:46 -0700 (Wed, 18 Jun 2008)
Log Message:
-----------
Fix 64 bit version.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-06-18 16:39:50 UTC (rev 260)
+++ pure/trunk/runtime.cc 2008-06-18 20:32:46 UTC (rev 261)
@@ -1533,7 +1533,7 @@
return string_hash(x->data.s);
case EXPR::PTR:
#if SIZEOF_VOID_P==8
- return ((uint32_t)(uint64_t)x->data.p) ^ ((uint32_t)(((uint64_t)p)>>32));
+ return ((uint32_t)(uint64_t)x->data.p) ^ ((uint32_t)(((uint64_t)x->data.p)>>32));
#else
return (uint32_t)x->data.p;
#endif
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-22 07:03:50
|
Revision: 103
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=103&view=rev
Author: agraef
Date: 2008-05-22 00:03:58 -0700 (Thu, 22 May 2008)
Log Message:
-----------
Fix memleak in catch function.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-22 06:44:20 UTC (rev 102)
+++ pure/trunk/runtime.cc 2008-05-22 07:03:58 UTC (rev 103)
@@ -658,7 +658,6 @@
pure_expr *e = interp.estk.front().e;
interp.estk.pop_front();
// collect garbage
- pure_new_internal(x);
pure_expr *tmps = interp.tmps;
while (tmps) {
pure_expr *next = tmps->xp;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-22 07:10:24
|
Revision: 104
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=104&view=rev
Author: agraef
Date: 2008-05-22 00:10:33 -0700 (Thu, 22 May 2008)
Log Message:
-----------
Fix bug in memory debugging code.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-22 07:03:58 UTC (rev 103)
+++ pure/trunk/runtime.cc 2008-05-22 07:10:33 UTC (rev 104)
@@ -52,6 +52,9 @@
if (x->tag == EXPR::APP) {
mem_mark(x->data.x[0]);
mem_mark(x->data.x[1]);
+ } else if (x->tag >= 0 && x->data.clos) {
+ for (size_t i = 0; i < x->data.clos->m; i++)
+ mem_mark(x->data.clos->env[i]);
}
}
#else
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-24 10:23:42
|
Revision: 119
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=119&view=rev
Author: agraef
Date: 2008-05-24 03:23:49 -0700 (Sat, 24 May 2008)
Log Message:
-----------
Bugfixes in pure_sscanf.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-24 05:29:06 UTC (rev 118)
+++ pure/trunk/runtime.cc 2008-05-24 10:23:49 UTC (rev 119)
@@ -1783,7 +1783,7 @@
extern "C"
int pure_sscanf(const char *buf, const char *format)
{
- int count, res = sscanf(buf, myformat(format), &count);
+ int count = -1, res = sscanf(buf, myformat(format), &count);
return (res >= 0)?count:-1;
}
@@ -1793,28 +1793,28 @@
// wrap this up in case int on the target platform is not 32 bit
int count, y, res = sscanf(buf, myformat(format), &y, &count);
*x = y;
- return (res > 0)?count:-1;
+ return (res >= 0)?count:-1;
}
extern "C"
int pure_sscanf_double(const char *buf, const char *format, double *x)
{
- int count, res = sscanf(buf, myformat(format), x, &count);
- return (res > 0)?count:-1;
+ int count = -1, res = sscanf(buf, myformat(format), x, &count);
+ return (res >= 0)?count:-1;
}
extern "C"
int pure_sscanf_string(const char *buf, const char *format, char *x)
{
- int count, res = sscanf(buf, myformat(format), x, &count);
- return (res > 0)?count:-1;
+ int count = -1, res = sscanf(buf, myformat(format), x, &count);
+ return (res >= 0)?count:-1;
}
extern "C"
int pure_sscanf_pointer(const char *buf, const char *format, void **x)
{
- int count, res = sscanf(buf, myformat(format), x, &count);
- return (res > 0)?count:-1;
+ int count = -1, res = sscanf(buf, myformat(format), x, &count);
+ return (res >= 0)?count:-1;
}
#include <fnmatch.h>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-24 10:29:57
|
Revision: 120
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=120&view=rev
Author: agraef
Date: 2008-05-24 03:30:04 -0700 (Sat, 24 May 2008)
Log Message:
-----------
Bugfixes in pure_sscanf.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-24 10:23:49 UTC (rev 119)
+++ pure/trunk/runtime.cc 2008-05-24 10:30:04 UTC (rev 120)
@@ -1791,7 +1791,7 @@
int pure_sscanf_int(const char *buf, const char *format, int32_t *x)
{
// wrap this up in case int on the target platform is not 32 bit
- int count, y, res = sscanf(buf, myformat(format), &y, &count);
+ int count = -1, y, res = sscanf(buf, myformat(format), &y, &count);
*x = y;
return (res >= 0)?count:-1;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-25 16:01:06
|
Revision: 135
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=135&view=rev
Author: agraef
Date: 2008-05-25 09:01:10 -0700 (Sun, 25 May 2008)
Log Message:
-----------
Bugfix in pointer -> bigint conversion.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-25 15:56:23 UTC (rev 134)
+++ pure/trunk/runtime.cc 2008-05-25 16:01:10 UTC (rev 135)
@@ -1211,11 +1211,12 @@
case EXPR::INT: return pure_pointer((void*)x->data.i);
case EXPR::BIGINT:
if (sizeof(mp_limb_t) == 8)
- return pure_pointer((void*)x->data.z->_mp_d[0]);
+ return pure_pointer((void*)mpz_getlimbn(x->data.z, 0));
else if (sizeof(void*) == 4)
return pure_pointer((void*)mpz_get_ui(x->data.z));
else {
- uint64_t u = x->data.z->_mp_d[0]+(((uint64_t)x->data.z->_mp_d[1])<<32);
+ uint64_t u = mpz_getlimbn(x->data.z, 0) +
+ (((uint64_t)mpz_getlimbn(x->data.z, 1))<<32);
return pure_pointer((void*)u);
}
default: return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-05-28 05:58:46
|
Revision: 153
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=153&view=rev
Author: agraef
Date: 2008-05-27 22:58:54 -0700 (Tue, 27 May 2008)
Log Message:
-----------
Remove obsolete debugging code.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-05-28 05:50:36 UTC (rev 152)
+++ pure/trunk/runtime.cc 2008-05-28 05:58:54 UTC (rev 153)
@@ -491,7 +491,6 @@
(sizeof(mp_limb_t) == 8) ? (uint64_t)mpz_getlimbn(x->data.z, 0) :
(mpz_getlimbn(x->data.z, 0) +
(((uint64_t)mpz_getlimbn(x->data.z, 1))<<32));
- cerr << "v = " << v << endl;
return (mpz_sgn(x->data.z) < 0) ? -(int64_t)v : (int64_t)v;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-06-09 22:40:16
|
Revision: 198
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=198&view=rev
Author: agraef
Date: 2008-06-09 15:40:23 -0700 (Mon, 09 Jun 2008)
Log Message:
-----------
Replace malloc.h with stdlib.h.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-06-09 22:26:09 UTC (rev 197)
+++ pure/trunk/runtime.cc 2008-06-09 22:40:23 UTC (rev 198)
@@ -5,7 +5,7 @@
#include "util.hh"
#include <readline/readline.h>
#include <readline/history.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <stdarg.h>
#include <iostream>
#include <sstream>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-06-09 23:11:04
|
Revision: 200
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=200&view=rev
Author: agraef
Date: 2008-06-09 16:11:12 -0700 (Mon, 09 Jun 2008)
Log Message:
-----------
Get alloca on Windows using mingw.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-06-09 23:02:05 UTC (rev 199)
+++ pure/trunk/runtime.cc 2008-06-09 23:11:12 UTC (rev 200)
@@ -13,6 +13,9 @@
# endif
# endif
#endif
+#ifdef __MINGW32__
+#include <malloc.h>
+#endif
#include "runtime.h"
#include "expr.hh"
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-06-30 19:08:14
|
Revision: 344
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=344&view=rev
Author: agraef
Date: 2008-06-30 12:08:19 -0700 (Mon, 30 Jun 2008)
Log Message:
-----------
Fix up debugging messages.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-06-30 12:20:06 UTC (rev 343)
+++ pure/trunk/runtime.cc 2008-06-30 19:08:19 UTC (rev 344)
@@ -1228,7 +1228,7 @@
assert(f0->data.clos->env[j]->refc > 0);
f0->data.clos->env[j]->refc++;
}
-#if SSTK_DEBUG>1
+#if SSTK_DEBUG
cerr << "++ stack: (sz = " << sz << ")\n";
for (size_t i = 0; i < sz; i++) {
pure_expr *x = sstk[i];
@@ -1242,13 +1242,20 @@
interp.sstk_sz = sz;
}
#if DEBUG>1
- cerr << "pure_apply: calling " << x << " (" << y << ") -> " << fp << endl;
+ cerr << "pure_apply: calling " << f0 << " -> " << fp << endl;
+ for (size_t j = 0; j < n; j++)
+ cerr << "arg#" << j << " = " << (pure_expr*)argv[j] << " -> " << argv[j] << ", refc = " << ((pure_expr*)argv[j])->refc << endl;
+ for (size_t j = 0; j < m; j++)
+ cerr << "env#" << j << " = " << f0->data.clos->env[j] << " -> " << (void*)f0->data.clos->env[j] << ", refc = " << f0->data.clos->env[j]->refc << endl;
#endif
checkstk(test);
if (m>0)
xfuncall(ret, fp, n, env, argv)
else
funcall(ret, fp, n, argv)
+#if DEBUG>1
+ cerr << "pure_apply: result " << f0 << " = " << ret << " -> " << (void*)ret << ", refc = " << ret->refc << endl;
+#endif
pure_free_internal(f0);
return ret;
} else {
@@ -1300,7 +1307,7 @@
sstk[sz++] = x->data.clos->env[j];
assert(env[j]->refc > 0); env[j]->refc++;
}
-#if SSTK_DEBUG>1
+#if SSTK_DEBUG
cerr << "++ stack: (sz = " << sz << ")\n";
for (size_t i = 0; i < sz; i++) {
pure_expr *x = sstk[i];
@@ -1583,7 +1590,7 @@
x->refc++;
else
pure_new_internal(x);
-#if SSTK_DEBUG>1
+#if SSTK_DEBUG
cerr << "++ stack: (sz = " << sz << ")\n";
for (size_t i = 0; i < sz; i++) {
pure_expr *x = sstk[i];
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-07-02 08:02:22
|
Revision: 364
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=364&view=rev
Author: agraef
Date: 2008-07-02 01:02:31 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
Bugfix: bigint->int conversion dropped sign.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-07-02 08:01:36 UTC (rev 363)
+++ pure/trunk/runtime.cc 2008-07-02 08:02:31 UTC (rev 364)
@@ -1689,7 +1689,7 @@
assert(x);
switch (x->tag) {
case EXPR::INT: return x;
- case EXPR::BIGINT: return pure_int(mpz_get_ui(x->data.z));
+ case EXPR::BIGINT: return pure_int(mpz_get_si(x->data.z));
case EXPR::DBL: return pure_int((int32_t)x->data.d);
#if SIZEOF_VOID_P==8
// Must cast to 64 bit here first, since on 64 bit systems g++ gives an
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-07-02 19:26:16
|
Revision: 369
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=369&view=rev
Author: agraef
Date: 2008-07-02 12:26:25 -0700 (Wed, 02 Jul 2008)
Log Message:
-----------
Bugfix: double->bigint conversion not working.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-07-02 08:24:19 UTC (rev 368)
+++ pure/trunk/runtime.cc 2008-07-02 19:26:25 UTC (rev 369)
@@ -1774,7 +1774,7 @@
return x;
else if (x->tag == EXPR::PTR)
return pointer_to_bigint(x->data.p);
- else if (x->tag != EXPR::INT && x->tag == EXPR::DBL)
+ else if (x->tag != EXPR::INT && x->tag != EXPR::DBL)
return 0;
pure_expr *y = pure_bigint(0, 0);
mpz_t& z = y->data.z;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-07-09 04:06:48
|
Revision: 426
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=426&view=rev
Author: agraef
Date: 2008-07-08 21:06:57 -0700 (Tue, 08 Jul 2008)
Log Message:
-----------
Fix Windows compilation quirks.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-07-08 20:38:51 UTC (rev 425)
+++ pure/trunk/runtime.cc 2008-07-09 04:06:57 UTC (rev 426)
@@ -1908,6 +1908,10 @@
return (y ^ (y >> 18));
}
+#undef N
+#undef M
+#undef K
+
extern "C"
pure_expr *bigint_neg(mpz_t x)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ag...@us...> - 2008-07-16 08:05:20
|
Revision: 438
http://pure-lang.svn.sourceforge.net/pure-lang/?rev=438&view=rev
Author: agraef
Date: 2008-07-16 01:05:23 -0700 (Wed, 16 Jul 2008)
Log Message:
-----------
Add limits.h.
Modified Paths:
--------------
pure/trunk/runtime.cc
Modified: pure/trunk/runtime.cc
===================================================================
--- pure/trunk/runtime.cc 2008-07-13 10:25:17 UTC (rev 437)
+++ pure/trunk/runtime.cc 2008-07-16 08:05:23 UTC (rev 438)
@@ -26,6 +26,7 @@
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
+#include <limits.h>
#include <iostream>
#include <sstream>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|