don't inline, to be friendly to js engine osr
| 14 | |
| 15 | // don't inline, to be friendly to js engine osr |
| 16 | void __attribute__ ((noinline)) doit(unsigned char *buffer, int size, int i) { |
| 17 | static unsigned char *buffer2 = NULL; |
| 18 | static unsigned char *buffer3 = NULL; |
| 19 | |
| 20 | unsigned long maxCompressedSize = compressBound(size); |
| 21 | |
| 22 | if (!buffer2) buffer2 = (unsigned char*)malloc(maxCompressedSize); |
| 23 | if (!buffer3) buffer3 = (unsigned char*)malloc(size); |
| 24 | |
| 25 | unsigned long compressedSize = maxCompressedSize; |
| 26 | compress(buffer2, &compressedSize, buffer, size); |
| 27 | if (i == 0) printf("sizes: %d,%d\n", size, (int)compressedSize); |
| 28 | |
| 29 | unsigned long decompressedSize = size; |
| 30 | uncompress(buffer3, &decompressedSize, buffer2, (int)compressedSize); |
| 31 | assert(decompressedSize == size); |
| 32 | if (i == 0) { |
| 33 | if (strcmp((char*)buffer, (char*)buffer3) != 0) { |
| 34 | puts("incorrect output!"); |
| 35 | abort(); |
| 36 | } |
| 37 | puts("output looks good"); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | int main(int argc, char **argv) { |
| 42 | int size, iters; |