Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,9 @@ bar", 127 } }, 0 }, // Newline
{ "if 1 == 1 then $a = 3; end", { "[1]$a = 3", 107 }, { "[1]$a = 3", 107 }, 0 },
{ "if 1 == 1 then $a = 3.1; $b = $a; end", { "[1]$a = 3.1[1]$b = 3.1", 134 }, { "[1]$a = 3.1[1]$b = 3.1", 134 }, 0 },
{ "if 1 == 1 then $a = $a + 1; end", { "[1]$a = 2", 111 }, { "[1]$a = 2", 111 }, 0 },
{ "if 1 == 1 then $a = 1; print($a); end", { "[1]$a = 1", 123 }, { "[1]$a = 1", 123 }, 0 },
{ "if 1 == 1 then $a = 1; print($a); end", { "[1]$a = 1", 119 }, { "[1]$a = 1", 119 }, 0 },
{ "if 1 == 1 then $a = 1; $b = 1.2; print($a, '-', $b, '-', $c); end", { "[1]$a = 1[1]$b = 1.2", 231 }, { "[1]$a = 1[1]$b = 1.2", 231 }, 0 },
{ "if 1 == 1 then $a = 1; max($a); end", { "[1]$a = 1", 123 }, { "[1]$a = 1", 123 }, 0 },
{ "if 1 == 1 then $a = 1; max($a); end", { "[1]$a = 1", 119 }, { "[1]$a = 1", 119 }, 0 },
{ "if 1 == 1 then $a = max(foo#bar); end", { "[1]$a = 3", 139 }, { "[1]$a = 3", 139 }, 0 },
{ "if 1 == 1 then $a = max(foo#bar, 4); end", { "[1]$a = 4", 151 }, { "[1]$a = 4", 151 }, 0 },
{ "if 1 == 1 then $a = max(foo#bar, 4, 5.5); end", { "[1]$a = 5.5", 159 }, { "[1]$a = 5.5", 159 }, 0 },
Expand Down Expand Up @@ -425,7 +425,7 @@ bar", 127 } }, 0 }, // Newline
{ "if 3 == 3 then $a = max(1, 2, 3, 4); end", { "[1]$a = 4", 139 }, { "[1]$a = 4", 139 }, 0 },
{ "if 3 == 3 then $a = max(1, 4, 5, 3, 2); end", { "[1]$a = 5", 147 }, { "[1]$a = 5", 147 }, 0 },
{ "if 3 == 3 then $a = max(max(1, 4), 2); end", { "[1]$a = 4", 147 }, { "[1]$a = 4", 147 }, 0 },
{ "if 3 == 3 then max(max(1, 4), 2); end", { "", 128 }, { "", 128 }, 0 },
{ "if 3 == 3 then max(max(1, 4), 2); end", { "", 124 }, { "", 124 }, 0 },
{ "if 3 == 3 then max(2); min(2); end", { "", 108 }, { "", 108 }, 0 },
{ "if 3 == 3 then max(2); min(2); max(3); end", { "", 120 }, { "", 120 }, 0 },
{ "if 3 == 3 then max($a, 4, 2); $b = max(1, 3); end", { "[1]$b = 3", 174 }, { "[1]$b = 3", 174 }, 0 },
Expand Down Expand Up @@ -538,7 +538,7 @@ bar", 127 } }, 0 }, // Newline
{ "on foo($a, $b) then $a = $b; end if 3 == 3 then foo(1); $b = 3; end ", { { "[1]$a = NULL[1]$b = NULL", 142 }, { "[1]$a = NULL[1]$b = NULL[2]$b = 3", 198 } }, { { "[1]$a = NULL[1]$b = NULL", 202 }, { "[1]$a = NULL[1]$b = NULL[2]$b = 3", 202 } }, 0 },
{ "on foo($a, $c) then $a = $c; end if 3 == 3 then foo(NULL, 1); $b = 3; end ", { { "[1]$a = NULL[1]$c = NULL", 142 }, { "[1]$a = 1[1]$c = 1[2]$b = 3", 225 } }, { { "[1]$a = NULL[1]$c = NULL", 202 }, { "[1]$a = 1[1]$c = 1[2]$b = 3", 202 } }, 0 },
{ "if 3 == 3 then foo(1, 2); $b = 3; end ", { "[1]$b = 3", 147 }, { "[1]$b = 3", 147 }, 0 },
{ "if 3 == 3 then $a = 1; foo($a, 2); end", { { "[1]$a = 1", 155 }, { "[1]$a = 1", 155 } }, { { "[1]$a = 1", 155 }, { "[1]$x = 1[1]$y = 2[1]$z = 3", 202 } }, 0 },
{ "if 3 == 3 then $a = 1; foo($a, 2); end", { { "[1]$a = 1", 151 }, { "[1]$a = 1", 155 } }, { { "[1]$a = 1", 155 }, { "[1]$x = 1[1]$y = 2[1]$z = 3", 202 } }, 0 },
{ "on foo($b, $c) then $a = $b + $c; end if 3 == 3 then $a = 1; $b = 2; foo($a, $b); end ", { { "[1]$b = NULL[1]$c = NULL[1]$a = NULL", 173 }, { "[1]$b = 1[1]$c = 2[1]$a = 3[2]$a = 1[2]$b = 2", 241 } }, { { "[1]$b = NULL[1]$c = NULL[1]$a = NULL", 202 }, { "[1]$b = 1[1]$c = 2[1]$a = 3[2]$a = 1[2]$b = 2", 202 } }, 0 },
{ "on foo($a, $b) then $a = $b; end if 3 == 3 then foo(1, 5); $b = 3; end ", { { "[1]$a = NULL[1]$b = NULL", 142 }, { "[1]$a = 5[1]$b = 5[2]$b = 3", 206 } }, { { "[1]$a = NULL[1]$b = NULL", 202 }, { "[1]$a = 5[1]$b = 5[2]$b = 3", 202 } }, 0 },
{ "on foo then max(1, 2); end", { "", 108 }, { "", 108 }, 0 },
Expand All @@ -554,13 +554,13 @@ bar", 127 } }, 0 }, // Newline
{ "on foo then if 5 == 6 then $a = 1; end if 1 == 3 then $b = 3; end $a = 2; end", { "[1]$a = 2[1]$b = 3", 174 }, { "[1]$a = 2", 174 }, 0 },
{ "if 1 == 1 then $a = 1; else $a = min(1, 2, 3); end", { "[1]$a = 1", 139 }, { "[1]$a = 1", 139 }, 0 },
{ "if 1 == 1 then $a = 1; else $a = min(max(1, 2), 2, 3); end", { "[1]$a = 2", 155 }, { "[1]$a = 1", 155 }, 0 },
{ "on bar then $a = 1; end on foo then $b = max(1, 2); bar(); end if 3 == 3 then foo(); $a = min(1, 2); end", { { "[1]$a = 1", 111 }, { "[1]$a = 1[2]$b = 2", 226 }, { "[1]$a = 1[2]$b = 2[3]$a = 1", 274 } }, { { "[1]$a = 1", 16 }, { "[1]$a = 1[2]$b = 2", 16 }, { "[1]$a = 1[2]$b = 2[3]$a = 1", 16 } }, 0 },
{ "on bar then $a = 1; end on foo then $b = max(1, 2); bar(); end if 3 == 3 then foo(); $a = min(1, 2); end", { { "[1]$a = 1", 111 }, { "[1]$a = 1[2]$b = 2", 222 }, { "[1]$a = 1[2]$b = 2[3]$a = 1", 274 } }, { { "[1]$a = 1", 16 }, { "[1]$a = 1[2]$b = 2", 16 }, { "[1]$a = 1[2]$b = 2[3]$a = 1", 16 } }, 0 },
{ "on foo then if max(1) == max(1) then $a = 1; end end", { "[1]$a = 1", 143 }, { "[1]$a = 1", 143 }, 0 },
{ "on foo then if max($c) == 3 && max($a) then $a = 1; end end", { "[1]$a = 1", 178 }, { "[1]$a = 1", 178 }, 0 },
{ "on foo then $a = 6; end if 3 == 3 then $b = 3; end ", { { "[1]$a = 6", 111 }, { "[2]$b = 3", 182 } }, { { "[1]$a = 6", 111 }, { "[2]$b = 3", 111 } }, 0 },
{ "on foo then $a = 6; end if 3 == 3 then foo(); $b = 3; end ", { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 190 } }, { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 111 } }, 0 },
{ "on foo then $a = 6; end if 3 == 3 then $b = 3; foo(); end ", { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 190 } }, { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 190 } }, 0 },
{ "on foo then $a = 6; end if 3 == 3 then foo(max(1, 2), 2); $b = 3; end ", { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 226 } }, { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 147 } }, 0 },
{ "on foo then $a = 6; end if 3 == 3 then foo(max(1, 2), 2); $b = 3; end ", { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 222 } }, { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 147 } }, 0 },
{ "on foo then $a = 6; end if 3 == 3 then foo(1, 2); $b = 3; end ", { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 206 } }, { { "[1]$a = 6", 111 }, { "[1]$a = 6[2]$b = 3", 147 } }, 0 },
{ "on foo then $a = coalesce($b, 0); end ", { { "[1]$a = 2", 154 } }, { { "[1]$a = 2", 154 } }, 0 }, // FIXME
{ "on foo then if 1 == 2 then $a = 1; elseif 2 == 2 then $a = 3; else $a = 2; end end", { "[1]$a = 2", 155 }, { "[1]$a = 3", 139 }, 0 },
Expand All @@ -576,13 +576,16 @@ bar", 127 } }, 0 }, // Newline
{ "on foo then $a = 1; end if 3 == 3 then $a = 'foo'; end", { { "[1]$a = 1", 111 }, { "[2]$a = foo", 163 } }, { { "[1]$a = 1", 111 }, { "[2]$a = foo", 202 } }, 0 },
{ "if 1 == 1 then $a = 1; $b = 2; $aa = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.1; $bb = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.2; $cc = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.3; $dd = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.4; $dd = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.5; $ee = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.6; $ff = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.7; $ff = round($a / (($b * 230) + 50) * 10) / 10; $b = 2.8; $gg = round($a / (($b * 230) + 50) * 10) / 10; end", { "[1]$a = 1[1]$b = 2.8[1]$aa = 0[1]$bb = 0[1]$cc = 0[1]$dd = 0[1]$ee = 0[1]$ff = 0[1]$gg = 0", 710 }, { "[1]$a = 1[1]$b = 2.8[1]$aa = 0[1]$bb = 0[1]$cc = 0[1]$dd = 0[1]$ee = 0[1]$ff = 0[1]$gg = 0", 710 }, 0 },
{ "on foo then coalesce(10, 5); $a = 1; $b = 2; if $c == 12 && $d == 0 then $e = 1; end", { "[1]$a = 1[1]$b = 2[1]$e = 1", 263 }, { "[1]$a = 1[1]$b = 2", 263 }, 0 },
{ "on foo($a, $b) then print($a); $b = 1; end", { "[1]$a = NULL[1]$b = 1", 162 }, { "[1]$a = NULL[1]$b = 1", 158 }, 0 },
{ "on foo then print($a); $b = 1; end", { "[1]$b = 1", 154 }, { "[1]$b = 1", 150 }, 0 },
{ "on sub2($a) then print($a); $b = $a; end if 1 == 1 then print($a); sub2(2); end", { { "[1]$a = NULL[1]$b = NULL", 159 }, { "[1]$a = 2[1]$b = 2", 215 } }, { { "[1]$a = NULL[1]$b = NULL", 128 },{ "[1]$a = 2[1]$b = 2", 215 } }, 0 },
{ "on foo($a, $b) then print($a); $b = 1; end", { "[1]$a = NULL[1]$b = 1", 158 }, { "[1]$a = NULL[1]$b = 1", 158 }, 0 },
{ "on foo then print($a); $b = 1; end", { "[1]$b = 1", 150 }, { "[1]$b = 1", 150 }, 0 },
{ "on sub2($a) then print($a); $b = $a; end if 1 == 1 then print($a); sub2(2); end", { { "[1]$a = NULL[1]$b = NULL", 159 }, { "[1]$a = 2[1]$b = 2", 211 } }, { { "[1]$a = NULL[1]$b = NULL", 128 },{ "[1]$a = 2[1]$b = 2", 215 } }, 0 },
{ "on sub2($a) then print($a); $c = $a + 1; end on sub1($a) then print($a); sub2($a + 1); $b = $a - 1; end if 1 == 1 then sub1(1); end", { { "[1]$a = NULL[1]$c = NULL", 167 }, { "[1]$a = NULL[1]$c = NULL[2]$a = NULL[2]$b = NULL", 271 }, { "[1]$a = 2[1]$c = 3[2]$a = 1[2]$b = 0", 271 } }, { { "[1]$a = NULL[1]$c = NULL", 128 }, { "[1]$a = NULL[1]$c = NULL[2]$a = NULL[2]$b = NULL", 196 }, { "[1]$a = 2[1]$c = 3[2]$a = 1[2]$b = 0", 196 } }, 0 },
{ "if 1 == 1 then $a = 1; $b = 1; $c = 1; $d = 1; $e = 1; $f = 1; $g = 1; $h = 1; $i = 1; $j = 1; $k = 1; $l = 1; $m = 1; $n = 1; $o = 1; $p = 1; $q = 1; $r = 1; $s = 1; $t = 1; $u = 1; $v = 1; $w = 1; $x = 1; $y = 1; $z = 1; $aa = 1; $ab = 1; $ac = 1; $ad = 1; $ae = 1; $af = 1; $ag = 1; $ah = 1; $aj = 1; $aj = 1; $ak = 1; $al = 1; $am = 1; $an = 1; $ao = 1; $ap = 1; $aq = 1; $ar = 1; $as = 1; $at = 1; $au = 1; $av = 1; $aw = 1; $ax = 1; $ay = 1; $az = 1; $ba = 1; $bb = 1; $bc = 1; $bd = 1; $be = 1; $bf = 1; $bg = 1; $bh = 1; $bj = 1; $bj = 1; $bk = 1; $bl = 1; $bm = 1; $bn = 1; $bo = 1; $bp = 1; $bq = 1; $br = 1; $bs = 1; $bt = 1; $bu = 1; $bv = 1; $bw = 1; $bx = 1; $by = 1; $bz = 1; $ca = 1; $cb = 1; $cc = 1; $cd = 1; $ce = 1; $cf = 1; $cg = 1; $ch = 1; $cj = 1; $cj = 1; $ck = 1; $cl = 1; $cm = 1; $cn = 1; $co = 1; $cp = 1; $cq = 1; $cr = 1; $cs = 1; $ct = 1; $cu = 1; $cv = 1; $cw = 1; $cx = 1; $cy = 1; $cz = 1; $da = 1; $db = 1; $dc = 1; $dd = 1; $de = 1; $df = 1; $dg = 1; $dh = 1; $dj = 1; end", { { "[1]$de = 1[1]$df = 1[1]$dg = 1[1]$dh = 1[1]$dj = 1", 2706 } }, { { "[1]$de = 1[1]$df = 1[1]$dg = 1[1]$dh = 1[1]$dj = 1", 0 } }, 0 },
{ "on sub2 then sub1(1); end on sub1($a) then print($a); end on sub3 then sub2(); end", { { "", 122 }, { "[2]$a = NULL", 193 }, { "[2]$a = 1", 234 } }, { { "", 128 },{ "[2]$a = NULL", 215 }, { "[2]$a = 1", 233 } }, 0 },
{ "on System#Boot then max(10, 20); end on timer=10 then $Z = 3.5; $T = max(3 + 0.5); max(10, 2); if $T == $Z then $Z = 2; end end", { { "", 116 }, { "[2]$Z = 2[2]$T = 3.5", 283 } }, { { "", 134 }, { "[2]$Z = 2[2]$T = 3.5", 358 } }, 0 },
{ "on sub2 then sub1(1); end on sub1($a) then print($a); end on sub3 then sub2(); end", { { "", 122 }, { "[2]$a = NULL", 189 }, { "[2]$a = 1", 234 } }, { { "", 128 },{ "[2]$a = NULL", 215 }, { "[2]$a = 1", 233 } }, 0 },
{ "on System#Boot then max(10, 20); end on timer=10 then $Z = 3.5; $T = max(3 + 0.5); max(10, 2); if $T == $Z then $Z = 2; end end", { { "", 116 }, { "[2]$Z = 2[2]$T = 3.5", 291 } }, { { "", 134 }, { "[2]$Z = 2[2]$T = 3.5", 358 } }, 0 },
{ "on foo then $x = 1; end on bar then if $a == 1 then foo(); if $b >= 9 && $b < 18 then $c = 1; end end end", { { "[1]$x = 1", 111 }, { "[1]$x = 1[2]$c = 1", 292 } }, { { "[1]$x = 1", 0 }, { "[1]$x = 1", 0 } }, 0 },
{ "on foo then max(1, 2); end on timer=1 then if $a > 0 then foo(); end max(1, 2); end", { { "", 108 }, { "", 219 } }, { { "", 167 }, { "", 151 } }, 0 },
{ "if 1 == 1 then if 2 == 2 then foo(1); else foo(2); end end on foo($b) then $a = $b; end ", { { "", 156 }, { "[2]$b = NULL[2]$a = NULL", 194 } }, { { "", 167 }, { "[2]$b = NULL[2]$a = NULL", 151 } }, 0 },

/*
* Invalid rules
Expand Down
46 changes: 37 additions & 9 deletions src/rules/rules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2024,6 +2024,7 @@ static void bc_assign_slots(struct rules_t *obj) {
}
}
end = a;
start = end;

for(a=end;a<getval(obj->bc.nrbytes);a = bc_next(obj, a)) {
if(a == -1) {
Expand Down Expand Up @@ -2202,6 +2203,9 @@ static void bc_assign_slots(struct rules_t *obj) {
if(gettype(obj->bc.buffer[a]) == OP_CLEAR) {
continue;
}
if(gettype(obj->bc.buffer[a]) == OP_CALL && getval(x->a) == 0) {
continue;
}
if(d >= min) {
if(tmp > 0 && gettype(obj->bc.buffer[a]) == OP_CALL &&
gettype(obj->bc.buffer[tmp]) != OP_CLEAR) {
Expand Down Expand Up @@ -3359,6 +3363,14 @@ static int16_t rule_create(char **text, struct rules_t *obj) {
case TEVENT:
case TFUNCTION:
case LPAREN: {
/*
* A call/expression statement is followed by a sibling
* statement (nested if, event, or function call) rather
* than closing the block. Reset mathcnt here too, for the
* same reason as the TEND case below (#894): otherwise it
* leaks into the next statement's slot allocation.
*/
mathcnt = 0;
go = type;
ret = TIF;
continue;
Expand All @@ -3376,6 +3388,14 @@ static int16_t rule_create(char **text, struct rules_t *obj) {
return -1;
/* LCOV_EXCL_STOP*/
}
/*
* A call/expression statement closes this if-block. Reset the
* temporary slot counter so a following sibling if-condition
* starts fresh. Otherwise mathcnt leaks across the block and
* bc_parse_math_order's backward slot search overshoots into
* this block, relocating its trailing logical operator (#894).
*/
mathcnt = 0;
go = TEND;
ret = TIF;
continue;
Expand Down Expand Up @@ -5386,10 +5406,14 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
/*LCOV_EXCL_STOP*/

if(rule_prepare((char **)&input->payload, &bcsize, &heapsize, &varsize, &memsize, &newlen) == -1 ||
(varsize/sizeof(struct vm_vchar_t)) > INT8_MAX) {
(varsize/sizeof(struct vm_vchar_t)) > INT8_MAX ||
((varstack->nrbytes + varsize) / sizeof(struct vm_vchar_t)) > INT8_MAX) {
if(varsize/sizeof(struct vm_vchar_t) > INT8_MAX) {
logprintf_P(F("ERROR: maximum number of 127 variables reached"));
}
if((varstack->nrbytes + varsize) / sizeof(struct vm_vchar_t) > INT8_MAX) {
logprintf_P(F("ERROR: maximum number of 127 variables reached"));
}
if((*rules = (struct rules_t **)REALLOC(*rules, sizeof(struct rules_t **)*((*nrrules)))) == NULL) {
OUT_OF_MEMORY
}
Expand Down Expand Up @@ -5519,15 +5543,16 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
timestamp.second = micros();

logprintf_P(F("rule #%d bytecode was created in %d microseconds"), getval(obj->nr), timestamp.second - timestamp.first);
logprintf_P(F("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes"),
logprintf_P(F("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %d/127"),
getval(obj->bc.nrbytes),
getval(obj->bc.bufsize),
getval(obj->heap->nrbytes),
getval(obj->heap->bufsize),
((stack == NULL) ? 0 : getval(stack->nrbytes)),
((stack == NULL) ? 0 : getval(stack->bufsize)),
((varstack->nrbytes == 0) ? 0 : varstack->nrbytes),
(varstack->bufsize)
(varstack->bufsize),
varstack->nrbytes / sizeof(struct vm_vchar_t)
);
#else
clock_gettime(CLOCK_MONOTONIC, &timestamp.second);
Expand All @@ -5536,15 +5561,16 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
((double)timestamp.second.tv_sec + 1.0e-9*timestamp.second.tv_nsec) -
((double)timestamp.first.tv_sec + 1.0e-9*timestamp.first.tv_nsec));

printf("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes\n",
printf("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %lu/127\n",
getval(obj->bc.nrbytes),
getval(obj->bc.bufsize),
getval(obj->heap->nrbytes),
getval(obj->heap->bufsize),
((stack == NULL) ? 0 : getval(stack->nrbytes)),
((stack == NULL) ? 0 : getval(stack->bufsize)),
((varstack->nrbytes == 0) ? 0 : varstack->nrbytes),
(varstack->bufsize)
(varstack->bufsize),
varstack->nrbytes / sizeof(struct vm_vchar_t)
);
#endif
/*LCOV_EXCL_STOP*/
Expand Down Expand Up @@ -5595,15 +5621,16 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
timestamp.second = micros();

logprintf_P(F("rule #%d was executed in %d microseconds"), getval(obj->nr), timestamp.second - timestamp.first);
logprintf_P(F("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes"),
logprintf_P(F("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %d/127"),
getval(obj->bc.nrbytes),
getval(obj->bc.bufsize),
getval(obj->heap->nrbytes),
getval(obj->heap->bufsize),
((stack == NULL) ? 0 : getval(stack->nrbytes)),
((stack == NULL) ? 0 : getval(stack->bufsize)),
((varstack->nrbytes == 0) ? 0 : varstack->nrbytes),
(varstack->bufsize)
(varstack->bufsize),
varstack->nrbytes / sizeof(struct vm_vchar_t)
);
#else
clock_gettime(CLOCK_MONOTONIC, &timestamp.second);
Expand All @@ -5612,15 +5639,16 @@ int8_t rule_initialize(struct pbuf *input, struct rules_t ***rules, uint8_t *nrr
((double)timestamp.second.tv_sec + 1.0e-9*timestamp.second.tv_nsec) -
((double)timestamp.first.tv_sec + 1.0e-9*timestamp.first.tv_nsec));

printf("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack %d/%d bytes\n",
printf("bytecode: %d/%d, heap: %d/%d, stack: %d/%d bytes, varstack: %d/%d bytes, varstack slots: %lu/127\n",
getval(obj->bc.nrbytes),
getval(obj->bc.bufsize),
getval(obj->heap->nrbytes),
getval(obj->heap->bufsize),
((stack == NULL) ? 0 : getval(stack->nrbytes)),
((stack == NULL) ? 0 : getval(stack->bufsize)),
((varstack->nrbytes == 0) ? 0 : varstack->nrbytes),
(varstack->bufsize)
(varstack->bufsize),
varstack->nrbytes / sizeof(struct vm_vchar_t)
);
#endif
/*LCOV_EXCL_STOP*/
Expand Down
Loading