From 3b8932ff01ced4d586c4db63b15c070e29117bd8 Mon Sep 17 00:00:00 2001 From: Jon Siwek Date: Thu, 11 Apr 2019 19:31:37 -0700 Subject: [PATCH] bifcl: Update codegen to use faster val_list and event queue API --- tools/bifcl/builtin-func.y | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/tools/bifcl/builtin-func.y b/tools/bifcl/builtin-func.y index 40d0c76838..c2147fd540 100644 --- a/tools/bifcl/builtin-func.y +++ b/tools/bifcl/builtin-func.y @@ -230,15 +230,15 @@ void print_event_c_body(FILE *fp) fprintf(fp, "\t// allocation.\n"); fprintf(fp, "\n"); - fprintf(fp, "\tval_list* vl = new val_list;\n\n"); - BuiltinFuncArg *connection_arg = 0; + BuiltinFuncArg* connection_arg = 0; + + fprintf(fp, "\tmgr.QueueEventFast(%s, val_list{\n", decl.c_fullname.c_str()); for ( int i = 0; i < (int) args.size(); ++i ) { - fprintf(fp, "\t"); - fprintf(fp, "vl->append("); + fprintf(fp, "\t "); args[i]->PrintBroValConstructor(fp); - fprintf(fp, ");\n"); + fprintf(fp, ",\n"); if ( args[i]->Type() == TYPE_CONNECTION ) { @@ -254,9 +254,7 @@ void print_event_c_body(FILE *fp) } } - fprintf(fp, "\n"); - fprintf(fp, "\tmgr.QueueEvent(%s, vl, SOURCE_LOCAL, analyzer->GetID(), timer_mgr", - decl.c_fullname.c_str()); + fprintf(fp, "\t },\n\t SOURCE_LOCAL, analyzer->GetID(), timer_mgr"); if ( connection_arg ) // Pass the connection to the EventMgr as the "cookie"