]> gitweb.factorcode.org Git - factor.git/commitdiff
Add a with-javascriptcore combinator to set the callstack bounds before calling javas...
authorDoug Coleman <doug.coleman@gmail.com>
Tue, 20 Apr 2010 01:07:39 +0000 (20:07 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Tue, 20 Apr 2010 01:07:39 +0000 (20:07 -0500)
extra/javascriptcore/authors.txt [new file with mode: 0644]
extra/javascriptcore/ffi/hack/authors.txt [new file with mode: 0644]
extra/javascriptcore/ffi/hack/hack.factor [new file with mode: 0644]
extra/javascriptcore/javascriptcore.factor [new file with mode: 0644]

diff --git a/extra/javascriptcore/authors.txt b/extra/javascriptcore/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/javascriptcore/ffi/hack/authors.txt b/extra/javascriptcore/ffi/hack/authors.txt
new file mode 100644 (file)
index 0000000..7c1b2f2
--- /dev/null
@@ -0,0 +1 @@
+Doug Coleman
diff --git a/extra/javascriptcore/ffi/hack/hack.factor b/extra/javascriptcore/ffi/hack/hack.factor
new file mode 100644 (file)
index 0000000..1866a24
--- /dev/null
@@ -0,0 +1,29 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: alien alien.accessors alien.syntax kernel kernel.private
+math system ;
+IN: javascriptcore.ffi.hack
+
+HOOK: set-callstack-bounds os ( -- )
+
+HOOK: macosx-callstack-start-offset cpu ( -- address )
+HOOK: macosx-callstack-size-offset cpu ( -- address )
+
+M: ppc macosx-callstack-start-offset HEX: 188 ;
+M: ppc macosx-callstack-size-offset HEX: 18c ;
+
+M: x86.32 macosx-callstack-start-offset HEX: c48 ;
+M: x86.32 macosx-callstack-size-offset HEX: c4c ;
+
+M: x86.64 macosx-callstack-start-offset HEX: 1860 ;
+M: x86.64 macosx-callstack-size-offset HEX: 1868 ;
+
+M: object set-callstack-bounds ;
+
+FUNCTION: void* pthread_self ( ) ;
+
+M: macosx set-callstack-bounds
+    callstack-bounds over [ alien-address ] bi@ -
+    pthread_self
+    [ macosx-callstack-size-offset set-alien-unsigned-cell ]
+    [ macosx-callstack-start-offset set-alien-cell ] bi ;
diff --git a/extra/javascriptcore/javascriptcore.factor b/extra/javascriptcore/javascriptcore.factor
new file mode 100644 (file)
index 0000000..773a559
--- /dev/null
@@ -0,0 +1,8 @@
+! Copyright (C) 2010 Doug Coleman.
+! See http://factorcode.org/license.txt for BSD license.
+USING: javascriptcore.ffi.hack kernel ;
+IN: javascriptcore
+
+: with-javascriptcore ( quot -- )
+    set-callstack-bounds
+    call ; inline