mirror of
https://gitlab.com/embeddable-common-lisp/ecl.git
synced 2026-01-02 07:30:55 -08:00
Opcodes for small integers
This commit is contained in:
parent
3654ccf8b4
commit
38bbf43237
3 changed files with 21 additions and 0 deletions
|
|
@ -1933,8 +1933,11 @@ compile_form(cl_object stmt, int flags) {
|
|||
} else
|
||||
QUOTED:
|
||||
if ((flags & FLAG_USEFUL)) {
|
||||
cl_fixnum n;
|
||||
if (stmt == Cnil) {
|
||||
asm_op(push? OP_PUSHNIL : OP_NIL);
|
||||
} else if (FIXNUMP(stmt) && (n = fix(stmt), abs(n)) <= MAX_OPARG) {
|
||||
asm_op2(push? OP_PINT : OP_INT, n);
|
||||
} else {
|
||||
asm_op2c(push? OP_PUSHQ : OP_QUOTE, stmt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -593,6 +593,20 @@ ecl_interpret(cl_object frame, cl_object env, cl_object bytecodes, cl_index offs
|
|||
THREAD_NEXT;
|
||||
}
|
||||
|
||||
CASE(OP_INT); {
|
||||
cl_fixnum n;
|
||||
GET_OPARG(n, vector);
|
||||
reg0 = MAKE_FIXNUM(n);
|
||||
THREAD_NEXT;
|
||||
}
|
||||
|
||||
CASE(OP_PINT); {
|
||||
cl_fixnum n;
|
||||
GET_OPARG(n, vector);
|
||||
STACK_PUSH(the_env, MAKE_FIXNUM(n));
|
||||
THREAD_NEXT;
|
||||
}
|
||||
|
||||
/* OP_PUSH
|
||||
Pushes the object in VALUES(0).
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -18,6 +18,8 @@ enum {
|
|||
OP_CDR,
|
||||
OP_LIST,
|
||||
OP_LISTA,
|
||||
OP_INT,
|
||||
OP_PINT,
|
||||
OP_VAR,
|
||||
OP_VARS,
|
||||
OP_PUSH,
|
||||
|
|
@ -172,6 +174,8 @@ typedef int16_t cl_oparg;
|
|||
&&LBL_OP_CDR - &&LBL_OP_NOP,\
|
||||
&&LBL_OP_LIST - &&LBL_OP_NOP,\
|
||||
&&LBL_OP_LISTA - &&LBL_OP_NOP,\
|
||||
&&LBL_OP_INT - &&LBL_OP_NOP,\
|
||||
&&LBL_OP_PINT - &&LBL_OP_NOP,\
|
||||
&&LBL_OP_VAR - &&LBL_OP_NOP,\
|
||||
&&LBL_OP_VARS - &&LBL_OP_NOP,\
|
||||
&&LBL_OP_PUSH - &&LBL_OP_NOP,\
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue