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: Sat, 24 Mar 2001 20:29:46 -0800

CVSROOT:        /cvs
Module name:    guile
Changes by:     Marius Vollmer <address@hidden> 01/03/24 20:29:46

Modified files:
        guile-lightning: lightning.c 

Log message:
        * lightning.c:  Use "~S" instead of "~A" in error messages.
        (scm_assemble): Allocate a JIT buffer based on the
        number of instructions to assemble.
        (imm2int): Do not prepend "scm_" for `subr' immediates.

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

Patches:
Index: guile/guile-lightning/lightning.c
diff -u guile/guile-lightning/lightning.c:1.3 
guile/guile-lightning/lightning.c:1.4
--- guile/guile-lightning/lightning.c:1.3       Tue Mar 20 15:45:06 2001
+++ guile/guile-lightning/lightning.c   Sat Mar 24 20:29:46 2001
@@ -192,7 +192,7 @@
 {
   SCM id = scm_hashq_ref (arg_hash, sym, SCM_BOOL_F);
   if (id == SCM_BOOL_F)
-    scm_misc_error ("assemble", "undefined argument: ~A", SCM_LIST1 (sym));
+    scm_misc_error ("assemble", "undefined argument: ~S", SCM_LIST1 (sym));
   return SCM_INUM (id);
 }
 
@@ -209,20 +209,17 @@
        return SCM_CADR (imm);
       else if (SCM_CAR (imm) == sym_subr && SCM_STRINGP (SCM_CADR (imm)))
        {
-         char buf[50];
          void *addr;
-         
-         snprintf (buf, 50, "scm_%s", SCM_CHARS (SCM_CADR (imm)));
-         addr = dlsym (NULL, buf);
+         addr = dlsym (NULL, SCM_CHARS (SCM_CADR (imm)));
          if (addr == NULL)
-           scm_misc_error ("assemble", "undefined subr: ~A", SCM_LIST1 (imm));
+           scm_misc_error ("assemble", "undefined subr: ~S", 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_misc_error ("assemble", "undefined label: ~S",
                            SCM_LIST1 (imm));
          return (unsigned long)lab;
        }
@@ -254,12 +251,12 @@
   int i;
 
   if (!SCM_SYMBOLP (sym))
-    scm_misc_error ("assemble", "not a register: ~A", SCM_LIST1 (sym));
+    scm_misc_error ("assemble", "not a register: ~S", SCM_LIST1 (sym));
 
   for (i = 0; table[i].sym; i++)
     if (!strcmp (table[i].sym, SCM_CHARS(sym)))
       return table[i].reg;
-  scm_misc_error ("assemble", "unrecognized register: ~A", SCM_LIST1 (sym));
+  scm_misc_error ("assemble", "unrecognized register: ~S", SCM_LIST1 (sym));
 }
 
 /* Assemble one instruction.  The guts is generated by `rod.scm'
@@ -277,7 +274,7 @@
       int insn_len = scm_ilength (insn);
 
       if (insn_len < 1 || !SCM_SYMBOLP (SCM_CAR (insn)))
-       scm_misc_error ("assemble", "invalid instruction: ~A",
+       scm_misc_error ("assemble", "invalid instruction: ~S",
                        SCM_LIST1 (insn));
       insn_op = SCM_SYMBOL_CHARS (SCM_CAR (insn));
       switch (insn_len)
@@ -294,11 +291,11 @@
 
 #define ASSERT_LEN(n) if (insn_len-1 != (n)) \
                        scm_misc_error ("assemble", \
-                                       "wrong number of operands: ~A", \
+                                       "wrong number of operands: ~S", \
                                        SCM_LIST1 (insn));
 #define ASSERT_SYM(s) if (!SCM_SYMBOLP ((s))) \
                        scm_misc_error ("assemble", \
-                                       "in ~A, not a symbol: ~A", \
+                                       "in ~S, not a symbol: ~S", \
                                        SCM_LIST2 (insn, s));
 
 #define AS_INT(x)     (imm2int ((x), label_hash))
@@ -356,10 +353,11 @@
   size_t sz;
   struct code *c;
   SCM z;
+  int asm_len;
 
-  SCM_VALIDATE_LIST (SCM_ARG1, asm_code);
+  SCM_VALIDATE_LIST_COPYLEN (SCM_ARG1, asm_code, asm_len);
 
-  sz = sizeof(struct code) + sizeof(jit_insn)*200;
+  sz = sizeof(struct code) + sizeof(jit_insn)*JIT_MAX_INSNS*asm_len;
   c  = scm_must_malloc (sz, "code");
   c->size = sz;
   c->proc = SCM_BOOL_F;



reply via email to

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