mirror of
https://github.com/zeek/zeek.git
synced 2025-10-04 15:48:19 +00:00
script optimization fixes:
new initialization model for standalone C++ scripts type coercion fix ZAM fix for compiling using C++ optimizer disambiguate empty constructors
This commit is contained in:
parent
dbb2aa88a6
commit
134f8f2ef5
14 changed files with 80 additions and 96 deletions
|
@ -869,7 +869,13 @@ string CPPCompile::GenUnary(const Expr* e, GenType gt, const char* op, const cha
|
|||
if ( e->GetType()->Tag() == TYPE_VECTOR )
|
||||
return GenVectorOp(e, GenExpr(e->GetOp1(), GEN_NATIVE), vec_op);
|
||||
|
||||
return NativeToGT(string(op) + "(" + GenExpr(e->GetOp1(), GEN_NATIVE) + ")", e->GetType(), gt);
|
||||
// Look for coercions that the interpreter does implicitly.
|
||||
auto op1 = e->GetOp1();
|
||||
if ( op1->GetType()->Tag() == TYPE_COUNT &&
|
||||
(e->Tag() == EXPR_POSITIVE || e->Tag() == EXPR_NEGATE) )
|
||||
op1 = make_intrusive<ArithCoerceExpr>(op1, TYPE_INT);
|
||||
|
||||
return NativeToGT(string(op) + "(" + GenExpr(op1, GEN_NATIVE) + ")", e->GetType(), gt);
|
||||
}
|
||||
|
||||
string CPPCompile::GenBinary(const Expr* e, GenType gt, const char* op, const char* vec_op)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue