internal static unsafe void ConstructIL(RuntimeIshtarMethod method, byte[] body, short stacksize, RuntimeIshtarModule module) { var offset = 0; var body_r = ILReader.Deconstruct(body, &offset, method); var labels = ILReader.DeconstructLabels(body, &offset); var exceptions = ILReader.DeconstructExceptions(body, offset, module); method.Header.max_stack = stacksize; method.Header.exception_handler_list = exceptions; method.Header.code = (uint *)Marshal.AllocHGlobal(sizeof(uint) * body_r.opcodes.Count); for (var i = 0; i != body_r.opcodes.Count; i++) { method.Header.code[i] = body_r.opcodes[i]; } method.Header.code_size = (uint)body_r.opcodes.Count; method.Header.labels = labels; method.Header.labels_map = body_r.map.ToDictionary(x => x.Key, x => new ILLabel { opcode = x.Value.opcode, pos = x.Value.pos }); }