From 53690f2500f11fe1064972b1a5d5eb1955544590 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 7 Nov 2007 19:26:26 -0500 Subject: [PATCH 1/2] Give credit where credit is due --- vm/os-linux-arm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/vm/os-linux-arm.c b/vm/os-linux-arm.c index 217fb58fa7..39a3da0b3f 100644 --- a/vm/os-linux-arm.c +++ b/vm/os-linux-arm.c @@ -8,6 +8,9 @@ void flush_icache(CELL start, CELL len) identically to the below assembly. */ /* result = syscall(__ARM_NR_cacheflush,start,start + len,0); */ + /* Assembly swiped from + http://lists.arm.linux.org.uk/pipermail/linux-arm/2002-July/003931.html + */ __asm__ __volatile__ ( "mov r0, %1\n" "sub r1, %2, #1\n" From 6dcdf6b59b6bc94073bdcefedd4fa687da4c12a3 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 7 Nov 2007 19:26:39 -0500 Subject: [PATCH 2/2] Fix printing of displaced aliens over byte arrays --- core/alien/alien-tests.factor | 4 ++++ core/alien/alien.factor | 2 +- core/alien/c-types/c-types-tests.factor | 4 ++++ core/alien/syntax/syntax.factor | 12 ++++++------ 4 files changed, 15 insertions(+), 7 deletions(-) diff --git a/core/alien/alien-tests.factor b/core/alien/alien-tests.factor index ca475bf80a..aedad25906 100644 --- a/core/alien/alien-tests.factor +++ b/core/alien/alien-tests.factor @@ -64,3 +64,7 @@ cell 8 = [ [ 0 B{ 1 2 3 } alien-address ] unit-test-fails [ 1 1 ] unit-test-fails + +[ f ] [ 0 B{ 1 2 3 } pinned-c-ptr? ] unit-test + +[ "( displaced alien )" ] [ 0 B{ 1 2 3 } unparse ] unit-test diff --git a/core/alien/alien.factor b/core/alien/alien.factor index 564efd72df..32157dcb90 100644 --- a/core/alien/alien.factor +++ b/core/alien/alien.factor @@ -18,7 +18,7 @@ PREDICATE: alien pinned-alien underlying-alien pinned-c-ptr? ; UNION: pinned-c-ptr - alien POSTPONE: f ; + pinned-alien POSTPONE: f ; UNION: c-ptr alien bit-array byte-array float-array POSTPONE: f ; diff --git a/core/alien/c-types/c-types-tests.factor b/core/alien/c-types/c-types-tests.factor index ee2d8b309b..c988446e20 100644 --- a/core/alien/c-types/c-types-tests.factor +++ b/core/alien/c-types/c-types-tests.factor @@ -68,3 +68,7 @@ TYPEDEF: int* MyIntArray TYPEDEF: uchar* MyLPBYTE [ t ] [ "char*" c-type "MyLPBYTE" c-type eq? ] unit-test + +[ + 0 B{ 1 2 3 4 } +] unit-test-fails diff --git a/core/alien/syntax/syntax.factor b/core/alien/syntax/syntax.factor index d204390d00..ed1520e9a1 100644 --- a/core/alien/syntax/syntax.factor +++ b/core/alien/syntax/syntax.factor @@ -3,7 +3,7 @@ USING: arrays alien alien.c-types alien.structs kernel math namespaces parser sequences words quotations math.parser splitting effects prettyprint prettyprint.sections -prettyprint.backend assocs ; +prettyprint.backend assocs combinators ; IN: alien.syntax parsing M: alien pprint* - dup expired? [ - drop "( alien expired )" text - ] [ - \ ALIEN: [ alien-address pprint* ] pprint-prefix - ] if ; + { + { [ dup expired? ] [ drop "( alien expired )" text ] } + { [ dup pinned-c-ptr? not ] [ drop "( displaced alien )" text ] } + { [ t ] [ \ ALIEN: [ alien-address pprint* ] pprint-prefix ] } + } cond ; M: dll pprint* dll-path dup "DLL\" " pprint-string ;