From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from eggs.gnu.org (eggs.gnu.org [IPv6:2001:470:142:3::10]) by sourceware.org (Postfix) with ESMTPS id 56C633858C62 for ; Sun, 20 Aug 2023 08:13:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 56C633858C62 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gnu.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gnu.org Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qXdZ8-0000q1-TV; Sun, 20 Aug 2023 04:13:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=mOnyCwSSRxBVZbl3a074qhF4CP2Pg0YQ0FFV5Y0f3hI=; b=bVXP7ZTiYCKVfRApULZG anGkZLO3bIfLQmzytYvUBzzP7Pl3tj0K1Vgo8gLgUgGJB5LW1z9+v0xaT5hdroY/W5/AMzUHnUU/l DwhzbcjXXz7KDCxpNX7Gx7crcB2Hysv3ZsWIJX5oN5r+qGU1cx8KlmFJdsD1SMwiu6ruwZpUVX28w qqhaSk+z+HBXpuchQpa4PBpNjPGgWN6NWK4/2hMYD9L05Sl3diSHJx+r2sa3nJpija9GJ2NZZRsJ8 /2c+tP01GrKoXNZmlpleeiChqlksPjqSLUjctjX6yJbu77gfjQV0SlorFinMiAcn3zQ4etJd96+Fk Q/1OnSz9OGfwFA==; From: "Jose E. Marchesi" To: Tom Tromey Cc: cgen@sourceware.org Subject: Re: [RFC 02/14] Remove some 'fastcall' code In-Reply-To: <20230819174900.866436-3-tom@tromey.com> (Tom Tromey's message of "Sat, 19 Aug 2023 11:42:01 -0600") References: <20230819174900.866436-1-tom@tromey.com> <20230819174900.866436-3-tom@tromey.com> Date: Sun, 20 Aug 2023 10:13:35 +0200 Message-ID: <874jkurv0w.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > There are some comments referring to 'fastcall', which apparently is > some sort of compilation mode for the presumably obsolete Hobbit > scheme compiler. I don't think that the Hobbit support has been tested any time in recent years. If Frank agrees, I would say it is ok to remove code handling Hobbit specific stuff. > This patch removes this code and in the process removes some > unnecessary global variables, by turning them into let bindings. The change LGTM. The only comment I have is that it seems to me the / prefix for symbol names seems to be used for globals? I don't think locally let-defined symbols are to be using that prefix... > --- > sem-frags.scm | 125 ++++++++++++++++++++++---------------------------- > utils.scm | 21 --------- > 2 files changed, 54 insertions(+), 92 deletions(-) > > diff --git a/sem-frags.scm b/sem-frags.scm > index 0fb26f4..0e471a0 100644 > --- a/sem-frags.scm > +++ b/sem-frags.scm > @@ -159,12 +159,6 @@ > > ; Hash a statement. > > -; Computed hash value. > -; Global 'cus /frag-hash-compute! is defined globally so we can use > -; /fastcall (FIXME: Need /fastcall to work on non-global procs). > - > -(define /frag-hash-value-tmp 0) > - > (define (/frag-hash-string str) > (let loop ((chars (map char->integer (string->list str))) (result 0)) > (if (null? chars) > @@ -172,77 +166,66 @@ > (loop (cdr chars) (modulo (+ (* result 7) (car chars)) #xfffffff)))) > ) > > -;; MODE is the name of the mode. > - > -(define (/frag-hash-compute! rtx-obj expr parent-expr op-pos tstate appstuff) > - (let ((h 0)) > - (case (rtx-name expr) > - ((operand) > - (set! h (/frag-hash-string (symbol->string (rtx-operand-name expr))))) > - ((local) > - (set! h (/frag-hash-string (symbol->string (rtx-local-name expr))))) > - ((const) > - (set! h (rtx-const-value expr))) > - (else > - (set! h (rtx-num rtx-obj)))) > - (set! /frag-hash-value-tmp > - ; Keep number small. > - (modulo (+ (* /frag-hash-value-tmp 3) h op-pos) > - #xfffffff))) > - > - ; #f -> "continue with normal traversing" > - #f > -) > - > (define (/frag-hash-stmt stmt locals size) > - (set! /frag-hash-value-tmp 0) > - (rtx-traverse-with-locals #f #f stmt /frag-hash-compute! locals #f) > - (modulo /frag-hash-value-tmp size) > + (let ((/frag-hash-value-tmp 0)) > + (rtx-traverse-with-locals > + #f #f stmt /frag-hash-compute! > + (lambda (rtx-obj expr parent-expr op-pos tstate appstuff) > + (let ((h 0)) > + (case (rtx-name expr) > + ((operand) > + (set! h (/frag-hash-string (symbol->string (rtx-operand-name expr))))) > + ((local) > + (set! h (/frag-hash-string (symbol->string (rtx-local-name expr))))) > + ((const) > + (set! h (rtx-const-value expr))) > + (else > + (set! h (rtx-num rtx-obj)))) > + (set! /frag-hash-value-tmp > + ;; Keep number small. > + (modulo (+ (* /frag-hash-value-tmp 3) h op-pos) > + #xfffffff))) > + > + ;; #f -> "continue with normal traversing" > + #f > + ) > + locals #f) > + (modulo /frag-hash-value-tmp size)) > ) > > ; Compute the speed/size costs of a statement. > > -; Compute speed/size costs. > -; Global 'cus /frag-cost-compute! is defined globally so we can use > -; /fastcall (FIXME: Need /fastcall to work on non-global procs). > - > -(define /frag-speed-cost-tmp 0) > -(define /frag-size-cost-tmp 0) > - > -;; MODE is the name of the mode. > - > -(define (/frag-cost-compute! rtx-obj expr parent-expr op-pos tstate appstuff) > - ; FIXME: wip > - (let ((speed 0) > - (size 0)) > - (case (rtx-class rtx-obj) > - ((ARG) > - #f) ; these don't contribute to costs (at least for now) > - ((SET) > - ; FIXME: speed/size = 0? > - (set! speed 1) > - (set! size 1)) > - ((UNARY BINARY TRINARY COMPARE) > - (set! speed 1) > - (set! size 1)) > - ((IF) > - (set! speed 2) > - (set! size 2)) > - (else > - (set! speed 4) > - (set! size 4))) > - (set! /frag-speed-cost-tmp (+ /frag-speed-cost-tmp speed)) > - (set! /frag-size-cost-tmp (+ /frag-size-cost-tmp size))) > - > - ; #f -> "continue with normal traversing" > - #f > -) > - > (define (/frag-stmt-cost stmt locals) > - (set! /frag-speed-cost-tmp 0) > - (set! /frag-size-cost-tmp 0) > - (rtx-traverse-with-locals #f #f stmt /frag-cost-compute! locals #f) > - (cons /frag-speed-cost-tmp /frag-size-cost-tmp) > + (let ((/frag-speed-cost-tmp 0) > + (/frag-size-cost-tmp 0)) > + (rtx-traverse-with-locals > + #f #f stmt > + (lambda (rtx-obj expr parent-expr op-pos tstate appstuff) > + ;; FIXME: wip > + (let ((speed 0) > + (size 0)) > + (case (rtx-class rtx-obj) > + ((ARG) > + #f) ; these don't contribute to costs (at least for now) > + ((SET) > + ;; FIXME: speed/size = 0? > + (set! speed 1) > + (set! size 1)) > + ((UNARY BINARY TRINARY COMPARE) > + (set! speed 1) > + (set! size 1)) > + ((IF) > + (set! speed 2) > + (set! size 2)) > + (else > + (set! speed 4) > + (set! size 4))) > + (set! /frag-speed-cost-tmp (+ /frag-speed-cost-tmp speed)) > + (set! /frag-size-cost-tmp (+ /frag-size-cost-tmp size))) > + ;; #f -> "continue with normal traversing" > + #f) > + locals #f) > + (cons /frag-speed-cost-tmp /frag-size-cost-tmp)) > ) > > ; Add STMT to statement table DATA. > diff --git a/utils.scm b/utils.scm > index 8204838..330880b 100644 > --- a/utils.scm > +++ b/utils.scm > @@ -13,27 +13,6 @@ > > (define nil '()) > > -; Hobbit support code; for when not using hobbit. > -; FIXME: eliminate this stuff ASAP. > - > -(defmacro /fastcall-make (proc) proc) > - > -(defmacro fastcall4 (proc arg1 arg2 arg3 arg4) > - (list proc arg1 arg2 arg3 arg4) > -) > - > -(defmacro fastcall5 (proc arg1 arg2 arg3 arg4 arg5) > - (list proc arg1 arg2 arg3 arg4 arg5) > -) > - > -(defmacro fastcall6 (proc arg1 arg2 arg3 arg4 arg5 arg6) > - (list proc arg1 arg2 arg3 arg4 arg5 arg6) > -) > - > -(defmacro fastcall7 (proc arg1 arg2 arg3 arg4 arg5 arg6 arg7) > - (list proc arg1 arg2 arg3 arg4 arg5 arg6 arg7) > -) > - > ; Value doesn't matter too much here, just ensure it's portable. > (define *UNSPECIFIED* (if #f 1))