mruby/mruby — pull request #1338 by kyab (2013-07-03 14:22:52+00:00)
Title: ROM-able ISEQ revisited

This is second version of #808. Related issues are #944, #964.

In my environment(using default gembox),
total heap allocation till end of mrb_open() was reduced around 13kb (183514bytes to 170654bytes).

* Bytecode format now has endian field.
* mrbc has new option ```-E```. Only effective with -B(C-func).
* Default for ```-E``` is "neutral", which means copy all iseq(same as current).
* In build_config, you can specify ```endian :little```, or ```endian :big``` in each target. This value is used for ```-E``` option on running mrbc.
* Currently CRC are checked even for C-func. I would skip CRC check if it is OK.
* I do not have Big-endian device. Only little endian was tested.

test code.
```c
#include
#include

#include "mruby.h"

size_t total = 0;

void *myallocf(mrb_state *mrb, void *p, size_t size, void *ud){
if (size == 0){
free(p);
return NULL;
}else{
//printf("alloc size=%ld, p=%p\n",size,p);
total += size;
void *ret = realloc(p, size);
return ret;
}
}

int main(int argc, const char * argv[])
{
mrb_state *mrb = mrb_open_allocf(myallocf, NULL);
printf("total : %zu bytes\n", total);
mrb_close(mrb);

return 0;
}

```