From defd4196e7acc24a9c5a10799e960a2f3c8c50d3 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 18 Jun 2012 15:53:53 -0700 Subject: [PATCH] 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 . (METER_1, METER_2): Simplify. --- src/ChangeLog | 9 +++++++++ src/bytecode.c | 18 +++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 080748236b4..df9fcb9dd87 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2012-06-18 Paul Eggert + + 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 + . + (METER_1, METER_2): Simplify. + 2012-06-18 Stefan Monnier * data.c (Fdefalias): Return `symbol' (bug#11686). diff --git a/src/bytecode.c b/src/bytecode.c index 2e6ee3d4445..9c7a3fa30cf 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -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); \ } \ } -- 2.39.5