Beispiel #1
0
Datei: lx.py Projekt: kr/sodium
def compile_smeth_body(meth, meth_entry):
    pop_all_symbol = make_label('pop-all')
    if is_inline_meth(meth):
        return compile_inline_meth_body(meth, meth_entry, nil)
    if is_asm_meth(meth): return compile_asm_meth_body(meth, meth_entry, nil)
    formals = meth_params(meth)
    body = meth_body(meth)
    cenv = cons(formals, plist(plist(self_s)))
    return append_ir_seqs(
        make_ir_seq((proc_r,), (env_r,),
            backptr(),
            meth_entry,
            ir.list(env_r, proc_r),
            ir.list(env_r, env_r)),
        compile_literal(formals, tmp_r, next_s, cenv, pop_all_symbol),
        make_ir_seq((env_r, argl_r, tmp_r), (env_r,),
            extend_environment(env_r, env_r, argl_r, tmp_r)),
        compile_sequence(body, val_r, return_s, cenv, pop_all_symbol))
Beispiel #2
0
Datei: lx.py Projekt: kr/sodium
def construct_arglist(operand_codes, pop_all_symbol):
    operand_codes = operand_codes.reverse()
    if operand_codes.nullp():
        return make_ir_seq((), (argl_r,), mov(argl_r, nil_r))
    code_to_get_last_arg = append_ir_seqs(operand_codes.car(),
                                          make_ir_seq((val_r,), (argl_r,),
                                              ir.list(argl_r, val_r)))
    if operand_codes.cdr().nullp(): return code_to_get_last_arg
    return preserving((env_r,), code_to_get_last_arg,
            code_to_get_rest_args(operand_codes.cdr(), pop_all_symbol), pop_all_symbol)