Esempio n. 1
0
 /**
  * Append another list to this one. Consumes argument list, i.e., it becomes empty.
  *
  * @param il list to append to end of this list
  * @return instruction handle of the <B>first</B> appended instruction
  */
 public InstructionHandle append(InstructionList il) {
   if (il == null) {
     throw new ClassGenException("Appending null InstructionList");
   }
   if (il.isEmpty()) {
     return null;
   }
   if (isEmpty()) {
     start = il.start;
     end = il.end;
     length = il.length;
     il.clear();
     return start;
   } else {
     return append(end, il); // was end.instruction
   }
 }
Esempio n. 2
0
 /**
  * Insert another list before Instruction handle ih contained in this list. Consumes argument
  * list, i.e., it becomes empty.
  *
  * @param ih where to append the instruction list
  * @param il Instruction list to insert
  * @return instruction handle of the first inserted instruction
  */
 public InstructionHandle insert(InstructionHandle ih, InstructionList il) {
   if (il == null) {
     throw new ClassGenException("Inserting null InstructionList");
   }
   if (il.isEmpty()) {
     return ih;
   }
   InstructionHandle prev = ih.prev, ret = il.start;
   ih.prev = il.end;
   il.end.next = ih;
   il.start.prev = prev;
   if (prev != null) {
     prev.next = il.start;
   } else {
     start = il.start; // Update start ...
   }
   length += il.length; // Update length
   il.clear();
   return ret;
 }
Esempio n. 3
0
 /**
  * Append another list after instruction (handle) ih contained in this list. Consumes argument
  * list, i.e., it becomes empty.
  *
  * @param ih where to append the instruction list
  * @param il Instruction list to append to this one
  * @return instruction handle pointing to the <B>first</B> appended instruction
  */
 public InstructionHandle append(InstructionHandle ih, InstructionList il) {
   if (il == null) {
     throw new ClassGenException("Appending null InstructionList");
   }
   if (il.isEmpty()) {
     return ih;
   }
   InstructionHandle next = ih.next, ret = il.start;
   ih.next = il.start;
   il.start.prev = ih;
   il.end.next = next;
   if (next != null) {
     next.prev = il.end;
   } else {
     end = il.end; // Update end ...
   }
   length += il.length; // Update length
   il.clear();
   return ret;
 }