瀏覽代碼

little cleanup for c-macro calls

master
FelixBrendel 6 年之前
父節點
當前提交
33145be4c6
共有 2 個文件被更改,包括 7 次插入12 次删除
  1. +5
    -12
      src/built_ins.cpp
  2. +2
    -0
      src/eval.cpp

+ 5
- 12
src/built_ins.cpp 查看文件

@@ -163,8 +163,6 @@ namespace Slime {
profile_with_name("(apply)");
using namespace Globals::Current_Execution;

--cs.next_index;
--ams.next_index;
Lisp_Object* args = pcs[--pcs.next_index];
try_void assert_list_length(args, 2);

@@ -224,10 +222,9 @@ namespace Slime {
{
profile_with_name("(eval)");
using namespace Globals::Current_Execution;
// TODO(Felix): ams index should be decremented in
// eval_expr when calling the macro
--ams.next_index;
cs.data[cs.next_index-1] = pcs[--pcs.next_index]->value.pair.first;
// we know cs.data[cs.next_index] is allocated because the
// macro cal lwas there just before
cs.data[cs.next_index++] = pcs[--pcs.next_index]->value.pair.first;
(nass.end()-1)->append(NasAction::Eval);
(nass.end()-1)->append(NasAction::Eval);

@@ -238,8 +235,6 @@ namespace Slime {
{
profile_with_name("(begin)");
using namespace Globals::Current_Execution;
--cs.next_index;
--ams.next_index;
Lisp_Object* args = pcs[--pcs.next_index];
int length = list_length(args);
cs.reserve(length);
@@ -263,7 +258,6 @@ namespace Slime {
| | -> | <then> |
| <if> | | <else> |
| .... | | ...... | */
--ams.next_index;
Lisp_Object* args = pcs.data[--pcs.next_index];
Lisp_Object* test = args->value.pair.first;
args = args->value.pair.rest;
@@ -274,7 +268,7 @@ namespace Slime {
Lisp_Object* alternative = args->value.pair.first;
args = args->value.pair.rest;
try_void assert_type(args, Lisp_Object_Type::Nil);
--cs.next_index;
cs.append(alternative);
cs.append(consequence);
cs.append(test);
@@ -292,8 +286,7 @@ namespace Slime {
// and a NasAction.
profile_with_name("(define)");
using namespace Globals::Current_Execution;
--cs.next_index;
--ams.next_index;

Lisp_Object* form = pcs.data[--pcs.next_index];
Lisp_Object* definee = form->value.pair.first;
form = form->value.pair.rest;


+ 2
- 0
src/eval.cpp 查看文件

@@ -395,6 +395,8 @@ namespace Slime {
case Lisp_Object_Type::Function: {
if(pc->value.function->is_c) {
if (pc->value.function->type.c_function_type == C_Function_Type::cMacro) {
--cs.next_index; // remove the macro call from cs
--ams.next_index; // remove the apply marker for the macro
try pc->value.function->body.c_macro_body();
} else if (pc->value.function->type.c_function_type == C_Function_Type::cSpecial)
{


Loading…
取消
儲存