guile-commits
[Top][All Lists]
Advanced

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

[Guile-commits] 01/04: Rename "lookup" intrinsic to "module-variable"


From: Andy Wingo
Subject: [Guile-commits] 01/04: Rename "lookup" intrinsic to "module-variable"
Date: Mon, 11 May 2020 04:36:32 -0400 (EDT)

wingo pushed a commit to branch master
in repository guile.

commit d6b6392cfbb4bad37e33745c6c5c50c674f8d773
Author: Andy Wingo <address@hidden>
AuthorDate: Mon May 11 09:46:40 2020 +0200

    Rename "lookup" intrinsic to "module-variable"
    
    It can return #f, unlike scm_(module_)?lookup.
    
    * libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS):
    * libguile/intrinsics.c (module_variable, scm_bootstrap_intrinsics):
      Rename.
    * module/language/cps/compile-bytecode.scm (compile-function):
    * module/language/cps/effects-analysis.scm (current-module):
    * module/language/cps/reify-primitives.scm (reify-lookup)
      (compute-known-primitives):
    * module/language/tree-il/compile-bytecode.scm (emit-cached-module-box)
      (emit-cached-toplevel-box, emit-toplevel-box):
    * module/language/tree-il/compile-cps.scm (toplevel-box):
    * module/system/vm/assembler.scm (module-variable): Adapt users.
---
 libguile/intrinsics.c                        | 4 ++--
 libguile/intrinsics.h                        | 2 +-
 module/language/cps/compile-bytecode.scm     | 5 +++--
 module/language/cps/effects-analysis.scm     | 4 ++--
 module/language/cps/reify-primitives.scm     | 4 ++--
 module/language/tree-il/compile-bytecode.scm | 6 +++---
 module/language/tree-il/compile-cps.scm      | 2 +-
 module/system/vm/assembler.scm               | 4 ++--
 8 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/libguile/intrinsics.c b/libguile/intrinsics.c
index ba25dcb..d23731e 100644
--- a/libguile/intrinsics.c
+++ b/libguile/intrinsics.c
@@ -334,7 +334,7 @@ resolve_module (SCM name, uint8_t public_p)
 }
 
 static SCM
-lookup (SCM module, SCM name)
+module_variable (SCM module, SCM name)
 {
   /* If MODULE was captured before modules were booted, use the root
      module.  Not so nice, but hey...  */
@@ -574,7 +574,7 @@ scm_bootstrap_intrinsics (void)
   scm_vm_intrinsics.less_p = less_p;
   scm_vm_intrinsics.numerically_equal_p = numerically_equal_p;
   scm_vm_intrinsics.resolve_module = resolve_module;
-  scm_vm_intrinsics.lookup = lookup;
+  scm_vm_intrinsics.module_variable = module_variable;
   scm_vm_intrinsics.define_x = scm_module_ensure_local_variable;
   scm_vm_intrinsics.throw_ = throw_;
   scm_vm_intrinsics.throw_with_value = throw_with_value;
diff --git a/libguile/intrinsics.h b/libguile/intrinsics.h
index 5af5265..c941056 100644
--- a/libguile/intrinsics.h
+++ b/libguile/intrinsics.h
@@ -142,7 +142,7 @@ typedef void (*scm_t_scm_uimm_scm_intrinsic) (SCM, uint8_t, 
SCM);
   M(compare_from_scm_scm, less_p, "<?", LESS_P) \
   M(bool_from_scm_scm, numerically_equal_p, "=?", NUMERICALLY_EQUAL_P) \
   M(scm_from_scm_uimm, resolve_module, "resolve-module", RESOLVE_MODULE) \
-  M(scm_from_scm_scm, lookup, "lookup", LOOKUP) \
+  M(scm_from_scm_scm, module_variable, "module-variable", MODULE_VARIABLE) \
   M(scm_from_scm_scm, define_x, "define!", DEFINE_X) \
   M(thread_sp, expand_stack, "expand-stack", EXPAND_STACK) \
   M(scm_from_thread_u32, cons_rest, "cons-rest", CONS_REST) \
diff --git a/module/language/cps/compile-bytecode.scm 
b/module/language/cps/compile-bytecode.scm
index 48e6ba1..c11ba31 100644
--- a/module/language/cps/compile-bytecode.scm
+++ b/module/language/cps/compile-bytecode.scm
@@ -186,8 +186,9 @@
          (emit-cache-ref asm (from-sp dst) key))
         (($ $primcall 'resolve-module public? (name))
          (emit-resolve-module asm (from-sp dst) (from-sp (slot name)) public?))
-        (($ $primcall 'lookup #f (mod name))
-         (emit-lookup asm (from-sp dst) (from-sp (slot mod)) (from-sp (slot 
name))))
+        (($ $primcall 'module-variable #f (mod name))
+         (emit-module-variable asm (from-sp dst) (from-sp (slot mod))
+                               (from-sp (slot name))))
         (($ $primcall 'add/immediate y (x))
          (emit-add/immediate asm (from-sp dst) (from-sp (slot x)) y))
         (($ $primcall 'sub/immediate y (x))
diff --git a/module/language/cps/effects-analysis.scm 
b/module/language/cps/effects-analysis.scm
index 5073924..32bf5b6 100644
--- a/module/language/cps/effects-analysis.scm
+++ b/module/language/cps/effects-analysis.scm
@@ -1,6 +1,6 @@
 ;;; Effects analysis on CPS
 
-;; Copyright (C) 2011-2015,2017-2019 Free Software Foundation, Inc.
+;; Copyright (C) 2011-2015,2017-2020 Free Software Foundation, Inc.
 
 ;;;; This library is free software; you can redistribute it and/or
 ;;;; modify it under the terms of the GNU Lesser General Public
@@ -485,7 +485,7 @@ the LABELS that are clobbered by the effects of LABEL."
   ((cache-current-module! m)       (&write-object &cache))
   ((resolve name)                  (&read-object &module)      &type-check)
   ((resolve-module mod)            (&read-object &module)      &type-check)
-  ((lookup mod name)               (&read-object &module)      &type-check)
+  ((module-variable mod name)      (&read-object &module)      &type-check)
   ((cached-toplevel-box)                                       &type-check)
   ((cached-module-box)                                         &type-check)
   ((define! mod name)              (&read-object &module)))
diff --git a/module/language/cps/reify-primitives.scm 
b/module/language/cps/reify-primitives.scm
index eb14c8b..863018c 100644
--- a/module/language/cps/reify-primitives.scm
+++ b/module/language/cps/reify-primitives.scm
@@ -219,7 +219,7 @@
                   ($branch kbad k src 'heap-object? #f (var))))
           (build-term
             ($continue kres src
-              ($primcall 'lookup #f (mod-var name-var)))))))
+              ($primcall 'module-variable #f (mod-var name-var)))))))
   (define %unbound
     #(unbound-variable #f "Unbound variable: ~S"))
   (with-cps cps
@@ -354,7 +354,7 @@
       push-dynamic-state pop-dynamic-state
       lsh rsh lsh/immediate rsh/immediate
       cache-ref cache-set!
-      resolve-module lookup define! current-module))
+      resolve-module module-variable define! current-module))
   (let ((table (make-hash-table)))
     (for-each
      (match-lambda ((inst . _) (hashq-set! table inst #t)))
diff --git a/module/language/tree-il/compile-bytecode.scm 
b/module/language/tree-il/compile-bytecode.scm
index cb87799..b8c66dd 100644
--- a/module/language/tree-il/compile-bytecode.scm
+++ b/module/language/tree-il/compile-bytecode.scm
@@ -88,7 +88,7 @@
   (emit-load-constant asm dst mod)
   (emit-resolve-module asm dst dst public?)
   (emit-load-constant asm tmp name)
-  (emit-lookup asm dst dst tmp)
+  (emit-module-variable asm dst dst tmp)
   (emit-cache-set! asm key dst)
   (emit-label asm cached))
 (define (emit-cached-toplevel-box asm dst scope name tmp)
@@ -99,13 +99,13 @@
   (emit-je asm cached)
   (emit-cache-ref asm dst scope)
   (emit-load-constant asm tmp name)
-  (emit-lookup asm dst dst tmp)
+  (emit-module-variable asm dst dst tmp)
   (emit-cache-set! asm key dst)
   (emit-label asm cached))
 (define (emit-toplevel-box asm dst name tmp)
   (emit-current-module asm dst)
   (emit-load-constant asm tmp name)
-  (emit-lookup asm dst dst tmp))
+  (emit-module-variable asm dst dst tmp))
 
 (define closure-header-words 2)
 (define (emit-allocate-closure asm dst nfree label tmp)
diff --git a/module/language/tree-il/compile-cps.scm 
b/module/language/tree-il/compile-cps.scm
index a2dbbc5..d75807d 100644
--- a/module/language/tree-il/compile-cps.scm
+++ b/module/language/tree-il/compile-cps.scm
@@ -1430,7 +1430,7 @@
                     ($branch kbad ktest src 'heap-object? #f (box))))
        (letk kname ($kargs ('name) (name-var)
                      ($continue kbox src
-                       ($primcall 'lookup #f (mod name-var)))))
+                       ($primcall 'module-variable #f (mod name-var)))))
        (letk kmod ($kargs ('mod) (mod)
                     ($continue kname src ($const name))))
        (build-term
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 6af10f5..b9b313f 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -256,7 +256,7 @@
             emit-lsh/immediate
             emit-rsh/immediate
             emit-resolve-module
-            emit-lookup
+            emit-module-variable
             emit-define!
             emit-current-module
 
@@ -1493,7 +1493,7 @@ returned instead."
 (define-scm<-scm-uimm-intrinsic lsh/immediate)
 (define-scm<-scm-uimm-intrinsic rsh/immediate)
 (define-scm<-scm-bool-intrinsic resolve-module)
-(define-scm<-scm-scm-intrinsic lookup)
+(define-scm<-scm-scm-intrinsic module-variable)
 (define-scm<-scm-scm-intrinsic define!)
 (define-scm<-thread-intrinsic current-module)
 



reply via email to

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