Exemple #1
0
 protected void EnsureCapacity(int n)
 {
     if ((ip + n) >= instrs.Length)
     {
         // ensure room for full instruction
         byte[] c = new byte[instrs.Length * 2];
         Array.Copy(instrs, 0, c, 0, instrs.Length);
         instrs = c;
         Interval[] sm = new Interval[sourceMap.Length * 2];
         Array.Copy(sourceMap, 0, sm, 0, sourceMap.Length);
         sourceMap = sm;
     }
 }
Exemple #2
0
 public void Emit(short opcode, int sourceStart, int sourceStop)
 {
     EnsureCapacity(1);
     if (!(sourceStart < 0 || sourceStop < 0))
         sourceMap[ip] = new Interval(sourceStart, sourceStop);
     instrs[ip++] = (byte)opcode;
 }