From 8dbd25b6cd4f3260acfdae7f744254baa2b8ff4f Mon Sep 17 00:00:00 2001 From: Joe Groff Date: Wed, 26 Aug 2009 19:20:20 -0500 Subject: [PATCH] fix struct-array of struct class; inline memory>struct so the compiler can optimize a little better --- basis/classes/struct/struct.factor | 2 +- basis/struct-arrays/struct-arrays.factor | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/basis/classes/struct/struct.factor b/basis/classes/struct/struct.factor index 07515bc843..df379201bf 100644 --- a/basis/classes/struct/struct.factor +++ b/basis/classes/struct/struct.factor @@ -36,7 +36,7 @@ M: struct equal? : memory>struct ( ptr class -- struct ) over c-ptr? [ swap \ c-ptr bad-slot-value ] unless - tuple-layout [ 2 set-slot ] keep ; + tuple-layout [ 2 set-slot ] keep ; inline : malloc-struct ( class -- struct ) [ heap-size malloc ] keep memory>struct ; inline diff --git a/basis/struct-arrays/struct-arrays.factor b/basis/struct-arrays/struct-arrays.factor index a426f8bb66..0f03c58212 100755 --- a/basis/struct-arrays/struct-arrays.factor +++ b/basis/struct-arrays/struct-arrays.factor @@ -20,7 +20,7 @@ M: struct-array byte-length [ length>> ] [ element-size>> ] bi * ; [ element-size>> * ] [ underlying>> ] bi ; inline M: struct-array nth-unsafe - [ (nth-ptr) ] [ class>> struct-class? ] bi [ memory>struct ] when* ; inline + [ (nth-ptr) ] [ class>> dup struct-class? ] bi [ memory>struct ] [ drop ] if ; inline M: struct-array set-nth-unsafe [ (nth-ptr) swap ] [ element-size>> ] bi memcpy ;