public inbox for cgen@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: cgen@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [RFC 10/14] Hack cos.scm to work with new Guile
Date: Sat, 19 Aug 2023 11:42:09 -0600	[thread overview]
Message-ID: <20230819174900.866436-11-tom@tromey.com> (raw)
In-Reply-To: <20230819174900.866436-1-tom@tromey.com>

cos.scm calls procedure->memoizing-macro, which no longer exists in Guile.

This patch hacks around this by having the member accessors always use
the "slow" path.  In practice, with Guile 3.0, this is still fast
enough on my machine.

Longer term this code should all be removed in favor of GOOPS.
---
 cos.scm | 56 ++++++++++++++++++++++++++++----------------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/cos.scm b/cos.scm
index 1ba4c54..34f1848 100644
--- a/cos.scm
+++ b/cos.scm
@@ -905,16 +905,16 @@
 
 ;; Subroutine of elm-get.
 
-(define (/elm-make-method-getter self elm-name)
-  (/object-check self "elm-get")
-  (let ((index (/class-lookup-element (/object-class-desc self) elm-name)))
-    (if index
-	(procedure->memoizing-macro
-	 (lambda (exp env)
-	   `(lambda (obj)
-	      (/object-elm-get obj ,index))))
-	(/object-error "elm-get" self "element not present: " elm-name)))
-)
+;; (define (/elm-make-method-getter self elm-name)
+;;   (/object-check self "elm-get")
+;;   (let ((index (/class-lookup-element (/object-class-desc self) elm-name)))
+;;     (if index
+;; 	(procedure->memoizing-macro
+;; 	 (lambda (exp env)
+;; 	   `(lambda (obj)
+;; 	      (/object-elm-get obj ,index))))
+;; 	(/object-error "elm-get" self "element not present: " elm-name)))
+;; )
 
 ;; Get an element from an object.
 ;; If OBJ is `self' then the caller is required to be a method and we emit
@@ -929,33 +929,33 @@
 ;; operation with O(1).  Cute, but I'm hoping there's an easier/better way.
 
 (defmacro elm-get (self elm-name)
-  (if (eq? self 'self)
-      `(((/elm-make-method-getter ,self ,elm-name)) ,self)
-      `(elm-xget ,self ,elm-name))
-)
+  ;; (if (eq? self 'self)
+  ;;     `(((/elm-make-method-getter ,self ,elm-name)) ,self)
+  `(elm-xget ,self ,elm-name)
+  )
 
 ;; Subroutine of elm-set!.
 
-(define (/elm-make-method-setter self elm-name)
-  (/object-check self "elm-set!")
-  (let ((index (/class-lookup-element (/object-class-desc self) elm-name)))
-    (if index
-	(procedure->memoizing-macro
-	 (lambda (exp env)
-	   `(lambda (obj new-val)
-	      (/object-elm-set! obj ,index new-val))))
-	(/object-error "elm-set!" self "element not present: " elm-name)))
-)
+;; (define (/elm-make-method-setter self elm-name)
+;;   (/object-check self "elm-set!")
+;;   (let ((index (/class-lookup-element (/object-class-desc self) elm-name)))
+;;     (if index
+;; 	(procedure->memoizing-macro
+;; 	 (lambda (exp env)
+;; 	   `(lambda (obj new-val)
+;; 	      (/object-elm-set! obj ,index new-val))))
+;; 	(/object-error "elm-set!" self "element not present: " elm-name)))
+;; )
 
 ;; Set an element in an object.
 ;; This can only be used by methods.
 ;; See the comments for `elm-get'!
 
 (defmacro elm-set! (self elm-name new-val)
-  (if (eq? self 'self)
-      `(((/elm-make-method-setter ,self ,elm-name)) ,self ,new-val)
-      `(elm-xset! ,self ,elm-name ,new-val))
-)
+  ;; (if (eq? self 'self)
+  ;;     `(((/elm-make-method-setter ,self ,elm-name)) ,self ,new-val)
+  `(elm-xset! ,self ,elm-name ,new-val)
+  )
 
 ;; Get an element from an object.
 ;; This is for invoking from outside a method, and without having to
-- 
2.41.0


  parent reply	other threads:[~2023-08-19 20:20 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-19 17:41 [RFC 00/14] Port to Guile 3.0 Tom Tromey
2023-08-19 17:42 ` [RFC 01/14] Add a .gitignore Tom Tromey
2023-08-20  8:04   ` Jose E. Marchesi
2023-08-19 17:42 ` [RFC 02/14] Remove some 'fastcall' code Tom Tromey
2023-08-20  8:13   ` Jose E. Marchesi
2023-08-22 16:52     ` Tom Tromey
2023-08-19 17:42 ` [RFC 03/14] Remove bound-symbol? Tom Tromey
2023-08-20  8:14   ` Jose E. Marchesi
2023-08-19 17:42 ` [RFC 04/14] Remove =? and >=? aliases Tom Tromey
2023-08-20  8:15   ` Jose E. Marchesi
2023-08-19 17:42 ` [RFC 05/14] Fix bug in insn.scm Tom Tromey
2023-08-20  8:15   ` Jose E. Marchesi
2023-08-19 17:42 ` [RFC 06/14] Remove support for old versions of Guile Tom Tromey
2023-08-19 17:42 ` [RFC 07/14] Use define-macro in rtl.scm Tom Tromey
2023-08-19 17:42 ` [RFC 08/14] Remove let bindings of macros Tom Tromey
2023-08-20  8:33   ` Jose E. Marchesi
2023-08-19 17:42 ` [RFC 09/14] Remove define-in-define Tom Tromey
2023-08-19 17:42 ` Tom Tromey [this message]
2023-08-19 17:42 ` [RFC 11/14] Invalid code in rtx-traverse.scm Tom Tromey
2023-08-20  8:42   ` Jose E. Marchesi
2023-08-19 17:42 ` [RFC 12/14] Nuke cgen-call-with-debugging and cgen-debugging-stack-start Tom Tromey
2023-08-19 17:42 ` [RFC 13/14] Load macros before uses Tom Tromey
2023-08-19 17:42 ` [RFC 14/14] Remove pprint.scm and cos-pprint.scm Tom Tromey
2023-08-20  8:03 ` [RFC 00/14] Port to Guile 3.0 Jose E. Marchesi
2023-08-20 17:26   ` Frank Ch. Eigler
2023-08-20 19:52     ` Tom Tromey
2023-08-21  1:38       ` Frank Ch. Eigler
2023-08-21 13:06 ` Julian Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230819174900.866436-11-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=cgen@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).