~rabbits/uxnlin

e5df93c30388a1b62bec1b00ae23a26025d7adf1 — Devine Lu Linvega 27 days ago da107ce
Catch dead regions
2 files changed, 23 insertions(+), 0 deletions(-)

M etc/example.tal
M src/uxnlin.tal
M etc/example.tal => etc/example.tal +2 -0
@@ 80,6 80,8 @@

BRK

#1234 ( dead region )

!label ( fall-through )

@label

M src/uxnlin.tal => src/uxnlin.tal +21 -0
@@ 165,6 165,12 @@ JMP2r
		;fall-through print-warn2
		&no-fall

	( dead-region )
	;token/last is-jump #00 EQU ?&no-dead
	;token is-static ;token is-opcode ORA #00 EQU ?&no-dead
		;dead-region print-warn2
		&no-dead

	&cleanup
	;token/last ;token/last2 scpy
	;token ;token/last scpy


@@ 198,6 204,18 @@ JMP2r
JMP2r
	&found POP2 POP2 #01 JMP2r

@is-jump ( str* -- flag )

	LDAk LIT "! EQU ?&pass
	DUP2 ;brk scmp ?&pass
	DUP2 ;jmp scmp ?&pass
	DUP2 ;jmp2 scmp ?&pass
	DUP2 ;jmp2r scmp ?&pass
	POP2 #00

JMP2r
	&pass POP2 #01 JMP2r

@is-litbyte ( str* -- flag )

	LDAk LIT "# EQU ?&continue


@@ 431,6 449,7 @@ JMP2r
@optimize "Optimize $1 ( bad design )
@tailcall "Tailcall $1 ( should be a jmi )
@fall-through "Fall-through $1 ( jumping to the next label )
@dead-region "Dead-region $1 ( unlabeled content after jumps )

( specifics )
	@inc "INC $1 @inc2 "INC2 $1


@@ 455,8 474,10 @@ JMP2r
	@sftk "SFTk $1
	@inck "INCk $1
	@inc2k "INC2k $1
	@brk "BRK $1
	@jmp "JMP $1
	@jmp2 "JMP2 $1
	@jmp2r "JMP2r $1
	@ora "ORA $1
	@nip "NIP $1 @nip2 "NIP2 $1
	@and "AND $1