Skip to content

Commit a5fd524

Browse files
author
luke
committed
Add BCODE_PTR macro and drop uing DATAPTR in eval.c.
git-svn-id: https://svn.r-project.org/R/trunk@89008 00db46b3-68df-0310-9c12-caf00c1e9a41
1 parent 3db3c01 commit a5fd524

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/include/Defn.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,7 @@ void (SET_HASHVALUE)(SEXP x, int v);
664664

665665
/* Bytecode access macros */
666666
#define BCODE_CODE(x) CAR(x)
667+
#define BCODE_PTR(x) ((BCODE *) DATAPTR(x))
667668
//#define BCODE_CONSTS(x) CDR(x)
668669
#define BCODE_EXPR(x) TAG(x)
669670
#define isByteCode(x) (TYPEOF(x)==BCODESXP)

src/main/eval.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5606,7 +5606,7 @@ static struct { void *addr; int argc; char *instname; } opinfo[OPCOUNT];
56065606
#define GETOP() (*pc++).i
56075607
#define SKIP_OP() (pc++)
56085608

5609-
#define BCCODE(e) (BCODE *) DATAPTR(BCODE_CODE(e))
5609+
#define BCCODE(e) BCODE_PTR(BCODE_CODE(e))
56105610
#else
56115611
typedef int BCODE;
56125612

@@ -8718,15 +8718,15 @@ attribute_hidden SEXP R_bcEncode(SEXP bytes)
87188718
v = ipc[0];
87198719
if (v < R_bcMinVersion || v > R_bcVersion) {
87208720
code = allocVector(INTSXP, m * 2);
8721-
pc = (BCODE *) DATAPTR(code);
8721+
pc = BCODE_PTR(code);
87228722
pc[0].i = v;
87238723
pc[1].v = opinfo[BCMISMATCH_OP].addr;
87248724
return code;
87258725
}
87268726
else {
87278727
code = allocVector(INTSXP, m * n);
87288728
memset(INTEGER(code), 0, m * n * sizeof(int));
8729-
pc = (BCODE *) DATAPTR(code);
8729+
pc = BCODE_PTR(code);
87308730

87318731
for (i = 0; i < n; i++) pc[i].i = ipc[i];
87328732

@@ -8771,7 +8771,7 @@ attribute_hidden SEXP R_bcDecode(SEXP code) {
87718771
int m = (sizeof(BCODE) + sizeof(int) - 1) / sizeof(int);
87728772

87738773
n = LENGTH(code) / m;
8774-
pc = (BCODE *) DATAPTR(code);
8774+
pc = BCODE_PTR(code);
87758775

87768776
bytes = allocVector(INTSXP, n);
87778777
ipc = INTEGER(bytes);

0 commit comments

Comments
 (0)