From 01e7a2a8209dbf34a0f6fc849b0d1bdeee0a7d84 Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Wed, 8 Jun 2005 08:49:05 +0000 Subject: [PATCH] further PowerPC fixes --- library/compiler/intrinsics.factor | 8 -------- library/compiler/linearizer.factor | 11 +++++++++-- library/compiler/xt.factor | 3 ++- library/generic/tuple.factor | 2 +- library/inference/dataflow.factor | 2 +- native/unix/ffi.c | 6 ++---- native/unix/file.c | 2 +- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/library/compiler/intrinsics.factor b/library/compiler/intrinsics.factor index fc993b9792..99b4cbecad 100644 --- a/library/compiler/intrinsics.factor +++ b/library/compiler/intrinsics.factor @@ -134,14 +134,6 @@ sequences words ; 1 %dec-d , ] "intrinsic" set-word-prop -GENERIC: load-value ( vreg n value -- ) - -M: computed load-value ( vreg n value -- ) - drop %peek-d , ; - -M: literal load-value ( vreg n value -- ) - nip literal-value %immediate , ; - : value/vreg-list ( in -- list ) [ 0 swap length 1 - ] keep [ >r 2dup r> 3list >r 1 - >r 1 + r> r> ] map 2nip ; diff --git a/library/compiler/linearizer.factor b/library/compiler/linearizer.factor index a4e1d9aaee..4f589dcf0a 100644 --- a/library/compiler/linearizer.factor +++ b/library/compiler/linearizer.factor @@ -42,10 +42,17 @@ M: #call-label linearize-node* ( node -- ) #! by GC, and is indexed through a table. dup fixnum? swap f eq? or ; -: push-1 ( obj -- ) - 0 swap literal-value dup +GENERIC: load-value ( vreg n value -- ) + +M: computed load-value ( vreg n value -- ) + drop %peek-d , ; + +M: literal load-value ( vreg n value -- ) + nip literal-value dup immediate? [ %immediate ] [ %indirect ] ifte , ; +: push-1 ( value -- ) >r 0 0 r> load-value ; + M: #push linearize-node* ( node -- ) node-out-d dup length dup %inc-d , 1 - swap [ push-1 0 over %replace-d , ] each drop ; diff --git a/library/compiler/xt.factor b/library/compiler/xt.factor index fa70a0fc07..b61570e5ea 100644 --- a/library/compiler/xt.factor +++ b/library/compiler/xt.factor @@ -115,7 +115,8 @@ C: absolute-16/16 ( word -- ) M: absolute-16/16 fixup ( absolute -- ) >absolute fixup-16/16 ; -: absolute-16/16 ( word -- ) deferred-xt ; +: absolute-16/16 ( word -- ) + deferred-xt 0 1 rel-address ; : compiling? ( word -- ? ) #! A word that is compiling or already compiled will not be diff --git a/library/generic/tuple.factor b/library/generic/tuple.factor index 15efffd201..f394599ab4 100644 --- a/library/generic/tuple.factor +++ b/library/generic/tuple.factor @@ -199,7 +199,7 @@ M: tuple clone ( tuple -- tuple ) M: tuple hashcode ( vec -- n ) #! If the capacity is two, then all we have is the class #! slot and delegate. - dup length 2 number= [ + dup array-capacity 2 number= [ drop 0 ] [ 2 swap array-nth hashcode diff --git a/library/inference/dataflow.factor b/library/inference/dataflow.factor index daa9281547..cf6f52a8b2 100644 --- a/library/inference/dataflow.factor +++ b/library/inference/dataflow.factor @@ -34,7 +34,7 @@ NODE: #call : #call ( word -- node ) param-node <#call> ; NODE: #call-label -: #call-label ( label -- node ) param-node <#call> ; +: #call-label ( label -- node ) param-node <#call-label> ; NODE: #push : #push ( outputs -- node ) d-tail out-d-node <#push> ; diff --git a/native/unix/ffi.c b/native/unix/ffi.c index be5fd30cd9..8c258abc97 100644 --- a/native/unix/ffi.c +++ b/native/unix/ffi.c @@ -9,9 +9,7 @@ void init_ffi(void) void ffi_dlopen(DLL *dll) { - void *dllptr; - - dllptr = dlopen(to_c_string(untag_string(dll->path)), RTLD_LAZY); + void *dllptr = dlopen(to_c_string(untag_string(dll->path)), RTLD_LAZY); if(dllptr == NULL) { @@ -37,7 +35,7 @@ void *ffi_dlsym(DLL *dll, F_STRING *symbol) void ffi_dlclose(DLL *dll) { - if(dlclose(dll->dll) == -1) + if(dlclose(dll->dll) != NULL) { general_error(ERROR_FFI,tag_object( from_c_string(dlerror()))); diff --git a/native/unix/file.c b/native/unix/file.c index da343f4df3..763ff6f460 100644 --- a/native/unix/file.c +++ b/native/unix/file.c @@ -58,7 +58,7 @@ void primitive_cwd(void) { char wd[MAXPATHLEN]; maybe_garbage_collection(); - if(getcwd(wd,MAXPATHLEN) < 0) + if(getcwd(wd,MAXPATHLEN) == NULL) io_error(); box_c_string(wd); }