]> gitweb.factorcode.org Git - factor.git/commitdiff
AMD64 FFI fixes; httpd load fix; minor opengl optimization
authorSlava Pestov <slava@factorcode.org>
Mon, 30 Jan 2006 07:03:34 +0000 (07:03 +0000)
committerSlava Pestov <slava@factorcode.org>
Mon, 30 Jan 2006 07:03:34 +0000 (07:03 +0000)
CHANGES.html
contrib/httpd/test/html.factor
library/alien/compiler.factor
library/compiler/amd64/alien.factor
library/freetype/freetype-gl.factor
library/math/pow.factor
library/opengl/opengl-utils.factor
library/test/compiler/alien.factor
library/test/math/integer.factor
library/test/test.factor
native/ffi_test.c

index 350fca1e137a603b9e7f8b9ad9babc90ba66d735..8c6cecdb3690839f4e56482412a2da745fe0ee1c 100644 (file)
@@ -48,6 +48,9 @@ this is lexicographic order, and for words, this compares word names.</li>
 <code>contrib/math/</code>.</li>
 <li>The <code>mod</code> word is now supported for ratios and floating point numbers.</li>
 <li>The <code>truncate</code>, <code>floor</code> and <code>ceiling</code> words are now supported for floating point numbers.</li>
+<li>The NaN, positive infinity and negative infinity floating point numbers now parse and unparse as <code>0.0/0.0</code>, <code>1.0/0.0</code>, and <code>-1.0/0.0</code> respectively.</li>
+<li>The NaN value is now equal to itself under <code>=</code>.</li>
+<li>Negative and postive zero are no longer equal under <code>=</code>. However, the new <code>zero?</code> word tests if the top of the stack is a zero, and it tests for both positive and negative zero.</li>
 </ul>
 
 </li>
index a7595482f9f14f8387ac6ef57b6e6e595944f729..a1fc1aec6372727e45fd0689935e11965148eedd 100644 (file)
@@ -2,7 +2,7 @@ IN: temporary
 USING: html http io kernel namespaces styles test xml ;
 
 [
-    "/responder/foo/?z=%20"
+    "/responder/foo?z=%20"
 ] [
     "/responder/foo" H{ { "z" " " } } build-url
 ] unit-test
index 31c216705f9006c697d26be03a2fbf30bff4034f..d6af9ee4320c29db9033f5103eafdfe68cde94ea 100644 (file)
@@ -1,5 +1,5 @@
-! Copyright (C) 2004, 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
+! Copyright (C) 2004, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
 IN: alien
 USING: assembler compiler compiler-backend compiler-frontend
 errors generic hashtables inference inspector io kernel
@@ -116,12 +116,16 @@ C: alien-node make-node ;
         c-type [ "boxer" get "reg-class" get ] bind %box ,
     ] if ;
 
+: linearize-cleanup ( node -- )
+    node-param cdr library-abi "stdcall" =
+    [ dup parameters stack-space %cleanup , ] unless ;
+
 M: alien-node linearize* ( node -- )
     dup parameters linearize-parameters
-    dup node-param dup uncons %alien-invoke ,
-    cdr library-abi "stdcall" =
-    [ dup parameters stack-space %cleanup , ] unless
-    dup linearize-return linearize-next ;
+    dup node-param uncons %alien-invoke ,
+    dup linearize-cleanup
+    dup linearize-return
+    linearize-next ;
 
 : parse-arglist ( lst -- types stack effect )
     unpair [
index ebee97ede1fb4289e79470b76f26320f89f4248c..60c19fdc1c1aec9f4d519ef147dcfbd5e9cb2873 100644 (file)
@@ -24,7 +24,8 @@ M: float-regs store-insn
 M: float-regs load-insn
     [ fastcall-regs nth swap stack@ ] keep MOVSS/LPD ;
 
-M: stack-params load-insn 3drop ;
+M: stack-params load-insn
+    drop >r R11 swap stack@ MOV r> stack@ R11 MOV ;
 
 M: %unbox generate-node ( vop -- )
     drop
index 76979c3c9077f1e0051a1e09eeacdf22b0b8f95c..eefa8e5c0f7ae6b15b5bb265453d08469874fd65 100644 (file)
@@ -1,7 +1,7 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
 USING: alien arrays errors hashtables io kernel
-kernel-internals lists math namespaces opengl prettyprint
+kernel-internals math namespaces opengl prettyprint
 sequences styles ;
 IN: freetype
 
@@ -54,19 +54,19 @@ M: font = eq? ;
     init-freetype [ close-freetype ] cleanup ; inline
 
 : ttf-name ( font style -- name )
-    cons H{
-        { [[ "monospace" plain        ]] "VeraMono" }
-        { [[ "monospace" bold         ]] "VeraMoBd" }
-        { [[ "monospace" bold-italic  ]] "VeraMoBI" }
-        { [[ "monospace" italic       ]] "VeraMoIt" }
-        { [[ "sans-serif" plain       ]] "Vera"     }
-        { [[ "sans-serif" bold        ]] "VeraBd"   }
-        { [[ "sans-serif" bold-italic ]] "VeraBI"   }
-        { [[ "sans-serif" italic      ]] "VeraIt"   }
-        { [[ "serif" plain            ]] "VeraSe"   }
-        { [[ "serif" bold             ]] "VeraSeBd" }
-        { [[ "serif" bold-italic      ]] "VeraBI"   }
-        { [[ "serif" italic           ]] "VeraIt"   }
+    2array H{
+        { { "monospace" plain        } "VeraMono" }
+        { { "monospace" bold         } "VeraMoBd" }
+        { { "monospace" bold-italic  } "VeraMoBI" }
+        { { "monospace" italic       } "VeraMoIt" }
+        { { "sans-serif" plain       } "Vera"     }
+        { { "sans-serif" bold        } "VeraBd"   }
+        { { "sans-serif" bold-italic } "VeraBI"   }
+        { { "sans-serif" italic      } "VeraIt"   }
+        { { "serif" plain            } "VeraSe"   }
+        { { "serif" bold             } "VeraSeBd" }
+        { { "serif" bold-italic      } "VeraBI"   }
+        { { "serif" italic           } "VeraIt"   }
     } hash ;
 
 : ttf-path ( name -- string )
@@ -159,8 +159,8 @@ C: font ( handle -- font )
     font-ascent swap glyph-hori-bearing-y - ft-floor 0 3array ;
 
 : glyph-texture-size ( glyph -- dim )
-    dup glyph-bitmap-width next-power-of-2
-    swap glyph-bitmap-rows next-power-of-2 0 3array ;
+    dup glyph-bitmap-width 
+    swap glyph-bitmap-rows 0 3array ;
 
 : <char-sprite> ( font char -- sprite )
     #! Create a new display list of a rendered glyph. This
index 5941246934e06aea0469a98c03a0bd04722e13bf..f5d56440c76ff503ee5b2b25987c0b412d29b993 100644 (file)
@@ -19,8 +19,6 @@ GENERIC: ^ ( z w -- z^w ) foldable
 : ^theta ( w abs arg -- theta )
     >r >r >rect r> flog * swap r> * + ; inline
 
-: 0^0 "0^0 is not defined" throw ;
-
 : 0^ ( z w -- )
     dup zero? [
         2drop 0.0/0.0
index c7848b76125ac9dcf409fe0811e9777e32e06407..1321e303f698c3c78b764c341b04fea825fe854f 100644 (file)
@@ -1,5 +1,5 @@
-! Copyright (C) 2005 Slava Pestov.
-! See http://factor.sf.net/license.txt for BSD license.
+! Copyright (C) 2005, 2006 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
 IN: opengl
 USING: alien errors kernel math namespaces opengl sdl sequences ;
 
@@ -51,13 +51,13 @@ USING: alien errors kernel math namespaces opengl sdl sequences ;
     swap [ glMatrixMode glPushMatrix call ] keep
     glMatrixMode glPopMatrix ; inline
 
-: gl-vertex first3 glVertex3d ; inline
+: top-left drop 0 0 glTexCoord2d 0 0 0 glVertex3d ; inline
 
-: top-left drop 0 0 glTexCoord2d { 0 0 0 } gl-vertex ; inline
+: top-right 1 0 glTexCoord2d first 0 0 glVertex3d ; inline
 
-: top-right 1 0 glTexCoord2d { 1 0 0 } v* gl-vertex ; inline
+: bottom-left 0 1 glTexCoord2d second 0 swap 0 glVertex3d ; inline
 
-: bottom-left 0 1 glTexCoord2d { 0 1 0 } v* gl-vertex ; inline
+: gl-vertex first3 glVertex3d ; inline
 
 : bottom-right 1 1 glTexCoord2d gl-vertex ; inline
 
index ba650dd078ed5b668036ef2f23f0893959f9ec21..f19cfcbdfadfb5ed285856e3659aa51ad572aea6 100644 (file)
@@ -27,3 +27,9 @@ FUNCTION: double ffi_test_7 double x double y ; compiled
 FUNCTION: double ffi_test_8 double x float y double z float t int w ; compiled
 [ 19.0 ] [ 3.0 2.0 1.0 6.0 7 ffi_test_8 ] unit-test
 
+FUNCTION: int ffi_test_9 int a int b int c int d int e int f int g ; compiled
+[ 28 ] [ 1 2 3 4 5 6 7 ffi_test_9 ] unit-test
+
+FUNCTION: int ffi_test_10 int a int b double c int d float e int f int g int h ; compiled
+[ -34 ] [ 1 2 3 4 5 6 7 8 ffi_test_10 ] unit-test
+
index 0bb99474a962c9c1f7c1d014fa6bcb8033f7b1f6..b8aa39ae996f8f039105586e8b797bb1c1728c5e 100644 (file)
@@ -67,7 +67,7 @@ USING: kernel math namespaces prettyprint test ;
 [ 134217728 dup + dup + dup + dup + dup + dup + unparse ]
 unit-test
 
-[ 0 0 ^ ] unit-test-fails
+[ 0.0/0.0 ] [ 0 0 ^ ] unit-test
 [ 1 ] [ 10 0 ^ ] unit-test
 [ 1/8 ] [ 1/2 3 ^ ] unit-test
 [ 1/8 ] [ 2 -3 ^ ] unit-test
index 4665e80dd119334b3cd32c4aca65980f8970ebc9..12f651ed978cf057b8536edb220e88af42c14017 100644 (file)
@@ -109,4 +109,5 @@ SYMBOL: failures
         "compiler/generic" "compiler/bail-out"
         "compiler/linearizer" "compiler/intrinsics"
         "compiler/identities" "compiler/optimizer"
+        "compiler/alien"
     } run-tests ;
index 3ff87c634cfaf1f48d0691faa6082c1ec2bee8e7..79510a4b16291347d08b91ca15f761055f3b11f6 100644 (file)
@@ -54,3 +54,15 @@ double ffi_test_8(double x, float y, double z, float t, int w)
        printf("ffi_test_8(%f,%f,%f,%f,%d)\n",x,y,z,t,w);
        return x * y + z * t + w;
 }
+
+int ffi_test_9(int a, int b, int c, int d, int e, int f, int g)
+{
+       printf("ffi_test_9(%d,%d,%d,%d,%d,%d,%d)\n",a,b,c,d,e,f,g);
+       return a + b + c + d + e + f + g;
+}
+
+int ffi_test_10(int a, int b, double c, int d, float e, int f, int g, int h)
+{
+       printf("ffi_test_10(%d,%d,%f,%d,%f,%d,%d,%d)\n",a,b,c,d,e,f,g,h);
+       return a - b - c - d - e - f - g - h;
+}