int main() { int cout{9}; std::cout << (cout << cout << '\n'); printif(true); std::cout << sizeof(static_array<int, 15>) << '\n'; static_array<int, 15> vec(6); static_array<int, 15> vec2 = vec; vec = vec2; std::cout << vec.size << '\n'; std::cout << vec.array[0] << " " << vec.array[1] << '\n'; std::cout << vec2.array[0] << " " << vec2.array[1] << '\n'; }
static void write_program(definition * def, char *storage) { version_list *vp; proc_list *proc; int filled; for (vp = def->def.pr.versions; vp != NULL; vp = vp->next) { f_print(fout, "\n"); if (storage != NULL) { f_print(fout, "%s ", storage); } f_print(fout, "void\n"); pvname(def->def_name, vp->vers_num); f_print(fout, "(%s, %s)\n", RQSTP, TRANSP); f_print(fout, " struct svc_req *%s;\n", RQSTP); f_print(fout, " SVCXPRT *%s;\n", TRANSP); f_print(fout, "{\n"); filled = 0; f_print(fout, "\tunion {\n"); for (proc = vp->procs; proc != NULL; proc = proc->next) { if (streq(proc->arg_type, "void")) { continue; } filled = 1; f_print(fout, "\t\t"); ptype(proc->arg_prefix, proc->arg_type, 0); pvname(proc->proc_name, vp->vers_num); f_print(fout, "_arg;\n"); } if (!filled) { f_print(fout, "\t\tint fill;\n"); } f_print(fout, "\t} %s;\n", ARG); f_print(fout, "\tchar *%s;\n", RESULT); f_print(fout, "\tbool_t (*xdr_%s)(), (*xdr_%s)();\n", ARG, RESULT); f_print(fout, "\tchar *(*%s)();\n", ROUTINE); f_print(fout, "\n"); f_print(fout, "\tswitch (%s->rq_proc) {\n", RQSTP); if (!nullproc(vp->procs)) { f_print(fout, "\tcase NULLPROC:\n"); f_print(fout, "\t\tsvc_sendreply(%s, xdr_void, NULL);\n", TRANSP); f_print(fout, "\t\treturn;\n\n"); } for (proc = vp->procs; proc != NULL; proc = proc->next) { f_print(fout, "\tcase %s:\n", proc->proc_name); f_print(fout, "\t\txdr_%s = xdr_%s;\n", ARG, stringfix(proc->arg_type)); f_print(fout, "\t\txdr_%s = xdr_%s;\n", RESULT, stringfix(proc->res_type)); f_print(fout, "\t\t%s = (char *(*)()) ", ROUTINE); pvname(proc->proc_name, vp->vers_num); f_print(fout, ";\n"); f_print(fout, "\t\tbreak;\n\n"); } f_print(fout, "\tdefault:\n"); printerr("noproc", TRANSP); f_print(fout, "\t\treturn;\n"); f_print(fout, "\t}\n"); f_print(fout, "\tmemset(&%s, 0, sizeof(%s));\n", ARG, ARG); printif("getargs", TRANSP, "&", ARG); printerr("decode", TRANSP); f_print(fout, "\t\treturn;\n"); f_print(fout, "\t}\n"); f_print(fout, "\t%s = (*%s)(&%s, %s);\n", RESULT, ROUTINE, ARG, RQSTP); f_print(fout, "\tif (%s != NULL && !svc_sendreply(%s, xdr_%s, %s)) {\n", RESULT, TRANSP, RESULT, RESULT); printerr("systemerr", TRANSP); f_print(fout, "\t}\n"); printif("freeargs", TRANSP, "&", ARG); f_print(fout, "\t\tfprintf(stderr, \"unable to free arguments\\n\");\n"); f_print(fout, "\t\texit(1);\n"); f_print(fout, "\t}\n"); f_print(fout, "}\n\n"); } }
void StackVisitor::Frame::print(int indentLevel) { int i = indentLevel; if (!this->callFrame()) { printif(i, "frame 0x0\n"); return; } CodeBlock* codeBlock = this->codeBlock(); printif(i, "frame %p {\n", this->callFrame()); CallFrame* callFrame = m_callFrame; CallFrame* callerFrame = this->callerFrame(); void* returnPC = callFrame->hasReturnPC() ? callFrame->returnPC().value() : nullptr; printif(i, " name '%s'\n", functionName().utf8().data()); printif(i, " sourceURL '%s'\n", sourceURL().utf8().data()); #if ENABLE(DFG_JIT) printif(i, " isInlinedFrame %d\n", isInlinedFrame()); if (isInlinedFrame()) printif(i, " InlineCallFrame %p\n", m_inlineCallFrame); #endif printif(i, " callee %p\n", callee()); printif(i, " returnPC %p\n", returnPC); printif(i, " callerFrame %p\n", callerFrame); unsigned locationRawBits = callFrame->locationAsRawBits(); printif(i, " rawLocationBits %u 0x%x\n", locationRawBits, locationRawBits); printif(i, " codeBlock %p\n", codeBlock); if (codeBlock) { JITCode::JITType jitType = codeBlock->jitType(); if (callFrame->hasLocationAsBytecodeOffset()) { unsigned bytecodeOffset = callFrame->locationAsBytecodeOffset(); printif(i, " bytecodeOffset %u %p / %zu\n", bytecodeOffset, reinterpret_cast<void*>(bytecodeOffset), codeBlock->instructions().size()); #if ENABLE(DFG_JIT) } else { unsigned codeOriginIndex = callFrame->locationAsCodeOriginIndex(); printif(i, " codeOriginIdex %u %p / %zu\n", codeOriginIndex, reinterpret_cast<void*>(codeOriginIndex), codeBlock->codeOrigins().size()); #endif } unsigned line = 0; unsigned column = 0; computeLineAndColumn(line, column); printif(i, " line %d\n", line); printif(i, " column %d\n", column); printif(i, " jitType %d <%s> isOptimizingJIT %d\n", jitType, jitTypeName(jitType), JITCode::isOptimizingJIT(jitType)); #if ENABLE(DFG_JIT) printif(i, " hasCodeOrigins %d\n", codeBlock->hasCodeOrigins()); if (codeBlock->hasCodeOrigins()) { JITCode* jitCode = codeBlock->jitCode().get(); printif(i, " jitCode %p start %p end %p\n", jitCode, jitCode->start(), jitCode->end()); } #endif } printif(i, "}\n"); }