Port byte-code-meter to modern targets.
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 18 Jun 2012 22:53:53 +0000 (15:53 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 18 Jun 2012 22:53:53 +0000 (15:53 -0700)
* bytecode.c (METER_CODE) [BYTE_CODE_METER]: Don't assume
!CHECK_LISP_OBJECT_TYPE && !USE_LSB_TAG.  Problem with
CHECK_LISP_OBJECT_TYPE reported by Dmitry Andropov in
<http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00282.html>.
(METER_1, METER_2): Simplify.

src/ChangeLog
src/bytecode.c

index 0807482..df9fcb9 100644 (file)
@@ -1,3 +1,12 @@
+2012-06-18  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port byte-code-meter to modern targets.
+       * bytecode.c (METER_CODE) [BYTE_CODE_METER]: Don't assume
+       !CHECK_LISP_OBJECT_TYPE && !USE_LSB_TAG.  Problem with
+       CHECK_LISP_OBJECT_TYPE reported by Dmitry Andropov in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-06/msg00282.html>.
+       (METER_1, METER_2): Simplify.
+
 2012-06-18  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * data.c (Fdefalias): Return `symbol' (bug#11686).
index 2e6ee3d..9c7a3fa 100644 (file)
@@ -58,21 +58,21 @@ by Hallvard:
 #ifdef BYTE_CODE_METER
 
 Lisp_Object Qbyte_code_meter;
-#define METER_2(code1, code2) \
-  XFASTINT (XVECTOR (XVECTOR (Vbyte_code_meter)->contents[(code1)]) \
-           ->contents[(code2)])
-
-#define METER_1(code) METER_2 (0, (code))
+#define METER_2(code1, code2) AREF (AREF (Vbyte_code_meter, code1), code2)
+#define METER_1(code) METER_2 (0, code)
 
 #define METER_CODE(last_code, this_code)                               \
 {                                                                      \
   if (byte_metering_on)                                                        \
     {                                                                  \
-      if (METER_1 (this_code) < MOST_POSITIVE_FIXNUM)                  \
-        METER_1 (this_code)++;                                         \
+      if (XFASTINT (METER_1 (this_code)) < MOST_POSITIVE_FIXNUM)       \
+        XSETFASTINT (METER_1 (this_code),                              \
+                    XFASTINT (METER_1 (this_code)) + 1);               \
       if (last_code                                                    \
-         && METER_2 (last_code, this_code) < MOST_POSITIVE_FIXNUM)     \
-        METER_2 (last_code, this_code)++;                              \
+         && (XFASTINT (METER_2 (last_code, this_code))                 \
+             < MOST_POSITIVE_FIXNUM))                                  \
+        XSETFASTINT (METER_2 (last_code, this_code),                   \
+                    XFASTINT (METER_2 (last_code, this_code)) + 1);    \
     }                                                                  \
 }