[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] SF.net SVN: supercollider:[9601] trunk



Revision: 9601
          http://supercollider.svn.sourceforge.net/supercollider/?rev=9601&view=rev
Author:   timblech
Date:     2009-12-15 15:17:43 +0000 (Tue, 15 Dec 2009)

Log Message:
-----------
pyrslot implementation for 64bit systems

Signed-off-by: Tim Blechmann <tim@xxxxxxxxxx>

Modified Paths:
--------------
    trunk/Headers/lang/PyrSlot.h
    trunk/SConstruct
    trunk/Source/lang/LangSource/DumpParseNode.cpp
    trunk/Source/lang/LangSource/PyrObject.cpp
    trunk/Source/lang/LangSource/PyrParseNode.cpp

Added Paths:
-----------
    trunk/Headers/lang/PyrSlot32.h
    trunk/Headers/lang/PyrSlot64.h

Modified: trunk/Headers/lang/PyrSlot.h
===================================================================
--- trunk/Headers/lang/PyrSlot.h	2009-12-15 15:17:13 UTC (rev 9600)
+++ trunk/Headers/lang/PyrSlot.h	2009-12-15 15:17:43 UTC (rev 9601)
@@ -28,182 +28,24 @@
 #ifndef _PYRSLOT_H_
 #define _PYRSLOT_H_
 
-#include "SC_Endian.h"
-#include "PyrSymbol.h"
-
-#include <cassert>
-
-/*
-	Pyrite slots are the size of an 8 byte double. If the upper bits
-	indicate that the double is a 'Not-A-Number' then the upper 32
-	bits are used as a tag to indicate one of a number of other types
-	whose data is in the lower 32 bits.
-*/
-
-/* some DSPs like the TIC32 do not support 8 byte doubles */
-/* on such CPUs, set DOUBLESLOTS to zero */
-
-#define DOUBLESLOTS 1
-
-/* use the high order bits of an IEEE double NaN as a tag */
-enum {
-	tagObj     = 0x7FF90001,
-	tagInt     = 0x7FF90002,
-	tagSym     = 0x7FF90003,
-	tagChar    = 0x7FF90004,
-	tagNil     = 0x7FF90005,	// nil, false, and true are indicated by the tag alone.
-	tagFalse   = 0x7FF90006,	// the lower 32 bits are zero.
-	tagTrue    = 0x7FF90007,
-	tagPtr     = 0x7FF90008,
-	/* anything else is a double */
-	tagUnused  = 0x7FF9000D
-
-
-#if !DOUBLESLOTS
-	,tagFloat = 0x7FF9000F /* used only to initialized 4 byte float tags, never compared with */
-#endif
-};
-
-typedef union pyrslot {
-	double f;
-	struct {
-#if BYTE_ORDER == BIG_ENDIAN
-		int tag;
-#endif // BIG_ENDIAN
-		union {
-			int c; /* char */
-			int i;
-			float f;
-			void *ptr;
-			struct PyrObject *o;
-			PyrSymbol *s;
-			struct PyrMethod *om;
-			struct PyrBlock *oblk;
-			struct PyrClass *oc;
-			struct PyrFrame *of;
-			struct PyrList *ol;
-			struct PyrString *os;
-			struct PyrInt8Array *ob;
-			struct PyrDoubleArray *od;
-			struct PyrSymbolArray *osym;
-			struct PyrProcess *op;
-			struct PyrThread *ot;
-			struct PyrInterpreter *oi;
-		} u;
-#if BYTE_ORDER == LITTLE_ENDIAN
-		// need to swap on intel <sk>
-		int tag;
-#endif // LITTLE_ENDIAN
-	} s;
-} PyrSlot;
-
-/*
-	these are some defines to make accessing the structure less verbose.
-	obviously it polutes the namespace of identifiers beginning with 'u'.
-*/
-#define utag s.tag
-//int
-#define ui s.u.i
-//PyrObject
-#define uo s.u.o
-//PyrSymbol
-#define us s.u.s
-#define uc s.u.c
-#define uoc s.u.oc
-#define uof s.u.of
-#define uol s.u.ol
-#define uod s.u.od
-#define uob s.u.ob
-#define uop s.u.op
-#define uoi s.u.oi
-#define uod s.u.od
-//string
-#define uos s.u.os
-#define uot s.u.ot
-//method
-#define uom s.u.om
-//symbol array
-#define uosym s.u.osym
-#define uoblk s.u.oblk
-#define uptr s.u.ptr
-
-#if DOUBLESLOTS
-#define uf f
+#if ( __SIZEOF_POINTER__ == 4 ) || defined(__i386__) || defined(__ppc__)
+#include "PyrSlot32.h"
+#elif ( __SIZEOF_POINTER__ == 8 ) || defined(__x86_64__)
+#include "PyrSlot64.h"
 #else
-#define uf s.u.f
+#error "no PyrSlot imlementation for this platform"
 #endif
 
-/*
-	Note that on the PowerPC, the fastest way to copy a slot is to
-	copy the double field, not the struct.
-*/
+extern PyrSlot o_nil, o_true, o_false, o_inf;
+extern PyrSlot o_pi, o_twopi;
+extern PyrSlot o_fhalf, o_fnegone, o_fzero, o_fone, o_ftwo;
+extern PyrSlot o_negtwo, o_negone, o_zero, o_one, o_two;
+extern PyrSlot o_emptyarray, o_onenilarray, o_argnamethis;
 
-inline int GetTag(PyrSlot* slot) { return slot->utag; }
+extern PyrSymbol *s_object; // "Object"
+extern PyrSymbol *s_this; // "this"
+extern PyrSymbol *s_super; // "super"
 
-/* some macros for setting values of slots */
-inline void SetInt(PyrSlot* slot, int val)    {  (slot)->utag = tagInt;  (slot)->ui = (val); }
-inline void SetObject(PyrSlot* slot, void* val) {  (slot)->utag = tagObj;   (slot)->uo = (PyrObject*)(val); }
-inline void SetSymbol(PyrSlot* slot, PyrSymbol *val) {  (slot)->utag = tagSym;   (slot)->us = (val); }
-inline void SetChar(PyrSlot* slot, char val)   {  (slot)->utag = tagChar;  (slot)->uc = (val); }
-inline void SetPtr(PyrSlot* slot, void* val)    {  (slot)->utag = tagPtr;  (slot)->uptr = (void*)(val); }
-inline void SetObjectOrNil(PyrSlot* slot, PyrObject* val)
-{
-	if (val) {
-		(slot)->utag = tagObj;
-		(slot)->uo = (val);
-	} else {
-		(slot)->utag = tagNil;
-		(slot)->ui = 0;
-	}
-}
-
-inline void SetTrue(PyrSlot* slot)   { (slot)->utag = tagTrue; (slot)->ui = 0; }
-inline void SetFalse(PyrSlot* slot)   { (slot)->utag = tagFalse; (slot)->ui = 0; }
-inline void SetBool(PyrSlot* slot, bool test)	{ (slot)->utag = ((test) ? tagTrue : tagFalse); (slot)->ui = 0;  }
-inline void SetNil(PyrSlot* slot)    { (slot)->utag = tagNil;  (slot)->ui = 0; }
-
-#if DOUBLESLOTS
-inline void SetFloat(PyrSlot* slot, double val)    { (slot)->uf = (val); }
-#else
-inline void SetFloat(PyrSlot* slot, double val)    { (slot)->utag = s_float; (slot)->uf = (val); }
-#endif
-
-
-inline void SetTagRaw(PyrSlot* slot, int tag) { slot->utag = tag; }
-
-inline bool IsObj(PyrSlot* slot) { return ((slot)->utag == tagObj); }
-inline bool NotObj(PyrSlot* slot) { return ((slot)->utag != tagObj); }
-
-inline bool IsNil(PyrSlot* slot) { return ((slot)->utag == tagNil); }
-inline bool NotNil(PyrSlot* slot) { return ((slot)->utag != tagNil); }
-
-inline bool IsFalse(PyrSlot* slot) { return ((slot)->utag == tagFalse); }
-inline bool IsTrue(PyrSlot* slot) { return ((slot)->utag == tagTrue); }
-
-inline bool SlotEq(PyrSlot* a, PyrSlot* b) { return ((a)->ui == (b)->ui && (a)->utag == (b)->utag); }
-
-inline bool IsSym(PyrSlot* slot) { return ((slot)->utag == tagSym); }
-inline bool NotSym(PyrSlot* slot) { return ((slot)->utag != tagSym); }
-
-inline bool IsChar(PyrSlot* slot) { return ((slot)->utag == tagChar); }
-inline bool NotChar(PyrSlot* slot) { return ((slot)->utag != tagChar); }
-
-inline bool IsInt(PyrSlot* slot) { return ((slot)->utag == tagInt); }
-inline bool NotInt(PyrSlot* slot) { return ((slot)->utag != tagInt); }
-
-inline bool IsFloatTag(int tag)  { return ((tag & 0xFFFFFFF0) != 0x7FF90000); }
-inline bool IsFloat(PyrSlot* slot) { return (((slot)->utag & 0xFFFFFFF0) != 0x7FF90000); }
-inline bool NotFloat(PyrSlot* slot) { return (((slot)->utag & 0xFFFFFFF0) == 0x7FF90000); }
-
-inline bool IsPtr(PyrSlot* slot) { return ((slot)->utag == tagPtr); }
-
-inline void SetRawChar(PyrSlot* slot, int val) { assert(IsChar(slot)); slot->uc = val; }
-inline void SetRaw(PyrSlot* slot, int val) { assert(IsInt(slot)); slot->ui = val; }
-inline void SetRaw(PyrSlot* slot, PyrObject * val) { assert(IsObj(slot)); slot->uo = val; }
-inline void SetRaw(PyrSlot* slot, PyrSymbol * val) { assert(IsSym(slot)); slot->us = val; }
-inline void SetRaw(PyrSlot* slot, void * val) { assert(IsPtr(slot)); slot->uptr = val; }
-inline void SetRaw(PyrSlot* slot, double val) { assert(IsFloat(slot)); SetFloat(slot, val); }
-
 void dumpPyrSlot(PyrSlot* slot);
 void slotString(PyrSlot *slot, char *str);
 void slotOneWord(PyrSlot *slot, char *str);
@@ -218,183 +60,4 @@
 int slotPStrVal(PyrSlot *slot, unsigned char *str);
 int slotSymbolVal(PyrSlot *slot, PyrSymbol **symbol);
 
-extern PyrSlot o_nil, o_true, o_false, o_inf;
-extern PyrSlot o_pi, o_twopi;
-extern PyrSlot o_fhalf, o_fnegone, o_fzero, o_fone, o_ftwo;
-extern PyrSlot o_negtwo, o_negone, o_zero, o_one, o_two;
-extern PyrSlot o_emptyarray, o_onenilarray, o_argnamethis;
-
-extern PyrSymbol *s_object; // "Object"
-extern PyrSymbol *s_this; // "this"
-extern PyrSymbol *s_super; // "super"
-
-inline int slotFloatVal(PyrSlot *slot, float *value)
-{
-	if (IsFloat(slot)) {
-		*value = static_cast<float>(slot->uf);
-		return errNone;
-	} else if (IsInt(slot)) {
-		 *value = static_cast<float>(slot->ui);
-		return errNone;
-	}
-	return errWrongType;
-}
-
-inline int slotIntVal(PyrSlot *slot, int *value)
-{
-	if (IsInt(slot)) {
-		 *value = slot->ui;
-		return errNone;
-	} else if (IsFloat(slot)) {
-		*value = (int)slot->uf;
-		return errNone;
-	}
-	return errWrongType;
-}
-
-inline int slotDoubleVal(PyrSlot *slot, double *value)
-{
-	if (IsFloat(slot)) {
-		*value = slot->uf;
-		return errNone;
-	} else if (IsInt(slot)) {
-		 *value = slot->ui;
-		return errNone;
-	}
-	return errWrongType;
-}
-
-inline int slotSymbolVal(PyrSlot *slot, PyrSymbol **symbol)
-{
-	if (!IsSym(slot)) return errWrongType;
-	*symbol = slot->us;
-	return errNone;
-}
-
-inline void* slotRawPtr(PyrSlot *slot)
-{
-	assert(IsPtr(slot));
-	return slot->s.u.ptr;
-}
-
-inline PyrBlock* slotRawBlock(PyrSlot *slot)
-{
-	return slot->s.u.oblk;
-}
-
-inline PyrSymbolArray* slotRawSymbolArray(PyrSlot *slot)
-{
-	return slot->s.u.osym;
-}
-
-inline PyrDoubleArray* slotRawDoubleArray(PyrSlot *slot)
-{
-	return slot->s.u.od;
-}
-
-inline PyrInt8Array* slotRawInt8Array(PyrSlot *slot)
-{
-	return slot->s.u.ob;
-}
-
-inline PyrMethod* slotRawMethod(PyrSlot *slot)
-{
-	return slot->s.u.om;
-}
-
-inline PyrThread* slotRawThread(PyrSlot *slot)
-{
-	return slot->s.u.ot;
-}
-
-inline PyrString* slotRawString(PyrSlot *slot)
-{
-	return slot->s.u.os;
-}
-
-inline PyrList* slotRawList(PyrSlot *slot)
-{
-	return slot->s.u.ol;
-}
-
-inline PyrFrame* slotRawFrame(PyrSlot *slot)
-{
-	return slot->s.u.of;
-}
-
-inline PyrClass* slotRawClass(PyrSlot *slot)
-{
-	return slot->s.u.oc;
-}
-
-inline PyrInterpreter* slotRawInterpreter(PyrSlot *slot)
-{
-	return slot->s.u.oi;
-}
-
-inline PyrSymbol* slotRawSymbol(PyrSlot *slot)
-{
-	assert(IsSym(slot));
-	return slot->s.u.s;
-}
-
-inline int slotRawChar(PyrSlot *slot)
-{
-	assert(IsChar(slot));
-	return slot->s.u.c;
-}
-
-inline int slotRawInt(PyrSlot *slot)
-{
-	assert(IsInt(slot));
-	return slot->s.u.i;
-}
-
-inline double slotRawFloat(PyrSlot *slot)
-{
-	assert(IsFloat(slot));
-	return slot->uf;
-}
-
-inline PyrObject* slotRawObject(PyrSlot *slot)
-{
-	assert(IsObj(slot));
-	return slot->s.u.o;
-}
-
-inline void slotCopy(PyrSlot *dst, PyrSlot *src)
-{
-	double *dstp = (double*)dst;
-	double *srcp = (double*)src;
-	*dstp = *srcp;
-}
-
-inline void slotCopy(PyrSlot *dst, PyrSlot *src, int num)
-{
-	double *dstp = (double*)dst - 1;
-	double *srcp = (double*)src - 1;
-	for (int i=0;i<num;++i) { *++dstp = *++srcp; }
-}
-
-#undef uptr
-#undef uoblk
-#undef uosym
-#undef uom
-#undef uot
-#undef uos
-#undef uod
-#undef uob
-#undef uol
-#undef uof
-#undef uoc
-#undef utag
-#undef us
-#undef uc
-#undef uo
-#undef uoi
-#undef ui
-//#undef uf
-
-#undef uop
-
 #endif

Copied: trunk/Headers/lang/PyrSlot32.h (from rev 9600, trunk/Headers/lang/PyrSlot.h)
===================================================================
--- trunk/Headers/lang/PyrSlot32.h	                        (rev 0)
+++ trunk/Headers/lang/PyrSlot32.h	2009-12-15 15:17:43 UTC (rev 9601)
@@ -0,0 +1,376 @@
+/*
+	SuperCollider real time audio synthesis system
+    Copyright (c) 2002 James McCartney. All rights reserved.
+	http://www.audiosynth.com
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+/*
+
+PyrSlot is a value holder for SC variables.
+A PyrSlot is an 8-byte value which is either a double precision float or a
+32-bit tag plus a 32-bit value.
+
+*/
+
+#ifndef _PYRSLOT32_H_
+#define _PYRSLOT32_H_
+
+#include "SC_Endian.h"
+#include "PyrSymbol.h"
+
+#include <cassert>
+
+/*
+	Pyrite slots are the size of an 8 byte double. If the upper bits
+	indicate that the double is a 'Not-A-Number' then the upper 32
+	bits are used as a tag to indicate one of a number of other types
+	whose data is in the lower 32 bits.
+*/
+
+/* some DSPs like the TIC32 do not support 8 byte doubles */
+/* on such CPUs, set DOUBLESLOTS to zero */
+
+#define DOUBLESLOTS 1
+
+/* use the high order bits of an IEEE double NaN as a tag */
+enum {
+	tagObj     = 0x7FF90001,
+	tagInt     = 0x7FF90002,
+	tagSym     = 0x7FF90003,
+	tagChar    = 0x7FF90004,
+	tagNil     = 0x7FF90005,	// nil, false, and true are indicated by the tag alone.
+	tagFalse   = 0x7FF90006,	// the lower 32 bits are zero.
+	tagTrue    = 0x7FF90007,
+	tagPtr     = 0x7FF90008,
+	/* anything else is a double */
+	tagUnused  = 0x7FF9000D
+
+
+#if !DOUBLESLOTS
+	,tagFloat = 0x7FF9000F /* used only to initialized 4 byte float tags, never compared with */
+#endif
+};
+
+typedef union pyrslot {
+	double f;
+	struct {
+#if BYTE_ORDER == BIG_ENDIAN
+		int tag;
+#endif // BIG_ENDIAN
+		union {
+			int c; /* char */
+			int i;
+			float f;
+			void *ptr;
+			struct PyrObject *o;
+			PyrSymbol *s;
+			struct PyrMethod *om;
+			struct PyrBlock *oblk;
+			struct PyrClass *oc;
+			struct PyrFrame *of;
+			struct PyrList *ol;
+			struct PyrString *os;
+			struct PyrInt8Array *ob;
+			struct PyrDoubleArray *od;
+			struct PyrSymbolArray *osym;
+			struct PyrProcess *op;
+			struct PyrThread *ot;
+			struct PyrInterpreter *oi;
+		} u;
+#if BYTE_ORDER == LITTLE_ENDIAN
+		// need to swap on intel <sk>
+		int tag;
+#endif // LITTLE_ENDIAN
+	} s;
+} PyrSlot;
+
+/*
+	these are some defines to make accessing the structure less verbose.
+	obviously it polutes the namespace of identifiers beginning with 'u'.
+*/
+#define utag s.tag
+//int
+#define ui s.u.i
+//PyrObject
+#define uo s.u.o
+//PyrSymbol
+#define us s.u.s
+#define uc s.u.c
+#define uoc s.u.oc
+#define uof s.u.of
+#define uol s.u.ol
+#define uod s.u.od
+#define uob s.u.ob
+#define uop s.u.op
+#define uoi s.u.oi
+#define uod s.u.od
+//string
+#define uos s.u.os
+#define uot s.u.ot
+//method
+#define uom s.u.om
+//symbol array
+#define uosym s.u.osym
+#define uoblk s.u.oblk
+#define uptr s.u.ptr
+
+#if DOUBLESLOTS
+#define uf f
+#else
+#define uf s.u.f
+#endif
+
+/*
+	Note that on the PowerPC, the fastest way to copy a slot is to
+	copy the double field, not the struct.
+*/
+
+inline int GetTag(PyrSlot* slot) { return slot->utag; }
+
+/* some macros for setting values of slots */
+inline void SetInt(PyrSlot* slot, int val)    {  (slot)->utag = tagInt;  (slot)->ui = (val); }
+inline void SetObject(PyrSlot* slot, void* val) {  (slot)->utag = tagObj;   (slot)->uo = (PyrObject*)(val); }
+inline void SetSymbol(PyrSlot* slot, PyrSymbol *val) {  (slot)->utag = tagSym;   (slot)->us = (val); }
+inline void SetChar(PyrSlot* slot, char val)   {  (slot)->utag = tagChar;  (slot)->uc = (val); }
+inline void SetPtr(PyrSlot* slot, void* val)    {  (slot)->utag = tagPtr;  (slot)->uptr = (void*)(val); }
+inline void SetObjectOrNil(PyrSlot* slot, PyrObject* val)
+{
+	if (val) {
+		(slot)->utag = tagObj;
+		(slot)->uo = (val);
+	} else {
+		(slot)->utag = tagNil;
+		(slot)->ui = 0;
+	}
+}
+
+inline void SetTrue(PyrSlot* slot)   { (slot)->utag = tagTrue; (slot)->ui = 0; }
+inline void SetFalse(PyrSlot* slot)   { (slot)->utag = tagFalse; (slot)->ui = 0; }
+inline void SetBool(PyrSlot* slot, bool test)	{ (slot)->utag = ((test) ? tagTrue : tagFalse); (slot)->ui = 0;  }
+inline void SetNil(PyrSlot* slot)    { (slot)->utag = tagNil;  (slot)->ui = 0; }
+
+#if DOUBLESLOTS
+inline void SetFloat(PyrSlot* slot, double val)    { (slot)->uf = (val); }
+#else
+inline void SetFloat(PyrSlot* slot, double val)    { (slot)->utag = s_float; (slot)->uf = (val); }
+#endif
+
+
+inline bool IsObj(PyrSlot* slot) { return ((slot)->utag == tagObj); }
+inline bool NotObj(PyrSlot* slot) { return ((slot)->utag != tagObj); }
+
+inline bool IsNil(PyrSlot* slot) { return ((slot)->utag == tagNil); }
+inline bool NotNil(PyrSlot* slot) { return ((slot)->utag != tagNil); }
+
+inline bool IsFalse(PyrSlot* slot) { return ((slot)->utag == tagFalse); }
+inline bool IsTrue(PyrSlot* slot) { return ((slot)->utag == tagTrue); }
+
+inline bool SlotEq(PyrSlot* a, PyrSlot* b) { return ((a)->ui == (b)->ui && (a)->utag == (b)->utag); }
+
+inline bool IsSym(PyrSlot* slot) { return ((slot)->utag == tagSym); }
+inline bool NotSym(PyrSlot* slot) { return ((slot)->utag != tagSym); }
+
+inline bool IsChar(PyrSlot* slot) { return ((slot)->utag == tagChar); }
+inline bool NotChar(PyrSlot* slot) { return ((slot)->utag != tagChar); }
+
+inline bool IsInt(PyrSlot* slot) { return ((slot)->utag == tagInt); }
+inline bool NotInt(PyrSlot* slot) { return ((slot)->utag != tagInt); }
+
+inline bool IsFloatTag(int tag)  { return ((tag & 0xFFFFFFF0) != 0x7FF90000); }
+inline bool IsFloat(PyrSlot* slot) { return (((slot)->utag & 0xFFFFFFF0) != 0x7FF90000); }
+inline bool NotFloat(PyrSlot* slot) { return (((slot)->utag & 0xFFFFFFF0) == 0x7FF90000); }
+
+inline bool IsPtr(PyrSlot* slot) { return ((slot)->utag == tagPtr); }
+
+inline void SetRawChar(PyrSlot* slot, int val) { assert(IsChar(slot)); slot->uc = val; }
+inline void SetRaw(PyrSlot* slot, int val) { assert(IsInt(slot)); slot->ui = val; }
+inline void SetRaw(PyrSlot* slot, PyrObject * val) { assert(IsObj(slot)); slot->uo = val; }
+inline void SetRaw(PyrSlot* slot, PyrSymbol * val) { assert(IsSym(slot)); slot->us = val; }
+inline void SetRaw(PyrSlot* slot, void * val) { assert(IsPtr(slot)); slot->uptr = val; }
+inline void SetRaw(PyrSlot* slot, double val) { assert(IsFloat(slot)); SetFloat(slot, val); }
+
+inline void SetTagRaw(PyrSlot* slot, int tag) { slot->utag = tag; }
+
+inline int slotFloatVal(PyrSlot *slot, float *value)
+{
+	if (IsFloat(slot)) {
+		*value = static_cast<float>(slot->uf);
+		return errNone;
+	} else if (IsInt(slot)) {
+		 *value = static_cast<float>(slot->ui);
+		return errNone;
+	}
+	return errWrongType;
+}
+
+inline int slotIntVal(PyrSlot *slot, int *value)
+{
+	if (IsInt(slot)) {
+		 *value = slot->ui;
+		return errNone;
+	} else if (IsFloat(slot)) {
+		*value = (int)slot->uf;
+		return errNone;
+	}
+	return errWrongType;
+}
+
+inline int slotDoubleVal(PyrSlot *slot, double *value)
+{
+	if (IsFloat(slot)) {
+		*value = slot->uf;
+		return errNone;
+	} else if (IsInt(slot)) {
+		 *value = slot->ui;
+		return errNone;
+	}
+	return errWrongType;
+}
+
+inline int slotSymbolVal(PyrSlot *slot, PyrSymbol **symbol)
+{
+	if (!IsSym(slot)) return errWrongType;
+	*symbol = slot->us;
+	return errNone;
+}
+
+inline void* slotRawPtr(PyrSlot *slot)
+{
+	assert(IsPtr(slot));
+	return slot->s.u.ptr;
+}
+
+inline PyrBlock* slotRawBlock(PyrSlot *slot)
+{
+	return slot->s.u.oblk;
+}
+
+inline PyrSymbolArray* slotRawSymbolArray(PyrSlot *slot)
+{
+	return slot->s.u.osym;
+}
+
+inline PyrDoubleArray* slotRawDoubleArray(PyrSlot *slot)
+{
+	return slot->s.u.od;
+}
+
+inline PyrInt8Array* slotRawInt8Array(PyrSlot *slot)
+{
+	return slot->s.u.ob;
+}
+
+inline PyrMethod* slotRawMethod(PyrSlot *slot)
+{
+	return slot->s.u.om;
+}
+
+inline PyrThread* slotRawThread(PyrSlot *slot)
+{
+	return slot->s.u.ot;
+}
+
+inline PyrString* slotRawString(PyrSlot *slot)
+{
+	return slot->s.u.os;
+}
+
+inline PyrList* slotRawList(PyrSlot *slot)
+{
+	return slot->s.u.ol;
+}
+
+inline PyrFrame* slotRawFrame(PyrSlot *slot)
+{
+	return slot->s.u.of;
+}
+
+inline PyrClass* slotRawClass(PyrSlot *slot)
+{
+	return slot->s.u.oc;
+}
+
+inline PyrInterpreter* slotRawInterpreter(PyrSlot *slot)
+{
+	return slot->s.u.oi;
+}
+
+inline PyrSymbol* slotRawSymbol(PyrSlot *slot)
+{
+	assert(IsSym(slot));
+	return slot->s.u.s;
+}
+
+inline int slotRawChar(PyrSlot *slot)
+{
+	assert(IsChar(slot));
+	return slot->s.u.c;
+}
+
+inline int slotRawInt(PyrSlot *slot)
+{
+	assert(IsInt(slot));
+	return slot->s.u.i;
+}
+
+inline double slotRawFloat(PyrSlot *slot)
+{
+	assert(IsFloat(slot));
+	return slot->uf;
+}
+
+inline PyrObject* slotRawObject(PyrSlot *slot)
+{
+	assert(IsObj(slot));
+	return slot->s.u.o;
+}
+
+inline void slotCopy(PyrSlot *dst, PyrSlot *src)
+{
+	double *dstp = (double*)dst;
+	double *srcp = (double*)src;
+	*dstp = *srcp;
+}
+
+inline void slotCopy(PyrSlot *dst, PyrSlot *src, int num)
+{
+	double *dstp = (double*)dst - 1;
+	double *srcp = (double*)src - 1;
+	for (int i=0;i<num;++i) { *++dstp = *++srcp; }
+}
+
+#undef uptr
+#undef uoblk
+#undef uosym
+#undef uom
+#undef uot
+#undef uos
+#undef uod
+#undef uob
+#undef uol
+#undef uof
+#undef uoc
+#undef utag
+#undef us
+#undef uc
+#undef uo
+#undef uoi
+#undef ui
+#undef uf
+
+#undef uop
+
+#endif

Added: trunk/Headers/lang/PyrSlot64.h
===================================================================
--- trunk/Headers/lang/PyrSlot64.h	                        (rev 0)
+++ trunk/Headers/lang/PyrSlot64.h	2009-12-15 15:17:43 UTC (rev 9601)
@@ -0,0 +1,275 @@
+/*
+	SuperCollider real time audio synthesis system
+	Copyright (c) 2002 James McCartney. All rights reserved.
+	Copyright (c) 2009 Tim Blechmann
+	http://www.audiosynth.com
+
+	This program is free software; you can redistribute it and/or modify
+	it under the terms of the GNU General Public License as published by
+	the Free Software Foundation; either version 2 of the License, or
+	(at your option) any later version.
+
+	This program is distributed in the hope that it will be useful,
+	but WITHOUT ANY WARRANTY; without even the implied warranty of
+	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+	GNU General Public License for more details.
+
+	You should have received a copy of the GNU General Public License
+	along with this program; if not, write to the Free Software
+	Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
+*/
+
+#ifndef _PYRSLOTGENERIC_H_
+#define _PYRSLOTGENERIC_H_
+
+#include "SC_Endian.h"
+#include "PyrSymbol.h"
+
+#include <cassert>
+
+enum {
+	tagNotInitialized, // uninitialized slots have a tag of 0
+	tagObj,
+	tagInt,
+	tagSym,
+	tagChar,
+	tagNil,		// nil, false, and true are indicated by the tag alone.
+	tagFalse,
+	tagTrue,
+	tagPtr,
+	/* anything else is a double */
+	tagFloat,
+	tagUnused,
+};
+
+typedef struct pyrslot {
+	int tag;
+
+	union {
+		int64 c; /* char */
+		int64 i;
+		double f;
+		void *ptr;
+		struct PyrObject *o;
+		PyrSymbol *s;
+		struct PyrMethod *om;
+		struct PyrBlock *oblk;
+		struct PyrClass *oc;
+		struct PyrFrame *of;
+		struct PyrList *ol;
+		struct PyrString *os;
+		struct PyrInt8Array *ob;
+		struct PyrDoubleArray *od;
+		struct PyrSymbolArray *osym;
+		struct PyrProcess *op;
+		struct PyrThread *ot;
+		struct PyrInterpreter *oi;
+	} u;
+} PyrSlot;
+
+
+/* tag setter function */
+inline int GetTag(PyrSlot* slot)  { return slot->tag; }
+
+/* tag checking functions */
+inline bool IsObj(PyrSlot* slot)  { return slot->tag == tagObj; }
+inline bool NotObj(PyrSlot* slot) { return slot->tag != tagObj; }
+
+inline bool IsNil(PyrSlot* slot)  { return slot->tag == tagNil; }
+inline bool NotNil(PyrSlot* slot) { return slot->tag != tagNil; }
+
+inline bool IsFalse(PyrSlot* slot) { return slot->tag == tagFalse; }
+inline bool IsTrue(PyrSlot* slot)  { return slot->tag == tagTrue; }
+
+inline bool IsSym(PyrSlot* slot)  { return slot->tag == tagSym; }
+inline bool NotSym(PyrSlot* slot) { return slot->tag != tagSym; }
+
+inline bool IsChar(PyrSlot* slot)  { return slot->tag == tagChar; }
+inline bool NotChar(PyrSlot* slot) { return slot->tag != tagChar; }
+
+inline bool IsInt(PyrSlot* slot)  { return slot->tag == tagInt; }
+inline bool NotInt(PyrSlot* slot) { return slot->tag != tagInt; }
+
+inline bool IsFloat(PyrSlot* slot)  { return slot->tag == tagFloat; }
+inline bool NotFloat(PyrSlot* slot) { return slot->tag != tagFloat; }
+
+inline bool IsPtr(PyrSlot* slot) { return slot->tag == tagPtr; }
+inline bool NotPtr(PyrSlot* slot) { return slot->tag != tagPtr; }
+
+
+/* setter functions */
+inline void SetInt(PyrSlot* slot, int val)           { slot->tag = tagInt;  slot->u.i = val; }
+inline void SetObject(PyrSlot* slot, void* val)      { slot->tag = tagObj;  slot->u.o = (struct PyrObject*)(val); }
+inline void SetSymbol(PyrSlot* slot, PyrSymbol *val) { slot->tag = tagSym;  slot->u.s = val; }
+inline void SetChar(PyrSlot* slot, char val)         { slot->tag = tagChar; slot->u.c = val; }
+inline void SetPtr(PyrSlot* slot, void* val)         { slot->tag = tagPtr;  slot->u.ptr = (void*)val; }
+
+inline void SetObjectOrNil(PyrSlot* slot, struct PyrObject* val)
+{
+	if (val) {
+		slot->tag = tagObj;
+		slot->u.o = val;
+	} else {
+		slot->tag = tagNil;
+		slot->u.i = 0;
+	}
+}
+
+inline void SetTrue(PyrSlot* slot)            { slot->tag = tagTrue;                     slot->u.i = 0; }
+inline void SetFalse(PyrSlot* slot)           { slot->tag = tagFalse;                    slot->u.i = 0; }
+inline void SetBool(PyrSlot* slot, bool test) { slot->tag = (test ? tagTrue : tagFalse); slot->u.i = 0; }
+inline void SetNil(PyrSlot* slot)             { slot->tag = tagNil;                      slot->u.i = 0; }
+inline void SetFloat(PyrSlot* slot, double val)    { slot->tag = tagFloat; slot->u.f = val; }
+
+
+/* raw setter functions, no typecheck */
+inline void SetRawChar(PyrSlot* slot, int val)     { assert(IsChar(slot));  slot->u.c = val; }
+inline void SetRaw(PyrSlot* slot, int val)         { assert(IsInt(slot));   slot->u.i = val; }
+inline void SetRaw(PyrSlot* slot, PyrObject * val) { assert(IsObj(slot));   slot->u.o = val; }
+inline void SetRaw(PyrSlot* slot, PyrSymbol * val) { assert(IsSym(slot));   slot->u.s = val; }
+inline void SetRaw(PyrSlot* slot, void * val)      { assert(IsPtr(slot));   slot->u.ptr = val; }
+inline void SetRaw(PyrSlot* slot, double val)      { assert(IsFloat(slot)); slot->u.f = val; }
+inline void SetTagRaw(PyrSlot* slot, int tag) { slot->tag = tag; }
+
+/* slot comparison */
+inline bool SlotEq(PyrSlot* a, PyrSlot* b)
+{
+	return (a->tag == b->tag) && (a->u.i == b->u.i);
+}
+
+/* extract numeric value */
+template <typename numeric_type>
+inline int slotVal(PyrSlot * slot, numeric_type *value)
+{
+	if (IsFloat(slot)) {
+		*value = static_cast<numeric_type>(slot->u.f);
+		return errNone;
+	} else if (IsInt(slot)) {
+		 *value = static_cast<numeric_type>(slot->u.i);
+		return errNone;
+	}
+	return errWrongType;
+}
+
+inline int slotFloatVal(PyrSlot *slot, float *value)
+{
+	return slotVal<float>(slot, value);
+}
+
+inline int slotIntVal(PyrSlot *slot, int *value)
+{
+	return slotVal<int>(slot, value);
+}
+
+inline int slotDoubleVal(PyrSlot *slot, double *value)
+{
+	return slotVal<double>(slot, value);
+}
+
+/* get symbol */
+inline int slotSymbolVal(PyrSlot *slot, PyrSymbol **symbol)
+{
+	if (!IsSym(slot)) return errWrongType;
+	*symbol = slot->u.s;
+	return errNone;
+}
+
+/* raw access functions */
+inline void* slotRawPtr(PyrSlot *slot)
+{
+	return slot->u.ptr;
+}
+
+inline PyrBlock* slotRawBlock(PyrSlot *slot)
+{
+	return slot->u.oblk;
+}
+
+inline PyrSymbolArray* slotRawSymbolArray(PyrSlot *slot)
+{
+	return slot->u.osym;
+}
+
+inline PyrDoubleArray* slotRawDoubleArray(PyrSlot *slot)
+{
+	return slot->u.od;
+}
+
+inline PyrInt8Array* slotRawInt8Array(PyrSlot *slot)
+{
+	return slot->u.ob;
+}
+
+inline PyrMethod* slotRawMethod(PyrSlot *slot)
+{
+	return slot->u.om;
+}
+
+inline PyrThread* slotRawThread(PyrSlot *slot)
+{
+	return slot->u.ot;
+}
+
+inline PyrString* slotRawString(PyrSlot *slot)
+{
+	return slot->u.os;
+}
+
+inline PyrList* slotRawList(PyrSlot *slot)
+{
+	return slot->u.ol;
+}
+
+inline PyrFrame* slotRawFrame(PyrSlot *slot)
+{
+	return slot->u.of;
+}
+
+inline PyrClass* slotRawClass(PyrSlot *slot)
+{
+	return slot->u.oc;
+}
+
+inline PyrInterpreter* slotRawInterpreter(PyrSlot *slot)
+{
+	return slot->u.oi;
+}
+
+inline PyrSymbol* slotRawSymbol(PyrSlot *slot)
+{
+	return slot->u.s;
+}
+
+inline int slotRawChar(PyrSlot *slot)
+{
+	return slot->u.c;
+}
+
+inline int slotRawInt(PyrSlot *slot)
+{
+	return slot->u.i;
+}
+
+inline double slotRawFloat(PyrSlot *slot)
+{
+	return slot->u.f;
+}
+
+inline PyrObject* slotRawObject(PyrSlot *slot)
+{
+	return slot->u.o;
+}
+
+/* slot copy functions */
+inline void slotCopy(PyrSlot *dst, PyrSlot *src)
+{
+	*dst = *src;
+}
+
+inline void slotCopy(PyrSlot *dst, PyrSlot *src, int num)
+{
+	for (int i=0;i<num;++i)
+		*++dst = *++src;
+}
+
+#endif

Modified: trunk/SConstruct
===================================================================
--- trunk/SConstruct	2009-12-15 15:17:13 UTC (rev 9600)
+++ trunk/SConstruct	2009-12-15 15:17:43 UTC (rev 9601)
@@ -328,7 +328,9 @@
     BoolOption('GPL3',
                'Allow the inclusion of gpl-3 licensed code. Makes the license of the whole package gpl-3', 0),
     PackageOption('X11',
-                  'Build with X11 support', 1),
+                'Build with X11 support', 1),
+    BoolOption('SCLANG64',
+               'Build 64bit sclang (only affects compilation on 64bit systems)', 0),
     )
 
 if PLATFORM == 'darwin':
@@ -991,8 +993,8 @@
     LIBPATH = 'build'
     )
 
-if env.has_key('amd64') and env['amd64']:
-	langEnv.Append( CFLAGS = ['-m32'],
+if env.get('amd64') and not env.get('SCLANG64'):
+    langEnv.Append( CFLAGS = ['-m32'],
                     CXXFLAGS = ['-m32'],
                     LINKFLAGS = ['-m32'],
                     CPPDEFINES = "NO_INTERNAL_SERVER")
@@ -1018,9 +1020,9 @@
     langEnv.Append(
         LINKFLAGS = '-Wl,-rpath,build -Wl,-rpath,' + FINAL_PREFIX + '/lib')
 
-    if env.has_key('amd64') and env['amd64']:
+    if env.get('amd64') and not env.get('SCLANG64'):
         langEnv.Append(LIBPATH="/emul/ia32-linux/usr/lib/,/usr/lib32/",
-		       LINKFLAGS = '-Wl,-rpath,/emul/ia32-linux/usr/lib/')
+                       LINKFLAGS = '-Wl,-rpath,/emul/ia32-linux/usr/lib/')
 
 elif PLATFORM == 'freebsd':
     langEnv.Append(
@@ -1385,6 +1387,7 @@
 print ' TERMINAL_CLIENT:         %s' % yesorno(env['TERMINAL_CLIENT'])
 print ' X11:                     %s' % yesorno(features['x11'])
 print ' GPL3:                    %s' % yesorno(env['GPL3'])
+print ' SCLANG64:                %s' % yesorno(env.get('SCLANG64'))
 print '------------------------------------------------------------------------'
 
 # ======================================================================

Modified: trunk/Source/lang/LangSource/DumpParseNode.cpp
===================================================================
--- trunk/Source/lang/LangSource/DumpParseNode.cpp	2009-12-15 15:17:13 UTC (rev 9600)
+++ trunk/Source/lang/LangSource/DumpParseNode.cpp	2009-12-15 15:17:43 UTC (rev 9601)
@@ -344,9 +344,12 @@
 			break;
 		default :
 		{
-			char fstr[32];
-			g_fmt(fstr, slotRawFloat(slot));
-			sprintf(str, "Float %s   %08X %08X", fstr, GetTag(slot), slotRawInt(slot));
+			union {
+				int32 i[2];
+				double f;
+			} u;
+			u.f = slotRawFloat(slot);
+			sprintf(str, "Float %f   %08X %08X", u.f, u.i[0], u.i[1]);
 			break;
 		}
 	}
@@ -448,7 +451,7 @@
 			sprintf(str, "ptr%08X", slotRawInt(slot));
 			break;
 		default :
-			g_fmt(str, slotRawFloat(slot));
+			sprintf(str, "%.14g", slotRawFloat(slot));
 			break;
 	}
 }
@@ -563,7 +566,6 @@
 			break;
 		default :
 			sprintf(str, "%.14g", slotRawFloat(slot));
-			//g_fmt(str, slotRawFloat(slot));
 			break;
 	}
 	return res;

Modified: trunk/Source/lang/LangSource/PyrObject.cpp
===================================================================
--- trunk/Source/lang/LangSource/PyrObject.cpp	2009-12-15 15:17:13 UTC (rev 9600)
+++ trunk/Source/lang/LangSource/PyrObject.cpp	2009-12-15 15:17:43 UTC (rev 9601)
@@ -546,8 +546,10 @@
 int numInstVars(PyrClass* classobj)
 {
 	int res;
-	if (IsNil(&classobj->instVarNames)) res = 0;
-	else res = slotRawObject(&classobj->instVarNames)->size;
+	if (IsNil(&classobj->instVarNames))
+		res = 0;
+	else
+		res = slotRawObject(&classobj->instVarNames)->size;
 	return res;
 }
 
@@ -1235,11 +1237,11 @@
 	int numInstVars, int numClassVars)
 {
 	PyrClass *superClass = NULL;
-  PyrClass *metaSuperClass = NULL;
+	PyrClass *metaSuperClass = NULL;
 	PyrSymbol *metaClassName = NULL;
 	PyrSymbol *metaSuperClassName = NULL;
 	PyrClass *classobj = NULL;
-  PyrClass *metaclassobj = NULL;
+	PyrClass *metaclassobj = NULL;
 	int superInstVars;
 
 	//postfl("makeIntrinsicClass '%s'\n", className->name);
@@ -1264,7 +1266,7 @@
 	metaclassobj = newClassObj( class_class,
 		metaClassName, metaSuperClassName,
 		classClassNumInstVars, 0, 0, 0, obj_notindexed, 0);
-	SetRaw(&metaclassobj->classFlags, slotRawInt(&metaclassobj->classFlags) | classIsIntrinsic);
+	SetInt(&metaclassobj->classFlags, slotRawInt(&metaclassobj->classFlags) | classIsIntrinsic);
 
 	if (metaSuperClassName && classClassNumInstVars) {
 		memcpy(slotRawObject(&metaclassobj->iprototype)->slots, slotRawObject(&metaSuperClass->iprototype)->slots,
@@ -1280,7 +1282,7 @@
 	classobj = newClassObj(metaclassobj,
 		className, superClassName,
 		numInstVars + superInstVars, numClassVars, 0, 0, obj_notindexed, 0);
-	SetRaw(&classobj->classFlags, slotRawInt(&classobj->classFlags) | classIsIntrinsic);
+	SetInt(&classobj->classFlags, slotRawInt(&classobj->classFlags) | classIsIntrinsic);
 
 	//postfl("%s:%s  : %d\n", className->name, superClassName->name, superInstVars);
 	if (superClass && superInstVars) {
@@ -1392,7 +1394,7 @@
 	class_arrayed_collection = makeIntrinsicClass(s_arrayed_collection, s_sequenceable_collection, 0, 0);
 	class_array = makeIntrinsicClass(s_array, s_arrayed_collection, 0, 0);
 		SetInt(&class_array->instanceFormat, obj_slot);
-		SetRaw(&class_array->classFlags, slotRawInt(&class_array->classFlags) | classHasIndexableInstances);
+		SetInt(&class_array->classFlags, slotRawInt(&class_array->classFlags) | classHasIndexableInstances);
 
 	// now fix array classptrs in already created classes
 	fixClassArrays(class_class);
@@ -1428,7 +1430,7 @@
 		//addIntrinsicVar(class_method, "callMeter", &o_zero);
 
 	class_frame = makeIntrinsicClass(s_frame, s_object, 0, 0);
-		SetRaw(&class_frame->classFlags, slotRawInt(&class_frame->classFlags) | classHasIndexableInstances);
+		SetInt(&class_frame->classFlags, slotRawInt(&class_frame->classFlags) | classHasIndexableInstances);
 		//addIntrinsicVar(class_frame, "method", &o_nil);
 		//addIntrinsicVar(class_frame, "caller", &o_nil);
 		//addIntrinsicVar(class_frame, "context", &o_nil);
@@ -1518,34 +1520,34 @@
 		//slotRawInt(&class_rawarray->classFlags) |= classHasIndexableInstances;
 	class_int8array = makeIntrinsicClass(s_int8array, s_rawarray, 0, 0);
 		SetInt(&class_int8array->instanceFormat, obj_int8);
-		SetRaw(&class_int8array->classFlags, slotRawInt(&class_int8array->classFlags) | classHasIndexableInstances);
+		SetInt(&class_int8array->classFlags, slotRawInt(&class_int8array->classFlags) | classHasIndexableInstances);
 	class_int16array = makeIntrinsicClass(s_int16array, s_rawarray, 0, 0);
 		SetInt(&class_int16array->instanceFormat, obj_int16);
-		SetRaw(&class_int16array->classFlags, slotRawInt(&class_int16array->classFlags) | classHasIndexableInstances);
+		SetInt(&class_int16array->classFlags, slotRawInt(&class_int16array->classFlags) | classHasIndexableInstances);
 	class_int32array = makeIntrinsicClass(s_int32array, s_rawarray, 0, 0);
 		SetInt(&class_int32array->instanceFormat, obj_int32);
-		SetRaw(&class_int32array->classFlags, slotRawInt(&class_int32array->classFlags) | classHasIndexableInstances);
+		SetInt(&class_int32array->classFlags, slotRawInt(&class_int32array->classFlags) | classHasIndexableInstances);
 	class_symbolarray = makeIntrinsicClass(s_symbolarray, s_rawarray, 0, 0);
 		SetInt(&class_symbolarray->instanceFormat, obj_symbol);
-		SetRaw(&class_symbolarray->classFlags, slotRawInt(&class_symbolarray->classFlags) | classHasIndexableInstances);
+		SetInt(&class_symbolarray->classFlags, slotRawInt(&class_symbolarray->classFlags) | classHasIndexableInstances);
 	class_string = makeIntrinsicClass(s_string, s_rawarray, 0, 1);
 		addIntrinsicClassVar(class_string, "unixCmdActions", &o_nil);
 		SetInt(&class_string->instanceFormat, obj_char);
-		SetRaw(&class_string->classFlags, slotRawInt(&class_string->classFlags) | classHasIndexableInstances);
+		SetInt(&class_string->classFlags, slotRawInt(&class_string->classFlags) | classHasIndexableInstances);
 	class_floatarray = makeIntrinsicClass(s_floatarray, s_rawarray, 0, 0);
 		SetInt(&class_floatarray->instanceFormat, obj_float);
-		SetRaw(&class_floatarray->classFlags, slotRawInt(&class_floatarray->classFlags) | classHasIndexableInstances);
+		SetInt(&class_floatarray->classFlags, slotRawInt(&class_floatarray->classFlags) | classHasIndexableInstances);
 	class_signal = makeIntrinsicClass(s_signal, s_floatarray, 0, 0);
 		SetInt(&class_signal->instanceFormat, obj_float);
-		SetRaw(&class_signal->classFlags, slotRawInt(&class_signal->classFlags) | classHasIndexableInstances);
+		SetInt(&class_signal->classFlags, slotRawInt(&class_signal->classFlags) | classHasIndexableInstances);
 	class_wavetable = makeIntrinsicClass(s_wavetable, s_floatarray, 0, 0);
 		SetInt(&class_wavetable->instanceFormat, obj_float);
-		SetRaw(&class_wavetable->classFlags, slotRawInt(&class_wavetable->classFlags) | classHasIndexableInstances);
+		SetInt(&class_wavetable->classFlags, slotRawInt(&class_wavetable->classFlags) | classHasIndexableInstances);
 
 		//addIntrinsicVar(class_signal, "rate", &o_nil);
 	class_doublearray = makeIntrinsicClass(s_doublearray, s_rawarray, 0, 0);
 		SetInt(&class_doublearray->instanceFormat, obj_double);
-		SetRaw(&class_doublearray->classFlags, slotRawInt(&class_doublearray->classFlags) | classHasIndexableInstances);
+		SetInt(&class_doublearray->classFlags, slotRawInt(&class_doublearray->classFlags) | classHasIndexableInstances);
 
 	class_list = makeIntrinsicClass(s_list, s_sequenceable_collection, 1, 0);
 		addIntrinsicVar(class_list, "array", &o_nil);
@@ -2312,11 +2314,11 @@
 	if (NotNil(slot)) {
 		PyrObject *obj;
 		if (IsSym(slot))
-			obj = (PyrObject*)slotRawSymbol(slot); // i don't want to know, what this means for the gc
+				obj = (PyrObject*)slotRawSymbol(slot); // i don't want to know, what this means
 		else if (IsObj(slot))
-			obj = slotRawObject(slot);
+				obj = slotRawObject(slot);
 		else
-			assert(false);
+				assert(false);
 
 		if (obj && obj->IsPermanent()) {
 			// don't deallocate these
@@ -2558,27 +2560,33 @@
 	return errNone;
 }
 
+static int hashPtr(void* ptr)
+{
+    int32 hashed_part = int32((long)ptr&0xffffffff);
+    return Hash(hashed_part);
+}
+
 int calcHash(PyrSlot *a);
 int calcHash(PyrSlot *a)
 {
 	int hash;
 	switch (GetTag(a)) {
-		case tagObj : hash = Hash((int32)slotRawObject(a)); break;
-		case tagInt : hash = Hash(slotRawInt(a)); break;
-		case tagChar : hash = Hash(slotRawChar(a) & 255); break;
-		case tagSym : hash = slotRawSymbol(a)->hash; break;
-		case tagNil : hash = 0xA5A5A5A5; break;
-		case tagFalse : hash = 0x55AA55AA; break;
-		case tagTrue : hash = 0x69696969; break;
-		case tagPtr : hash = Hash((int32)slotRawPtr(a)); break;
-		default :
-			// hash for a double
-			union {
-				int32 i[2];
-				double d;
-			} u;
-			u.d = slotRawFloat(a);
-			hash = Hash(u.i[0] + Hash(u.i[1]));
+	case tagObj : hash = hashPtr(slotRawObject(a)); break;
+	case tagInt : hash = Hash(slotRawInt(a)); break;
+	case tagChar : hash = Hash(slotRawChar(a) & 255); break;
+	case tagSym : hash = slotRawSymbol(a)->hash; break;
+	case tagNil : hash = 0xA5A5A5A5; break;
+	case tagFalse : hash = 0x55AA55AA; break;
+	case tagTrue : hash = 0x69696969; break;
+	case tagPtr : hash = hashPtr(slotRawPtr(a)); break;
+	default :
+		// hash for a double
+		union {
+			int32 i[2];
+			double d;
+		} u;
+		u.d = slotRawFloat(a);
+		hash = Hash(u.i[0] + Hash(u.i[1]));
 	}
 	return hash;
 }

Modified: trunk/Source/lang/LangSource/PyrParseNode.cpp
===================================================================
--- trunk/Source/lang/LangSource/PyrParseNode.cpp	2009-12-15 15:17:13 UTC (rev 9600)
+++ trunk/Source/lang/LangSource/PyrParseNode.cpp	2009-12-15 15:17:43 UTC (rev 9601)
@@ -332,12 +332,12 @@
 {
 	PyrClass *classobj = slotRawSymbol(&mClassName->mSlot)->u.classobj;
 	if (!classobj) {
-        char extPath[1024];
-        asRelativePath(gCompilingFileSym->name, extPath);
+		char extPath[1024];
+		asRelativePath(gCompilingFileSym->name, extPath);
 		error("Class extension for nonexistent class '%s'\n     In file:'%s'\n",
-            slotRawSymbol(&mClassName->mSlot)->name,
-            extPath
-        );
+			slotRawSymbol(&mClassName->mSlot)->name,
+			extPath
+		);
 		return;
 	}
 	gCurrentClass = classobj;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/