From 79a3f6b0d5fb09ed019a8fd9e6b1b01c3f8c388b Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Mon, 17 Aug 2009 23:59:24 -0500 Subject: [PATCH] compiler: inline singleton predicates, and optimize predicate engines, reduces terrain demo deployed size by ~20kb --- basis/compiler/compiler.factor | 2 +- basis/compiler/tree/finalization/finalization.factor | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 basis/compiler/compiler.factor mode change 100644 => 100755 basis/compiler/tree/finalization/finalization.factor diff --git a/basis/compiler/compiler.factor b/basis/compiler/compiler.factor old mode 100644 new mode 100755 index 3b8d996f34..504acc74b0 --- a/basis/compiler/compiler.factor +++ b/basis/compiler/compiler.factor @@ -120,7 +120,7 @@ M: predicate-engine-word no-compile? "owner-generic" word-prop no-compile? ; } cond ; : optimize? ( word -- ? ) - { [ predicate-engine-word? ] [ single-generic? ] } 1|| not ; + single-generic? not ; : contains-breakpoints? ( -- ? ) dependencies get keys [ "break?" word-prop ] any? ; diff --git a/basis/compiler/tree/finalization/finalization.factor b/basis/compiler/tree/finalization/finalization.factor old mode 100644 new mode 100755 index 9b278dde9b..fca35a5653 --- a/basis/compiler/tree/finalization/finalization.factor +++ b/basis/compiler/tree/finalization/finalization.factor @@ -1,8 +1,8 @@ ! Copyright (C) 2008, 2009 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel accessors sequences words memoize combinators -classes classes.builtin classes.tuple math.partial-dispatch -fry assocs combinators.short-circuit +classes classes.builtin classes.tuple classes.singleton +math.partial-dispatch fry assocs combinators.short-circuit compiler.tree compiler.tree.combinators compiler.tree.propagation.info @@ -45,6 +45,7 @@ M: predicate finalize-word "predicating" word-prop { { [ dup builtin-class? ] [ drop word>> cached-expansion ] } { [ dup tuple-class? ] [ drop word>> def>> splice-final ] } + { [ dup singleton-class? ] [ drop word>> def>> splice-final ] } [ drop ] } cond ;