The R Project SVN R

Rev

Rev 77250 | Rev 80646 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 77250 Rev 77275
Line 3240... Line 3240...
3240
 
3240
 
3241
The [[INCLNK]] and [[DECLNK]] instructions are used to protect
3241
The [[INCLNK]] and [[DECLNK]] instructions are used to protect
3242
evaluated arguents on the stack from modifications during evaluation
3242
evaluated arguents on the stack from modifications during evaluation
3243
of subsequent arguments. These instructions can be omitted if the
3243
of subsequent arguments. These instructions can be omitted if the
3244
subsequent argument evaluations cannot modify values on the stack.
3244
subsequent argument evaluations cannot modify values on the stack.
-
 
3245
With changes to stack protection this is mechanism is no longer
-
 
3246
needed, so the check just returns [[FALSE]].
3245
<<[[checkNeedsInc]] function>>=
3247
<<[[checkNeedsInc]] function>>=
-
 
3248
checkNeedsInc <- function(e, cntxt)
-
 
3249
    return(FALSE)
-
 
3250
@ %def checkNeedsInc
-
 
3251
<<old [[checkNeedsInc]] function>>=
3246
checkNeedsInc <- function(e, cntxt) {
3252
checkNeedsInc <- function(e, cntxt) {
3247
    type <- typeof(e)
3253
    type <- typeof(e)
3248
    if (type %in% c("language", "bytecode", "promise"))
3254
    if (type %in% c("language", "bytecode", "promise"))
3249
        TRUE
3255
        TRUE
3250
    else FALSE ## symbols and constants
3256
    else FALSE ## symbols and constants
Line 4340... Line 4346...
4340
 
4346
 
4341
Complex assignment expressions are compiled by [[cmpComplexAssign]].
4347
Complex assignment expressions are compiled by [[cmpComplexAssign]].
4342
<<[[cmpComplexAssign]] function>>=
4348
<<[[cmpComplexAssign]] function>>=
4343
cmpComplexAssign <- function(symbol, lhs, value, superAssign, cb, cntxt) {
4349
cmpComplexAssign <- function(symbol, lhs, value, superAssign, cb, cntxt) {
4344
    <<select complex assignment instructions>>
4350
    <<select complex assignment instructions>>
-
 
4351
    <<protect the stack during a non-top-level complex assignment>>
4345
    <<compile the right hand side value expression>>
4352
    <<compile the right hand side value expression>>
4346
    <<compile the left hand side call>>
4353
    <<compile the left hand side call>>
-
 
4354
    <<unprotect the stack after a not-top-level complex assignment>>
4347
    <<for tail calls return the value invisibly>>
4355
    <<for tail calls return the value invisibly>>
4348
    TRUE;
4356
    TRUE;
4349
}
4357
}
4350
@ %def cmpComplexAssign
4358
@ %def cmpComplexAssign
4351
 
4359
 
Line 4469... Line 4477...
4469
its call; all others will use [[*vtmp*]].  Each replacement function
4477
its call; all others will use [[*vtmp*]].  Each replacement function
4470
call compiled by [[cmpSetterCall]] will remove the top two elements
4478
call compiled by [[cmpSetterCall]] will remove the top two elements
4471
from the stack and then push the new right hand side value on the
4479
from the stack and then push the new right hand side value on the
4472
stack.  [[cmpSetterCall]] is described in Section \ref{subsec:setter}.
4480
stack.  [[cmpSetterCall]] is described in Section \ref{subsec:setter}.
4473
 
4481
 
-
 
4482
For non-top-level complex assignments values on the stack need to be
-
 
4483
protected from mutation during the assignment.
-
 
4484
<<protect the stack during a non-top-level complex assignment>>=
-
 
4485
if (! cntxt$toplevel) cb$putcode(INCLNKSTK.OP)
-
 
4486
@
-
 
4487
<<unprotect the stack after a not-top-level complex assignment>>=
-
 
4488
if (! cntxt$toplevel) cb$putcode(DECLNKSTK.OP)
-
 
4489
@
-
 
4490
 
4474
 
4491
 
4475
\subsection{Compiling setter calls}
4492
\subsection{Compiling setter calls}
4476
\label{subsec:setter}
4493
\label{subsec:setter}
4477
Setter calls, or calls to replacement functions, in compiled
4494
Setter calls, or calls to replacement functions, in compiled
4478
assignment expressions find stack that contains the current right hand
4495
assignment expressions find stack that contains the current right hand
Line 6119... Line 6136...
6119
SEQLEN.OP <- 122
6136
SEQLEN.OP <- 122
6120
BASEGUARD.OP <- 123
6137
BASEGUARD.OP <- 123
6121
INCLNK.OP <- 124
6138
INCLNK.OP <- 124
6122
DECLNK.OP <- 125
6139
DECLNK.OP <- 125
6123
DECLNK_N.OP <- 126
6140
DECLNK_N.OP <- 126
-
 
6141
INCLNKSTK.OP <- 127
-
 
6142
DECLNKSTK.OP <- 128
6124
@ 
6143
@ 
6125
 
6144
 
6126
\subsection{Instruction argument counts and names}
6145
\subsection{Instruction argument counts and names}
6127
<<opcode argument counts>>=
6146
<<opcode argument counts>>=
6128
Opcodes.argc <- list(
6147
Opcodes.argc <- list(
Line 6250... Line 6269...
6250
SEQALONG.OP = 1,
6269
SEQALONG.OP = 1,
6251
SEQLEN.OP = 1,
6270
SEQLEN.OP = 1,
6252
BASEGUARD.OP = 2,
6271
BASEGUARD.OP = 2,
6253
INCLNK.OP = 0,
6272
INCLNK.OP = 0,
6254
DECLNK.OP = 0,
6273
DECLNK.OP = 0,
6255
DECLNK_N.OP = 1
6274
DECLNK_N.OP = 1,
-
 
6275
INCLNKSTK.OP = 0,
-
 
6276
DECLNKSTK.OP = 0
6256
)
6277
)
6257
@ 
6278
@ 
6258
 
6279
 
6259
<<opcode names>>=
6280
<<opcode names>>=
6260
Opcodes.names <- names(Opcodes.argc)
6281
Opcodes.names <- names(Opcodes.argc)