]> gitweb.factorcode.org Git - factor.git/commitdiff
Remove compiled slot from quotations since its not needed
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 12 May 2009 08:09:15 +0000 (03:09 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 12 May 2009 08:09:15 +0000 (03:09 -0500)
13 files changed:
basis/bootstrap/image/image.factor
basis/compiler/constants/constants.factor
core/bootstrap/primitives.factor
vm/code_block.cpp
vm/code_heap.cpp
vm/cpu-ppc.S
vm/cpu-x86.32.S
vm/cpu-x86.64.S
vm/image.cpp
vm/layouts.hpp
vm/primitives.cpp
vm/quotations.cpp
vm/quotations.hpp

index 92d75604e08c0845afab6ccac8813f0a71124547..4a7a558703d57d4aa3fb53f1bd1937622cd980a2 100644 (file)
@@ -448,7 +448,6 @@ M: quotation '
         array>> '
         quotation [
             emit ! array
-            f ' emit ! compiled
             f ' emit ! cached-effect
             f ' emit ! cache-counter
             0 emit ! xt
index 6b383388ef6574c5d6d060400b47f2242273518f..b795862970e7cee5b7e779f1cdc8203748a5b169 100644 (file)
@@ -20,7 +20,7 @@ CONSTANT: deck-bits 18
 : underlying-alien-offset ( -- n ) bootstrap-cell alien tag-number - ; inline
 : tuple-class-offset ( -- n ) bootstrap-cell tuple tag-number - ; inline
 : word-xt-offset ( -- n ) 10 bootstrap-cells \ word tag-number - ; inline
-: quot-xt-offset ( -- n ) 5 bootstrap-cells quotation tag-number - ; inline
+: quot-xt-offset ( -- n ) 4 bootstrap-cells quotation tag-number - ; inline
 : word-code-offset ( -- n ) 11 bootstrap-cells \ word tag-number - ; inline
 : array-start-offset ( -- n ) 2 bootstrap-cells array tag-number - ; inline
 : compiled-header-size ( -- n ) 4 bootstrap-cells ; inline
index 57bc61a0058c4ce1988c308625b0fe9d16fdde14..d94cd45c3d0ae1185575ed7e9cc9abd507c7b7e7 100644 (file)
@@ -211,7 +211,6 @@ bi
 
 "quotation" "quotations" create {
     { "array" { "array" "arrays" } read-only }
-    { "compiled" read-only }
     "cached-effect"
     "cache-counter"
 } define-builtin
@@ -514,6 +513,7 @@ tuple
     { "reset-inline-cache-stats" "generic.single" (( -- )) }
     { "inline-cache-stats" "generic.single" (( -- stats )) }
     { "optimized?" "words" (( word -- ? )) }
+    { "quot-compiled?" "quotations" (( quot -- ? )) }
 } [ [ first3 ] dip swap make-primitive ] each-index
 
 ! Bump build number
index c34f6517503d42b0032f920811e312d7545ca389..2ce69ebfdeff6db6421318e616290c060fe8ace7 100755 (executable)
@@ -68,10 +68,10 @@ static void *xt_pic(word *w, cell tagged_quot)
        else
        {
                quotation *quot = untag<quotation>(tagged_quot);
-               if(quot->compiledp == F)
-                       return w->xt;
-               else
+               if(quot->code)
                        return quot->xt;
+               else
+                       return w->xt;
        }
 }
 
@@ -409,7 +409,7 @@ void mark_object_code_block(object *object)
        case QUOTATION_TYPE:
                {
                        quotation *q = (quotation *)object;
-                       if(q->compiledp != F)
+                       if(q->code)
                                mark_code_block(q->code);
                        break;
                }
index c8c7639930a57a0cd9ae200ae4b0108fc9be68e2..2260d133fc49c03c00576ee6f7eef8aed3a6c3cd 100755 (executable)
@@ -158,7 +158,7 @@ void forward_object_xts()
                        {
                                quotation *quot = untag<quotation>(obj);
 
-                               if(quot->compiledp != F)
+                               if(quot->code)
                                        quot->code = forward_xt(quot->code);
                        }
                        break;
@@ -194,7 +194,7 @@ void fixup_object_xts()
                case QUOTATION_TYPE:
                        {
                                quotation *quot = untag<quotation>(obj);
-                               if(quot->compiledp != F)
+                               if(quot->code)
                                        set_quot_xt(quot,quot->code);
                                break;
                        }
index a372b2b1f5d786e68fd14a513afd2ae80f503b76..964882c8ae1addfe36c06fd7359e9ee83518f1b4 100755 (executable)
@@ -45,7 +45,7 @@ multiply_overflow:
        
 /* Note that the XT is passed to the quotation in r11 */
 #define CALL_OR_JUMP_QUOT \
-       lwz r11,16(r3)     /* load quotation-xt slot */ XX \
+       lwz r11,12(r3)     /* load quotation-xt slot */ XX \
 
 #define CALL_QUOT \
        CALL_OR_JUMP_QUOT XX \
index ff45f480660d4bca162466c7cea71c35579db604..afda9d31cd959a0e0deffe7228483c12ba579631 100755 (executable)
@@ -25,7 +25,7 @@
        pop %ebp ; \
        pop %ebx
 
-#define QUOT_XT_OFFSET 16
+#define QUOT_XT_OFFSET 12
 
 /* We pass a function pointer to memcpy to work around a Mac OS X
 ABI limitation which would otherwise require us to do a bizzaro PC-relative
index 6b2faa1c0bbad6318ec73d23c47670bce1276a0e..8cf7423239db62add1d8b3268f9447d7d5f35953 100644 (file)
@@ -61,7 +61,7 @@
 
 #endif
 
-#define QUOT_XT_OFFSET 36
+#define QUOT_XT_OFFSET 28
 
 /* We pass a function pointer to memcpy to work around a Mac OS X
 ABI limitation which would otherwise require us to do a bizzaro PC-relative
index 9205aad260d3e64dce50e55ab6f096e5833ddc93..f8aa07ded9e6e6c87c70b16bf72aa3c0a629f5b0 100755 (executable)
@@ -187,13 +187,13 @@ static void fixup_word(word *word)
 
 static void fixup_quotation(quotation *quot)
 {
-       if(quot->compiledp == F)
-               quot->xt = (void *)lazy_jit_compile;
-       else
+       if(quot->code)
        {
                code_fixup(&quot->xt);
                code_fixup(&quot->code);
        }
+       else
+               quot->xt = (void *)lazy_jit_compile;
 }
 
 static void fixup_alien(alien *d)
index 40fd699e18d024eb2a123a796ea10cfa3691b521..f8672e452287c96ced4dea1c1a075ee0797030ba 100755 (executable)
@@ -269,8 +269,6 @@ struct quotation : public object {
        /* tagged */
        cell array;
        /* tagged */
-       cell compiledp;
-       /* tagged */
        cell cached_effect;
        /* tagged */
        cell cache_counter;
index bd761625d894586376a0dd2bfde9c4c4a0cca804..2359173d9b4966937685f116ce0631d69c44b90c 100755 (executable)
@@ -155,6 +155,7 @@ const primitive_type primitives[] = {
        primitive_reset_inline_cache_stats,
        primitive_inline_cache_stats,
        primitive_optimized_p,
+       primitive_quot_compiled_p,
 };
 
 }
index b049f528e4fb72537ede9b1bf91145e7ec8d809e..e96af39766bcfa25a87f9f1bf01664b260871ab2 100755 (executable)
@@ -272,14 +272,13 @@ void set_quot_xt(quotation *quot, code_block *code)
 
        quot->code = code;
        quot->xt = code->xt();
-       quot->compiledp = T;
 }
 
 /* Allocates memory */
 void jit_compile(cell quot_, bool relocating)
 {
        gc_root<quotation> quot(quot_);
-       if(quot->compiledp != F) return;
+       if(quot->code) return;
 
        quotation_jit compiler(quot.value(),true,relocating);
        compiler.iterate_quotation();
@@ -300,10 +299,10 @@ PRIMITIVE(array_to_quotation)
 {
        quotation *quot = allot<quotation>(sizeof(quotation));
        quot->array = dpeek();
-       quot->xt = (void *)lazy_jit_compile;
-       quot->compiledp = F;
        quot->cached_effect = F;
        quot->cache_counter = F;
+       quot->xt = (void *)lazy_jit_compile;
+       quot->code = NULL;
        drepl(tag<quotation>(quot));
 }
 
@@ -354,4 +353,11 @@ VM_ASM_API cell lazy_jit_compile_impl(cell quot_, stack_frame *stack)
        return quot.value();
 }
 
+PRIMITIVE(quot_compiled_p)
+{
+       tagged<quotation> quot(dpop());
+       quot.untag_check();
+       dpush(tag_boolean(quot->code != NULL));
+}
+
 }
index 719a94176ebf79b917ae4f1819394fc1ec5186ea..c1a2a92bd19b3454a3e9c9216aee80e3ccbe895e 100755 (executable)
@@ -35,4 +35,6 @@ PRIMITIVE(quotation_xt);
 
 VM_ASM_API cell lazy_jit_compile_impl(cell quot, stack_frame *stack);
 
+PRIMITIVE(quot_compiled_p);
+
 }