示例#1
0
RewriterVar* JitFragmentWriter::emitPPCall(void* func_addr, llvm::ArrayRef<RewriterVar*> args, int num_slots,
                                           int slot_size, AST* ast_node, TypeRecorder* type_recorder) {
    RewriterVar::SmallVector args_vec(args.begin(), args.end());
#if ENABLE_BASELINEJIT_ICS
    RewriterVar* result = createNewVar();

    int args_size = args.size();
    RewriterVar** _args = (RewriterVar**)regionAlloc(sizeof(RewriterVar*) * args_size);
    memcpy(_args, args.begin(), sizeof(RewriterVar*) * args_size);

    addAction([=]() {
        this->_emitPPCall(result, func_addr, llvm::ArrayRef<RewriterVar*>(_args, args_size), num_slots, slot_size,
                          ast_node);
    }, args, ActionType::NORMAL);

    if (type_recorder) {
        RewriterVar* type_recorder_var = imm(type_recorder);
        RewriterVar* obj_cls_var = result->getAttr(offsetof(Box, cls));
        addAction([=]() { _emitRecordType(type_recorder_var, obj_cls_var); }, { type_recorder_var, obj_cls_var },
                  ActionType::NORMAL);
        return result;
    }
    return result;
#else
    assert(args_vec.size() < 7);
    return call(false, func_addr, args_vec);
#endif
}
示例#2
0
RewriterVar* JitFragmentWriter::emitPPCall(void* func_addr, llvm::ArrayRef<RewriterVar*> args, int num_slots,
                                           int slot_size, TypeRecorder* type_recorder) {
    RewriterVar::SmallVector args_vec(args.begin(), args.end());
#if ENABLE_BASELINEJIT_ICS
    RewriterVar* result = createNewVar();
    addAction([=]() { this->_emitPPCall(result, func_addr, args_vec, num_slots, slot_size); }, args,
              ActionType::NORMAL);
    if (type_recorder)
        return call(false, (void*)recordType, imm(type_recorder), result);
    return result;
#else
    assert(args_vec.size() < 7);
    return call(false, func_addr, args_vec);
#endif
}