]> gitweb.factorcode.org Git - factor.git/commitdiff
removed profiler because it sucks
authorSlava Pestov <slava@factorcode.org>
Wed, 15 Jun 2005 20:34:16 +0000 (20:34 +0000)
committerSlava Pestov <slava@factorcode.org>
Wed, 15 Jun 2005 20:34:16 +0000 (20:34 +0000)
19 files changed:
doc/handbook.tex
library/bootstrap/boot-stage3.factor
library/bootstrap/image.factor
library/bootstrap/primitives.factor
library/compiler/ppc/fixnum.factor
library/compiler/x86/alien.factor
library/tools/profiler.factor [deleted file]
library/unix/io.factor
library/words.factor
native/float.c
native/gc.c
native/gc.h
native/memory.c
native/memory.h
native/primitives.c
native/signal.h
native/unix/signal.c
native/word.c
native/word.h

index aaf2cfa18c7ee7ae4e97a83e69e83231652c72fa..76e6432a866c4c9a289b430abd540f6c6c450c59 100644 (file)
@@ -7,10 +7,10 @@
 \usepackage{alltt}
 \usepackage{times}
 \usepackage{tabularx}
+\usepackage{epstopdf}
 \usepackage{epsfig}
 \usepackage{epsf}
 \usepackage{amssymb}
-\usepackage{epstopdf}
 
 \pagestyle{headings}
 
index 3d29c3743d2a89ecea54c290d0f094565eae80f1..8c81ec9e8a2aa806f8c281a94c3b749f5b9501f8 100644 (file)
@@ -67,7 +67,6 @@ t [
     "/library/syntax/see.factor"
     "/library/test/test.factor"
     "/library/inference/test.factor"
-    "/library/tools/profiler.factor"
     "/library/tools/walker.factor"
     "/library/tools/annotations.factor"
     "/library/bootstrap/image.factor"
index d0cbdcda77ff85ded88c7c40119d4f762f33c065..d870e86feed5aef6c4b82416806e6cbbefcff772 100644 (file)
@@ -156,8 +156,6 @@ M: f ' ( obj -- ptr )
         dup word-primitive ,
         dup word-def ' ,
         dup word-props ' ,
-        0 ,
-        0 ,
     ] make-list
     swap object-tag here-as pool-object
     [ emit ] each ;
index 7e184780174e24f013f6669a86b8d80bcede171f..60f6ffc33b04715b33ae9f4cceca3d3476639950 100644 (file)
@@ -116,8 +116,6 @@ vocabularies get [
     [ "fsqrt" "math-internals"                [ [ real ] [ float ] ] ]
     [ "<word>" "words"                        [ [ ] [ word ] ] ]
     [ "update-xt" "words"                     [ [ word ] [ ] ] ]
-    [ "call-profiling" "profiler"             [ [ integer ] [ ] ] ]
-    [ "allot-profiling" "profiler"            [ [ integer ] [ ] ] ]
     [ "compiled?" "words"                     [ [ word ] [ boolean ] ] ]
     [ "drop" "kernel"                         [ [ object ] [ ] ] ]
     [ "dup" "kernel"                          [ [ object ] [ object object ] ] ]
index 78963aa90ff1e7e8111719c31969801b4cd78ca4..b9d3a8c85c0e5e784568abeaee95b0883e6e907b 100644 (file)
@@ -63,8 +63,8 @@ M: %fixnum/i generate-node ( vop -- )
     #! mdest is vreg where to put the modulus. Note this has
     #! precise vreg requirements.
     20 17 18 DIVW  ! divide in2 by in1, store result in out1
-    18 20 18 MULLW ! multiply out1 by in1, store result in in1
-    19 18 17 SUBF  ! subtract in2 from in1, store result in out1.
+    21 20 18 MULLW ! multiply out1 by in1, store result in in1
+    19 21 17 SUBF  ! subtract in2 from in1, store result in out1.
     ;
 
 M: %fixnum-mod generate-node ( vop -- )
index 7f4b3e920f3875e8e2fd560a13b4c1652ebb8cdb..a551a8abd86cf7ce87f76a4cd00224c98ecdc06f 100644 (file)
@@ -22,7 +22,7 @@ GENERIC: push-reg ( reg-class -- )
 M: int-regs reg-size drop cell ;
 M: int-regs push-reg drop EAX PUSH ;
 
-M: float-regs reg-size float-reg-size ;
+M: float-regs reg-size float-regs-size ;
 M: float-regs push-reg
     ESP swap reg-size [ SUB  [ ESP ] ] keep
     4 = [ FSTPS ] [ FSTPL ] ifte ;
diff --git a/library/tools/profiler.factor b/library/tools/profiler.factor
deleted file mode 100644 (file)
index d4cf4c0..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-! :folding=indent:collapseFolds=1:
-
-! $Id$
-!
-! Copyright (C) 2004 Slava Pestov.
-! 
-! Redistribution and use in source and binary forms, with or without
-! modification, are permitted provided that the following conditions are met:
-! 
-! 1. Redistributions of source code must retain the above copyright notice,
-!    this list of conditions and the following disclaimer.
-! 
-! 2. Redistributions in binary form must reproduce the above copyright notice,
-!    this list of conditions and the following disclaimer in the documentation
-!    and/or other materials provided with the distribution.
-! 
-! THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
-! INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-! FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-! DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-! SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-! PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-! OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-! WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-! OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-! ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-IN: profiler
-USE: kernel
-USE: lists
-USE: math
-USE: namespaces
-USE: prettyprint
-USE: sequences
-USE: words
-USE: vectors
-
-! The variable "only-top" toggles between
-! culminative counts, and top of call stack counts.
-SYMBOL: only-top
-
-: reset-counts ( -- )
-    [ 0 over set-call-count 0 swap set-allot-count ] each-word ;
-
-: sort-counts ( alist -- alist )
-    [ swap cdr swap cdr > ] sort ;
-
-: call-count, ( word -- )
-    #! Add to constructing list if call count is non-zero.
-    dup call-count dup 0 = [ 2drop ] [ cons , ] ifte ;
-
-: counts. ( alist -- )
-    sort-counts [ . ] each ;
-
-: call-counts. ( -- )
-    #! Print word/call count pairs.
-    [ [ call-count, ] each-word ] make-list counts. ;
-
-: profile-depth ( -- n )
-    only-top get [ -1 ] [ callstack length ] ifte ;
-
-: (call-profile) ( quot -- )
-    reset-counts
-    profile-depth call-profiling
-    call
-    f call-profiling ;
-
-: call-profile ( quot -- )
-    #! Execute a quotation with the CPU profiler enabled.
-    (call-profile) call-counts. ;
-
-: allot-count, ( word -- )
-    #! Add to constructing list if allot count is non-zero.
-    dup allot-count dup 0 = [ 2drop ] [ cons , ] ifte ;
-
-: allot-counts. ( -- alist )
-    #! Print word/allot count pairs.
-    [ [ allot-count, ] each-word ] make-list counts. ;
-
-: allot-profile ( quot -- )
-    #! Execute a quotation with the memory profiler enabled.
-    reset-counts
-    profile-depth allot-profiling
-    call
-    f allot-profiling
-    allot-counts. ;
index 30eec1149cba2897c26666a172cf968a8a7c94db..8d06792eef0a570aad1e2880504d1a9f05545f1a 100644 (file)
@@ -11,7 +11,7 @@ USING: namespaces ;
 
 ! This will go elsewhere soon
 : byte-bit ( n alien -- byte bit )
-    over -3 shift alien-unsigned-1 swap 7 bitand ;
+    over -5 shift alien-unsigned-4 swap 31 bitand ;
 
 : <bit-array> ( n -- array )
     cell / ceiling <byte-array> ;
@@ -24,7 +24,7 @@ USING: namespaces ;
 
 : set-bit-nth ( ? n alien -- )
     [ byte-bit set-bit ] 2keep
-    swap -3 shift set-alien-unsigned-1 ;
+    swap -5 shift set-alien-unsigned-4 ;
 
 ! Global variables
 SYMBOL: read-fdset
@@ -117,7 +117,12 @@ GENERIC: task-container ( task -- vector )
 
 : handle-fd? ( fdset task -- ? )
     dup io-task-port timeout?
-    [ 2drop t ] [ io-task-fd swap bit-nth ] ifte ;
+    [
+        2drop t
+    ] [
+        io-task-fd swap 2dup bit-nth
+        >r f -rot set-bit-nth r>
+    ] ifte ;
 
 : handle-fdset ( fdset tasks -- )
     [
index 4358219aff054254260b5bcfbbb1870a955264cc..f9dc56b1a943fb1a25efe25998348781fb38b74a 100644 (file)
@@ -31,17 +31,6 @@ GENERIC: set-word-primitive
 M: word set-word-primitive ( n w -- )
     [ 3 set-integer-slot ] keep update-xt ;
 
-! For the profiler
-GENERIC: call-count
-M: word call-count ( w -- n ) 6 integer-slot ;
-GENERIC: set-call-count
-M: word set-call-count ( n w -- ) 6 set-integer-slot ;
-
-GENERIC: allot-count
-M: word allot-count ( w -- n ) 7 integer-slot ;
-GENERIC: set-allot-count
-M: word set-allot-count ( n w -- ) 7 set-integer-slot ;
-
 : word-sort ( list -- list )
     #! Sort a list of words by name.
     [ swap word-name swap word-name string> ] sort ;
index d2064253593140077d1cb65f6092c689198e680d..432e4075bac2d3dd53dc363a5b443ce50ef434fc 100644 (file)
@@ -1,39 +1,5 @@
 #include "factor.h"
 
-float f_test(void)
-{
-       return 1.0f;
-}
-
-double d_test(void)
-{
-       return 1.0;
-}
-
-float in_f_test(float x, float y, float z)
-{
-       return (x + y) * z;
-}
-
-float in_i_test(int x, int y, int z)
-{
-       return x + y + z;
-}
-
-void in_if_test(float x, int y, float z)
-{
-       printf("%f\n",x);
-       printf("%d\n",y);
-       printf("%f\n",z);
-}
-
-void in_id_test(double x, int y, double z)
-{
-       printf("%f\n",x);
-       printf("%d\n",y);
-       printf("%f\n",z);
-}
-
 double to_float(CELL tagged)
 {
        F_RATIO* r;
index 39b2d1cca72b8b3cd62c7c7431e481f5c0356f13..d90a86dc540b527daf3f18ba5cbd469c6112747a 100644 (file)
@@ -50,7 +50,6 @@ void init_arena(CELL young_size, CELL aging_size)
        if(alloter != heap_start + total_size)
                fatal_error("Oops",alloter);
 
-       allot_profiling = false;
        heap_scan = false;
        gc_time = 0;
        minor_collections = 0;
index e57f7252677a6e654ea142cbe3138265df1fe158..a7678d6d3073f16d87a2d098463809c4eb78357c 100644 (file)
@@ -97,9 +97,6 @@ INLINE void *allot_zone(ZONE *z, CELL a)
 
 INLINE void *allot(CELL a)
 {
-       if(allot_profiling)
-               allot_profile_step(align8(a));
-       allot_barrier(nursery.here);
        return allot_zone(&nursery,a);
 }
 
index 6d1f9892a633dffe59136220c324fb4f46bb0856..5568624cf616363cb7a66959b410028780bcb183 100644 (file)
@@ -129,34 +129,6 @@ void primitive_set_integer_slot(void)
        put(SLOT(obj,slot),value);
 }
 
-void allot_profile_step(CELL a)
-{
-       CELL depth = (cs - cs_bot) / CELLS;
-       int i;
-       CELL obj;
-
-       for(i = profile_depth; i < depth; i++)
-       {
-               obj = get(cs_bot + i * CELLS);
-               if(type_of(obj) == WORD_TYPE)
-                       untag_word(obj)->allot_count += a;
-       }
-
-       untag_word_fast(executing)->allot_count += a;
-}
-
-void primitive_allot_profiling(void)
-{
-       CELL d = dpop();
-       if(d == F)
-               allot_profiling = false;
-       else
-       {
-               allot_profiling = true;
-               profile_depth = to_fixnum(d);
-       }
-}
-
 void primitive_address(void)
 {
        drepl(tag_bignum(s48_ulong_to_bignum(dpeek())));
index 2c463920c236adb7cc9b48e4c409a54bb7080784..c38534ac67745d2ca517a75598c3ff842f33af7c 100644 (file)
@@ -123,10 +123,6 @@ INLINE void type_check(CELL type, CELL tagged)
        type_error(type,tagged);
 }
 
-void allot_profile_step(CELL a);
-
-bool allot_profiling;
-
 INLINE CELL type_of(CELL tagged)
 {
        CELL tag = TAG(tagged);
@@ -138,7 +134,6 @@ INLINE CELL type_of(CELL tagged)
 
 CELL untagged_object_size(CELL pointer);
 CELL object_size(CELL pointer);
-void primitive_allot_profiling(void);
 void primitive_room(void);
 void primitive_type(void);
 void primitive_slot(void);
index 89685473e6491e2b5c7f0fb7b7c942aad94602dd..e8c1df6f154f45cf81a6f01c3e1aee929e854cd9 100644 (file)
@@ -82,8 +82,6 @@ void* primitives[] = {
         primitive_fsqrt,
        primitive_word,
        primitive_update_xt,
-       primitive_call_profiling,
-       primitive_allot_profiling,
        primitive_word_compiledp,
        primitive_drop,
        primitive_dup,
index 9cbf178d3571985a38776dfc6214b72881b88c12..605b6a63f574c742078f676de3ae6e5cab64e919 100644 (file)
@@ -1,8 +1,5 @@
 #ifndef WIN32
 void signal_handler(int signal, siginfo_t* siginfo, void* uap);
 void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap);
-void call_profiling_step(int signal, siginfo_t* siginfo, void* uap);
 void init_signals(void);
 #endif
-
-void primitive_call_profiling(F_WORD *);
index 0b8fde911a699d91a2b4fb4285df7d48e2389684..db7c547acf7e988ef3a1b953931d5134dc38516a 100644 (file)
@@ -16,34 +16,14 @@ void dump_stack_signal(int signal, siginfo_t* siginfo, void* uap)
        factorbug();
 }
 
-/* Called from a signal handler. XXX - is this safe? */
-void call_profiling_step(int signal, siginfo_t* siginfo, void* uap)
-{
-       CELL depth = (cs - cs_bot) / CELLS;
-       int i;
-       CELL obj;
-       for(i = profile_depth; i < depth; i++)
-       {
-               obj = get(cs_bot + i * CELLS);
-               if(type_of(obj) == WORD_TYPE)
-                       untag_word(obj)->call_count++;
-       }
-
-       untag_word_fast(executing)->call_count++;
-}
-
 void init_signals(void)
 {
        struct sigaction custom_sigaction;
-       struct sigaction profiling_sigaction;
        struct sigaction ign_sigaction;
        struct sigaction dump_sigaction;
        sigemptyset(&custom_sigaction.sa_mask);
        custom_sigaction.sa_sigaction = signal_handler;
        custom_sigaction.sa_flags = SA_SIGINFO;
-       sigemptyset(&profiling_sigaction.sa_mask);
-       profiling_sigaction.sa_sigaction = call_profiling_step;
-       profiling_sigaction.sa_flags = SA_SIGINFO;
        sigemptyset(&dump_sigaction.sa_mask);
        dump_sigaction.sa_sigaction = dump_stack_signal;
        dump_sigaction.sa_flags = SA_SIGINFO;
@@ -55,30 +35,5 @@ void init_signals(void)
        sigaction(SIGILL,&custom_sigaction,NULL);
        sigaction(SIGSEGV,&custom_sigaction,NULL);
        sigaction(SIGPIPE,&ign_sigaction,NULL);
-       sigaction(SIGPROF,&profiling_sigaction,NULL);
        sigaction(SIGQUIT,&dump_sigaction,NULL);
 }
-
-void primitive_call_profiling(F_WORD *word)
-{
-       CELL d = dpop();
-       if(d == F)
-       {
-               timerclear(&prof_timer.it_interval);
-               timerclear(&prof_timer.it_value);
-
-               profile_depth = 0;
-       }
-       else
-       {
-               prof_timer.it_interval.tv_sec = 0;
-               prof_timer.it_interval.tv_usec = 1000;
-               prof_timer.it_value.tv_sec = 0;
-               prof_timer.it_value.tv_usec = 1000;
-
-               profile_depth = to_fixnum(d);
-       }
-
-       if(setitimer(ITIMER_PROF,&prof_timer,NULL) < 0)
-               io_error();
-}
index c6dec876261bb5b85606a8e9ee625e95e11c2346..2dad8a229938688f41c5755a63a4bdcd3a236932 100644 (file)
@@ -21,8 +21,6 @@ void primitive_word(void)
        word->primitive = 0;
        word->def = F;
        word->props = F;
-       word->call_count = 0;
-       word->allot_count = 0;
        dpush(tag_object(word));
 }
 
index 7bc5129bc9b4a9a808ad979f5eeb5b48e56c135e..081f4c08c45941d5ad7b83e84ee4e637c4971a8d 100644 (file)
@@ -11,10 +11,6 @@ typedef struct {
        CELL def;
        /* TAGGED property hash for library code */
        CELL props;
-       /* UNTAGGED call count incremented by profiler */
-       CELL call_count;
-       /* UNTAGGED amount of memory allocated in word */
-       CELL allot_count;
 } F_WORD;
 
 typedef void (*XT)(F_WORD* word);