int main() { dynamic test; // dynamic accept = (dynamic) test_function(test); void (*accept2)(dynamic *); accept2 = &test_function; accept2(&test); // test_function(&test); printf("\n Entered : %s", &test); return 0; }
TEST_F(HeaderTableTests, evict) { HPACKHeader accept("accept-encoding", "gzip"); HPACKHeader accept2("accept-encoding", "----"); // same size, different header HPACKHeader accept3("accept-encoding", "third"); // size is larger with 1 byte uint32_t max = 10; uint32_t capacity = accept.bytes() * max; HeaderTable table(capacity); // fill the table for (size_t i = 0; i < max; i++) { EXPECT_EQ(table.add(accept), true); } EXPECT_EQ(table.size(), max); EXPECT_EQ(table.add(accept2), true); // evict the first one EXPECT_EQ(table[1], accept2); auto ilist = table.names().find("accept-encoding")->second; EXPECT_EQ(ilist.size(), max); // evict all the 'accept' headers for (size_t i = 0; i < max - 1; i++) { EXPECT_EQ(table.add(accept2), true); } EXPECT_EQ(table.size(), max); EXPECT_EQ(table[max], accept2); EXPECT_EQ(table.names().size(), 1); // add an entry that will cause 2 evictions EXPECT_EQ(table.add(accept3), true); EXPECT_EQ(table[1], accept3); EXPECT_EQ(table.size(), max - 1); // add a super huge header string bigvalue; bigvalue.append(capacity, 'x'); HPACKHeader bigheader("user-agent", bigvalue); EXPECT_EQ(table.add(bigheader), false); EXPECT_EQ(table.size(), 0); EXPECT_EQ(table.names().size(), 0); }
void ForLoop::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitForLoop); }
void Closure::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitClosure); }
void Import::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitImport); }
void UnaryOperator::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitUnaryOperator); }
void StructDef::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitStruct); }
void Tuple::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitTuple); }
static void genextend(graph *g, int n2, int *deg, int ne, boolean rigid, int xlb, int xub) /* extend from n2 to n2+1 */ { int x,y,d; int *xorb,xc; int nx,i,j,imin,imax,dmax; int xlbx,xubx,n; graph gx[MAXN]; int degx[MAXN]; boolean rigidx; int dneed,need,nfeet,hideg,deg1,ft[MAXN],nfrag,frag[MAXN]; #ifdef INSTRUMENT boolean haschild; haschild = FALSE; ++nodes[n2]; if (rigid) ++rigidnodes[n2]; #endif n = n1 + n2; nx = n2 + 1; dmax = deg[n-1]; d = 0; dneed = mindeg1 - maxn2 + n2; need = 0; hideg = 0; deg1 = 0; for (i = 0; i < n1; ++i) { if (deg[i] == maxdeg1) d |= xbit[i]; if (deg[i] <= dneed) need |= xbit[i]; if (deg[i] >= 2) hideg |= xbit[i]; if (deg[i] == 1) deg1 |= xbit[i]; } if (xlb < XPOPCOUNT(need)) xlb = XPOPCOUNT(need); if (xlb > xub) return; imin = xstart[xlb]; imax = xstart[xub+1]; xorb = data[n2].xorb; if (nx == maxn2) { if (footfree) { nfeet = 0; for (j = 0; j < n2; ++j) { x = xval[j] & hideg; IFLE1BITS(x) ft[nfeet++] = xval[j] & deg1; } } if (cutfree) fragments(xval,n2,frag,&nfrag); for (i = imin; i < imax; ++i) { if (!rigid && xorb[i] != i) continue; x = xset[i]; xc = xcard[i]; if ((x & d) != 0) continue; if ((need & ~x) != 0) continue; if (simple) { for (j = n2; --j >= 0;) if (x == xval[j]) break; if (j >= 0) continue; } if (maxcommon >= 0) { for (j = n2; --j >= 0;) { y = x & xval[j]; if (XPOPCOUNT(y) > maxcommon) break; } if (j >= 0) continue; } if (antichain) { for (j = 0; j < n2; ++j) if ((xval[j] & ~x) == 0) break; if (j < n2) continue; } if (footfree) { y = x & (hideg | deg1); IFLE1BITS(y) continue; for (j = 0; j < nfeet; ++j) if ((x & ft[j]) == 0) break; if (j < nfeet) continue; } if (cutfree) { y = x & (hideg | deg1); IFLE1BITS(y) continue; for (j = 0; j < nfrag; ++j) if ((x & frag[j]) == 0) break; if (j < nfrag) continue; } xval[n2] = x; if (nx == nprune) { if (curres == 0) curres = mod; #ifdef SPLITTEST --curres; ++splitcases; continue; #else if (--curres != 0) continue; #endif } if (accept2(g,n2,x,gx,deg,xc > dmax)) if (!connec || isconnected(gx,n+1)) { ADDBIG(ecount[ne+xc],1); #ifdef INSTRUMENT haschild = TRUE; #endif (*outproc)(outfile,canonise ? gcan : gx,n1,n2+1); } } } else { for (i = imin; i < imax; ++i)
void ConditionalOperator::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitConditionalOperator); }
void DictionaryLiteral::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitDictionaryLiteral); }
void BreakStatement::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitBreak); }
void CaseStatement::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitCase); }
void ValueBindings::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitValueBindings); }
static void genextend(graph *g, int n, int *deg, boolean rigid) /* extend from n to n+1 -- version for general graphs */ { xword x,dlow,dhigh,dcrit; xword *xset,*xcard,*xorb; xword i,imin,imax; int nx,xc,j,dmax; int xlb,xub,xlbx,xubx; graph gx[MAXN]; int degx[MAXN]; boolean rigidx; boolean subconnec; #ifdef INSTRUMENT boolean haschild; haschild = FALSE; if (rigid) ++rigidnodes[n]; #endif nx = n + 1; ADDBIG(nodes[n],1); if (regular && nx == maxn) { x = 0; for (i = 0; i < n; ++i) if (deg[i] == maxdeg) x |= xbit[i]; if (accept2(g,n,x,gx,deg,FALSE)) { #ifdef PRUNE if (!PRUNE(gx,nx,maxn)) #endif { #ifdef INSTRUMENT haschild = TRUE; #endif ADDBIG(nout,1); (*outproc)(outfile,canonise ? gcan : gx,nx); } } #ifdef INSTRUMENT if (haschild) ++fertilenodes[n]; #endif return; } dmax = deg[n-1]; xlb = mindeg + n + 1 - maxn; if (0 > xlb) xlb = 0; xub = dmax+1; if (n/2 < xub) xub = n/2; if (maxdeg < xub) xub = maxdeg; if (xlb > xub) return; dlow = dcrit = dhigh = 0; for (i = 0; i < n; ++i) { if (deg[i] == dmax) dlow |= xbit[i]; if (deg[i] == maxdeg) dhigh |= xbit[i]; if (deg[i] == mindeg + n - maxn) dcrit |= xbit[i]; } if (XPOPCOUNT(dhigh) > xlb) xlb = XPOPCOUNT(dhigh); if (n-XPOPCOUNT(dcrit) < xub) xub = n - XPOPCOUNT(dcrit); if (xub == dmax+1 && XPOPCOUNT(dlow)+dmax >= n) --xub; if (xlb > xub) return; #ifdef PRUNE if (PRUNE(g,n,maxn)) return; #endif imin = data[n].xstart[xlb]; imax = data[n].xstart[xub+1]; xset = data[n].xset; xcard = data[n].xcard; xorb = data[n].xorb; if (nx == maxn) { subconnec = connec && isstrong(g,n); for (i = imin; i < imax; ++i) { if (!rigid && xorb[i] != i) continue; x = xset[i]; xc = xcard[i]; if (xc == dmax+1 && (x & dlow) != 0) continue; if ((dhigh & ~x) != 0) continue; if ((dcrit & x) != 0) continue; if (accept2(g,n,x,gx,deg, xc < dmax || (xc == dmax && (x & dlow) == 0))) if (!connec || (subconnec && x != 0) || isstrong(gx,nx)) { #ifdef PRUNE if (!PRUNE(gx,nx,maxn)) #endif { #ifdef INSTRUMENT haschild = TRUE; #endif ADDBIG(nout,1); (*outproc)(outfile,canonise ? gcan : gx,nx); } } } } else { for (i = imin; i < imax; ++i) { if (!rigid && xorb[i] != i) continue; x = xset[i]; xc = xcard[i]; if (xc == dmax+1 && (x & dlow) != 0) continue; if ((dhigh & ~x) != 0) continue; if ((dcrit & x) != 0) continue; if (nx == splitlevel) { if (odometer-- != 0) continue; odometer = mod - 1; } for (j = 0; j < n; ++j) degx[j] = deg[j]; xlbx = mindeg+nx+1-maxn; if (xlbx < 0) xlbx = 0; xubx = xc + 1; if (maxdeg < xubx) xubx = maxdeg; if (nx/2 < xubx) xubx = nx/2; if (xlbx > xubx) continue; data[nx].lo = data[nx].xstart[xlbx]; data[nx].hi = data[nx].xstart[xubx+1]; if (accept1(g,n,x,gx,degx,&rigidx)) { #ifdef INSTRUMENT haschild = TRUE; #endif genextend(gx,nx,degx,rigidx); } } } if (n == splitlevel-1 && n >= min_splitlevel && ISASBIG(nodes[n],multiplicity)) --splitlevel; #ifdef INSTRUMENT if (haschild) ++fertilenodes[n]; #endif }
void DefaultValue::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitDefaultValue); }
void ParameterNode::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitParameter); }
void IntegerLiteral::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitInteger); }
void InitializerDef::accept(NodeVisitor* visitor) { accept2(visitor, &NodeVisitor::visitInit); }