guile-cvs
[Top][All Lists]
Advanced

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

guile/guile-lightning lightning.c


From: Marius Vollmer
Subject: guile/guile-lightning lightning.c
Date: Tue, 20 Mar 2001 15:45:07 -0800

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/03/20 15:45:06

Modified files:
        guile-lightning: lightning.c 

Log message:
        * lightning.c (imm2int): Also accept immediates of the form
        `(label ...)', returning the address of the label, which must
        already be defined.  Take the label hash as a parameter for this.

CVSWeb URLs:
http://subversions.gnu.org/cgi-bin/cvsweb/guile/guile-lightning/lightning.c.diff?r1=1.2&r2=1.3

Patches:
Index: guile/guile-lightning/lightning.c
diff -u guile/guile-lightning/lightning.c:1.2 
guile/guile-lightning/lightning.c:1.3
--- guile/guile-lightning/lightning.c:1.2       Mon Mar 19 17:59:10 2001
+++ guile/guile-lightning/lightning.c   Tue Mar 20 15:45:06 2001
@@ -198,9 +198,10 @@
 
 SCM_SYMBOL (sym_scm, "scm");
 SCM_SYMBOL (sym_subr, "subr");
+SCM_SYMBOL (sym_label, "label");
 
 static unsigned long
-imm2int (SCM imm)
+imm2int (SCM imm, SCM label_hash)
 {
   if (scm_ilength (imm) == 2)
     {
@@ -217,6 +218,14 @@
            scm_misc_error ("assemble", "undefined subr: ~A", SCM_LIST1 (imm));
          return (unsigned long)addr;
        }
+      else if (SCM_CAR (imm) == sym_label && SCM_SYMBOLP (SCM_CADR (imm)))
+       {
+         jit_insn *lab = get_label_def (label_hash, SCM_CADR (imm));
+         if (lab == NULL)
+           scm_misc_error ("assemble", "undefined label: ~A",
+                           SCM_LIST1 (imm));
+         return (unsigned long)lab;
+       }
     }
   else if (SCM_NUMBERP (imm))
     return scm_num2ulong (imm, (char *)SCM_ARG1, "assemble");
@@ -292,7 +301,7 @@
                                        "in ~A, not a symbol: ~A", \
                                        SCM_LIST2 (insn, s));
 
-#define AS_INT(x)     (imm2int ((x)))
+#define AS_INT(x)     (imm2int ((x), label_hash))
 #define AS_REG(x)     (sym2reg ((x)))
 #define IS_REG(x)     (SCM_SYMBOLP ((x)))
 



reply via email to

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