]> gitweb.factorcode.org Git - factor.git/commitdiff
compiler.codegen: need to do name decoration with fastcall as well
authorSlava Pestov <slava@factorcode.org>
Mon, 12 Apr 2010 23:10:25 +0000 (18:10 -0500)
committerSlava Pestov <slava@factorcode.org>
Mon, 12 Apr 2010 23:10:25 +0000 (18:10 -0500)
basis/compiler/codegen/codegen.factor
basis/cpu/x86/32/32.factor
core/alien/alien.factor [changed mode: 0644->0755]

index ffccf9f11828d69c46099580a9b67464020c2c09..b16f471d11ab0c0378d6d47322246907f4024361 100755 (executable)
@@ -18,6 +18,7 @@ compiler.cfg.builder
 compiler.codegen.fixup
 compiler.utilities ;
 FROM: namespaces => set ;
+FROM: compiler.errors => no-such-symbol ;
 IN: compiler.codegen
 
 SYMBOL: insn-counts
@@ -415,13 +416,18 @@ M: array dlsym-valid? '[ _ dlsym ] any? ;
         dll-path compiling-word get no-such-library drop
     ] if ;
 
-: stdcall-mangle ( params -- symbols )
+: decorated-symbol ( params -- symbols )
     [ function>> ] [ parameters>> parameter-offsets drop number>string ] bi
-    [ drop ] [ "@" glue ] [ "@" glue "_" prepend ] 2tri
-    3array ;
+    {
+        [ drop ]
+        [ "@" glue ]
+        [ "@" glue "_" prepend ]
+        [ "@" glue "@" prepend ]
+    } 2cleave
+    4array ;
 
 : alien-invoke-dlsym ( params -- symbols dll )
-    [ dup abi>> stdcall = [ stdcall-mangle ] [ function>> ] if ]
+    [ dup abi>> callee-cleanup? [ decorated-symbol ] [ function>> ] if ]
     [ library>> load-library ]
     bi 2dup check-dlsym ;
 
index 40c6bd40dbb379676ab39989170b09b212d379ba..05c627fb99df51d3af859ec3e072f28166a47d0d 100755 (executable)
@@ -315,9 +315,6 @@ M:: x86.32 %binary-float-function ( dst src1 src2 func -- )
     [ abi>> mingw = os windows? not or ]
     bi and ;
 
-: callee-cleanup? ( abi -- ? )
-    { stdcall fastcall thiscall } member? ;
-
 : stack-arg-size ( params -- n )
     dup abi>> '[
         alien-parameters flatten-value-types
old mode 100644 (file)
new mode 100755 (executable)
index 27e326a..d67e0a1
@@ -68,6 +68,9 @@ SINGLETONS: stdcall thiscall fastcall cdecl mingw ;
 
 UNION: abi stdcall thiscall fastcall cdecl mingw ;
 
+: callee-cleanup? ( abi -- ? )
+    { stdcall fastcall thiscall } member? ;
+
 ERROR: alien-callback-error ;
 
 : alien-callback ( return parameters abi quot -- alien )