guile-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Guile-commits] 01/09: Add frame-local-ref / frame-local-set! support fo


From: Andy Wingo
Subject: [Guile-commits] 01/09: Add frame-local-ref / frame-local-set! support for type 'ptr
Date: Thu, 17 Jun 2021 15:59:02 -0400 (EDT)

wingo pushed a commit to branch wip-tailify
in repository guile.

commit 7bd630fd158e1cb5de112a159ae5c612b1ea286a
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Tue Jun 15 15:31:21 2021 +0200

    Add frame-local-ref / frame-local-set! support for type 'ptr
    
    * libguile/frames.c (enum stack_item_representation):
    (scm_to_stack_item_representation):
    (scm_frame_local_ref):
    (scm_frame_local_set_x): Add support for "ptr" representations.
---
 libguile/frames.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/libguile/frames.c b/libguile/frames.c
index 0bb4057..b2711df 100644
--- a/libguile/frames.c
+++ b/libguile/frames.c
@@ -1,4 +1,4 @@
-/* Copyright 2001,2009-2015,2018
+/* Copyright 2001,2009-2015,2018,2021
      Free Software Foundation, Inc.
 
    This file is part of Guile.
@@ -231,7 +231,8 @@ enum stack_item_representation
     STACK_ITEM_SCM = 0,
     STACK_ITEM_F64 = 1,
     STACK_ITEM_U64 = 2,
-    STACK_ITEM_S64 = 3
+    STACK_ITEM_S64 = 3,
+    STACK_ITEM_PTR = 4
   };
 
 static enum stack_item_representation
@@ -245,6 +246,8 @@ scm_to_stack_item_representation (SCM x, const char *subr, 
int pos)
     return STACK_ITEM_U64;
   if (scm_is_eq (x, scm_from_latin1_symbol ("s64")))
     return STACK_ITEM_S64;
+  if (scm_is_eq (x, scm_from_latin1_symbol ("ptr")))
+    return STACK_ITEM_PTR;
 
   scm_wrong_type_arg (subr, pos, x);
   return 0;  /* Not reached.  */
@@ -279,6 +282,8 @@ scm_frame_local_ref (SCM frame, SCM index, SCM 
representation)
             return scm_from_uint64 (item->as_u64);
           case STACK_ITEM_S64:
             return scm_from_int64 (item->as_s64);
+          case STACK_ITEM_PTR:
+            return scm_from_uintptr_t (item->as_uint);
           default:
             abort();
         }
@@ -321,6 +326,8 @@ scm_frame_local_set_x (SCM frame, SCM index, SCM val, SCM 
representation)
           case STACK_ITEM_S64:
             item->as_s64 = scm_to_int64 (val);
             break;
+          case STACK_ITEM_PTR:
+            item->as_uint = scm_to_uintptr_t (val);
           default:
             abort();
         }



reply via email to

[Prev in Thread] Current Thread [Next in Thread]