From: Charles R. <cr...@us...> - 2005-07-22 15:42:36
|
Update of /cvsroot/xsb/XSB/emu In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28979/emu Modified Files: basictypes.h binding.h box_defines.h cell_xsb.h emuloop.c std_pred_xsb_i.h Log Message: Made double floating point numbers the default. Single precision floats can be reverted to with the configure option --enable-fast-floats Index: basictypes.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/basictypes.h,v retrieving revision 1.19 retrieving revision 1.20 diff -u -r1.19 -r1.20 --- basictypes.h 18 Jul 2005 21:54:00 -0000 1.19 +++ basictypes.h 22 Jul 2005 15:42:12 -0000 1.20 @@ -30,7 +30,7 @@ /******************* * Definitions for the basic Integer and Floating point types. -* Each type varies depending on whether the BITS64 and PRECISE_FLOATS flags are set. +* Each type varies depending on whether the BITS64 and FAST_FLOATS flags are set. * These types should be used in place of 'float' and 'int' *******************/ #ifdef BITS64 @@ -45,7 +45,7 @@ typedef double prolog_float; -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS typedef double Float; #else typedef float Float; Index: binding.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/binding.h,v retrieving revision 1.18 retrieving revision 1.19 diff -u -r1.18 -r1.19 --- binding.h 18 Jul 2005 21:54:01 -0000 1.18 +++ binding.h 22 Jul 2005 15:42:12 -0000 1.19 @@ -160,7 +160,7 @@ cell(addr) = binttemp;} -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS //Below, bind_boxedfloat builds a boxedfloat, from Float 'value', on the heap. //It also creates a Cell pointing to it, and inserts it at addr. //Pre-condition: value must be a 64-bit floating point value Index: box_defines.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/box_defines.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- box_defines.h 18 Jul 2005 21:54:01 -0000 1.1 +++ box_defines.h 22 Jul 2005 15:42:13 -0000 1.2 @@ -22,12 +22,15 @@ #define INT_LOW_24_BITS(value) (((unsigned)(value)) >> 24) -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS //The below macros expect "float" to be a double float variable local to the thread it is envoked in. // Any caller must ensure that it isn't something such as a macro that produces a function call, // a constant, an expression, or a static/global variable (for thread-safe safety) #define FLOAT_HIGH_16_BITS(float) ((((UInteger)(*((UInteger *)((void *)(& float)))))>>16) & LOW_16_BITS_MASK) -#define FLOAT_MIDDLE_24_BITS(float) ((((UInteger)(*(((UInteger *)((void *)(& float)))+1)))>>24)|( (UInteger)(*((UInteger *)((void *)&(float)))) & LOW_16_BITS_MASK)<<8 ) +#define FLOAT_MIDDLE_24_BITS(float) \ + ( (((UInteger)(*(((UInteger *)((void *)(& float)))+1)))>>24) \ + | (((UInteger)(*((UInteger *)((void *)&(float)))) & LOW_16_BITS_MASK)<<8) \ + ) #define FLOAT_LOW_24_BITS(float) (((UInteger)(*(((UInteger *)((void *)(& float)))+1))) & LOW_24_BITS_MASK) #endif Index: cell_xsb.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/cell_xsb.h,v retrieving revision 1.23 retrieving revision 1.24 diff -u -r1.23 -r1.24 --- cell_xsb.h 20 Jul 2005 21:54:48 -0000 1.23 +++ cell_xsb.h 22 Jul 2005 15:42:13 -0000 1.24 @@ -240,11 +240,11 @@ #define isboxedinteger(dcell) (isconstr(dcell) && (get_str_psc(dcell)==box_psc) \ && (int_val(cell(clref_val(dcell)+1))>>16 == ID_BOXED_INT)) -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS #define isboxedfloat(dcell) (isconstr(dcell) && (get_str_psc(dcell)==box_psc) \ && (int_val(cell(clref_val(dcell)+1))>>16 == ID_BOXED_FLOAT)) #else -//If PRECISE_FLOATS isn't defined, there should be no boxed floats (only Cell floats). +//If FAST_FLOATS is defined, there should be no boxed floats (only Cell floats). // isboxedfloat is therefore expanded to FALSE (0), in hopes that the optimizer will remove. // any code exclusively dependent on it. @@ -255,7 +255,7 @@ ((Integer)((((unsigned long)int_val(cell(clref_val(dcell)+2))<<24) \ | int_val(cell(clref_val(dcell)+3))))) -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS //make_float_from_ints, defined in emuloop.c, is used by EXTRACT_FLOAT_FROM_16_24_24 to combine // two UInteger values into a Float value that is twice the size the UInteger, in bytes. @@ -280,7 +280,7 @@ ) \ ) #else -//if PRECISE_FLOATS isn't defined, then boxedfloat_val should never get called. To satisfy the +//if FAST_FLOATS is defined, then boxedfloat_val should never get called. To satisfy the // compiler, boxedfloat_val has been turned into an alias for float_val, since everything that // would have been a boxedfloat should now be a float. #define boxedfloat_val(dcell) float_val(dcell) @@ -294,7 +294,7 @@ :0x80000000)) -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS /* below returns the error-code 12345.6789 if the macro is called on a non-float related cell. One should be careful with this (possibly change?), since it ordinarily can return any double in the full floating point domain, including 12345.6789.*/ @@ -305,13 +305,13 @@ ?boxedfloat_val(dcell) \ :12345.6789)) #else -//when PRECISE_FLOATS isn't defined, ofloat_val exists for the same reason that boxedfloat_val -// does in the undefined PRECISE_FLOATS case. See boxedfloat_val for comments. +//when FAST_FLOATS is defined, ofloat_val exists for the same reason that boxedfloat_val +// does in the FAST_FLOATS defined case. See boxedfloat_val for comments. #define ofloat_val(dcell) float_val(dcell) #endif -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS #define isofloat(val) ( (isboxedfloat(val)) || (isfloat(val)) ) #else #define isofloat(val) isfloat(val) @@ -335,14 +335,14 @@ } else {bld_int(addr,((Integer)value));} -//if PRECISE_FLOATS isn't defined, then bld_boxedfloat becomes an alias for bld_float. If it is +//if FAST_FLOATS is defined, then bld_boxedfloat becomes an alias for bld_float. If it is //defined, bld_boxedfloat is a function declaired here and implemented in emuloop.c. -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS #include "context.h" //Note: anything that includes cell_xsb.h in the multithreaded environment implicitly includes //context.h as well, since bld_boxedfloat references hreg. extern inline void bld_boxedfloat(CTXTdeclc CPtr, Float); -#endif /*PRECISE_FLOATS*/ +#endif /*FAST_FLOATS*/ #endif /* __CELL_XSB_H__ */ Index: emuloop.c =================================================================== RCS file: /cvsroot/xsb/XSB/emu/emuloop.c,v retrieving revision 1.115 retrieving revision 1.116 diff -u -r1.115 -r1.116 --- emuloop.c 20 Jul 2005 16:45:22 -0000 1.115 +++ emuloop.c 22 Jul 2005 15:42:14 -0000 1.116 @@ -254,9 +254,9 @@ //Below is the implementation of the inline functions for creating and manipulating boxed floats, -// declared in cell_xsb.h. They only exist if the PRECISE_FLOATS tag is defined. Otherwise, they +// declared in cell_xsb.h. They only exist if the FAST_FLOATS tag is undefined. Otherwise, they // are defined as Cell-based macros. See cell_xsb.h for details. -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS inline void bld_boxedfloat(CTXTdeclc CPtr addr, Float value) { Float tempFloat = value; Index: std_pred_xsb_i.h =================================================================== RCS file: /cvsroot/xsb/XSB/emu/std_pred_xsb_i.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- std_pred_xsb_i.h 18 Jul 2005 21:54:11 -0000 1.24 +++ std_pred_xsb_i.h 22 Jul 2005 15:42:17 -0000 1.25 @@ -484,7 +484,7 @@ Float float_temp; //TODO: Refactor the below few lines of code once the "Floats are always double?" //situation is resolved. -#ifdef PRECISE_FLOATS +#ifndef FAST_FLOATS if (sscanf(str, "%lf%c", &float_temp, &hack_char) == 1) #else if (sscanf(str, "%f%c", &float_temp, &hack_char) == 1) |