#NEWLINE# def _remove_nop_artifact( self , offset ) : #NEWLINE# #INDENT# for ( src , dst ) in self . computed_jump : #NEWLINE# #INDENT# if ( ( src < offset < dst ) or ( dst < offset < src ) ) : #NEWLINE# #INDENT# old_jmp = self . instrs [ src ] #NEWLINE# old_jump_size = len ( old_jmp . get_code ( ) ) #NEWLINE# if ( src < offset < dst ) : #NEWLINE# #INDENT# new_jmp = type ( old_jmp ) ( ( ( dst - src ) - 1 ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# new_jmp = type ( old_jmp ) ( ( ( dst - src ) + 1 ) ) #NEWLINE# #UNINDENT# new_jmp_size = len ( new_jmp . get_code ( ) ) #NEWLINE# if ( new_jmp_size > old_jump_size ) : #NEWLINE# #INDENT# raise ValueError ( 'Wtf jump of smaller size is bigger.. ABORT' ) #NEWLINE# #UNINDENT# self . instrs [ src ] = new_jmp #NEWLINE# for i in range ( ( old_jump_size - new_jmp_size ) ) : #NEWLINE# #INDENT# self . instrs [ ( ( src + new_jmp_size ) + i ) ] = _NopArtifact ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# for ( name , labeloffset ) in self . labels . items ( ) : #NEWLINE# #INDENT# if ( labeloffset > offset ) : #NEWLINE# #INDENT# self . labels [ name ] = ( labeloffset - 1 ) #NEWLINE# #UNINDENT# #UNINDENT# new_instr = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( instroffset , instr ) in self . instrs . items ( ) : #NEWLINE# #INDENT# if ( instroffset == offset ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if ( instroffset > offset ) : #NEWLINE# #INDENT# instroffset -= 1 #NEWLINE# #UNINDENT# new_instr [ instroffset ] = instr #NEWLINE# #UNINDENT# self . instrs = new_instr #NEWLINE# new_computed_jump = [ ] #NEWLINE# for ( src , dst ) in self . computed_jump : #NEWLINE# #INDENT# if ( src > offset ) : #NEWLINE# #INDENT# src -= 1 #NEWLINE# #UNINDENT# if ( dst > offset ) : #NEWLINE# #INDENT# dst -= 1 #NEWLINE# #UNINDENT# new_computed_jump . append ( ( src , dst ) ) #NEWLINE# #UNINDENT# self . computed_jump = new_computed_jump #NEWLINE# self . size -= 1