소스 검색

Fixed address of trap instruction at end of procedures that don't return values

The generated trap instruction is the last one of a procedure. If the system reports its successor when handling the trap, its address does not lie within the boundary of the procedure. This fix solves the problem by artificial appending dead code (i.e. another trap instruction for brevity)

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@8170 8c9fc860-2736-0410-a75d-ab315db34111
negelef 7 년 전
부모
커밋
70cb650d89
1개의 변경된 파일2개의 추가작업 그리고 0개의 파일을 삭제
  1. 2 0
      source/FoxIntermediateBackend.Mod

+ 2 - 0
source/FoxIntermediateBackend.Mod

@@ -1591,6 +1591,8 @@ TYPE
 				CallThis(position,"Runtime","Trap",1); 
 			ELSE
 				Emit(Trap(position,trapNo));
+				(* Artificially append code to keep address of the instruction following the trap at the end of procedure within its boundary *)
+				IF trapNo = ReturnTrap THEN Emit(Trap(position,NoReturnTrap)) END;
 			END;
 		END EmitTrap;