diff --git a/perf/bigcode.c b/perf/bigcode.c index 0f444e0d6..2ffc253d5 100644 --- a/perf/bigcode.c +++ b/perf/bigcode.c @@ -9,6 +9,8 @@ #include #include +#include +#include #define FN_SIZE 996 // Must be big enough to hold the compiled f() #define N_LOOPS 20000 // Should be divisible by four @@ -28,13 +30,16 @@ int f(int x, int y) return y; } -static char a[FN_SIZE * N_LOOPS]; - int main(int argc, char* argv[]) { int h, i, sum1 = 0, sum2 = 0, sum3 = 0, sum4 = 0; int n_fns, n_reps; + char* a = mmap(0, FN_SIZE * N_LOOPS, + PROT_EXEC|PROT_WRITE, + MAP_PRIVATE|MAP_ANONYMOUS, 0,0); + assert(a != (char*)MAP_FAILED); + if (argc <= 1) { // Mode 1: not so much code n_fns = N_LOOPS / RATIO;