]> gitweb.factorcode.org Git - factor.git/commitdiff
Bum 3 instructions out of megamorphic fast path by switching to fixed-size caches
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 30 Apr 2009 09:14:14 +0000 (04:14 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Thu, 30 Apr 2009 09:14:14 +0000 (04:14 -0500)
basis/cpu/x86/bootstrap.factor
core/bootstrap/layouts/layouts.factor
core/generic/standard/standard.factor
core/layouts/layouts.factor

index 7efb4197c275c152c6e95333d8755ecc9fd7ffda..4f9a94a58b36b1d322bcf8596e5ee2be538724de 100644 (file)
@@ -243,12 +243,8 @@ big-endian off
     temp0 0 MOV rc-absolute-cell rt-immediate jit-rel
     ! key = class
     temp2 temp1 MOV
-    ! compute cache.length - 1
-    temp3 temp0 1 bootstrap-cells array tag-number - [+] MOV
-    temp3 1 SHR
-    temp3 4 SUB
     ! key &= cache.length - 1
-    temp2 temp3 AND
+    temp2 mega-cache-size get 1- bootstrap-cell * AND
     ! cache += array-start-offset
     temp0 array-start-offset ADD
     ! cache += key
index 0243ad040eb0b4228643c6e92ed0e01f0342156d..5ed92b7776984daad06677ee4f5a9e2e5724619a 100644 (file)
@@ -11,6 +11,8 @@ BIN: 111 tag-mask set
 
 15 num-types set
 
+32 mega-cache-size set
+
 H{
     { fixnum      BIN: 000 }
     { bignum      BIN: 001 }
index 5d26cfa6ff4690c43da20aa18e82c91e3594b7a1..96c273e3f8af073c764ea67fb65bf2d93e0f56ef 100644 (file)
@@ -3,7 +3,7 @@
 USING: accessors definitions generic generic.single kernel
 namespaces words math math.order combinators sequences
 generic.single.private quotations kernel.private
-assocs arrays ;
+assocs arrays layouts ;
 IN: generic.standard
 
 TUPLE: standard-combination < single-combination # ;
@@ -47,8 +47,7 @@ M: standard-combination inline-cache-quot ( word methods -- )
     combination get #>> [ f inline-cache-miss ] 3curry [ ] like ;
 
 : make-empty-cache ( -- array )
-    generic-word get "methods" word-prop
-    assoc-size 2 * next-power-of-2 f <array> ;
+    mega-cache-size get f <array> ;
 
 M: standard-combination mega-cache-quot
     combination get #>> make-empty-cache [ mega-cache-lookup ] 3curry [ ] like ;
index e30245abd16232033bd9131ab60e0eeb4658f3c6..00b9500211818f40b7637b11581fefdec2982706 100644 (file)
@@ -16,6 +16,8 @@ SYMBOL: tag-numbers
 
 SYMBOL: type-numbers
 
+SYMBOL: mega-cache-size
+
 : type-number ( class -- n )
     type-numbers get at ;