Example #1
0
File: bf.go Project: tizgrape/gojit
func emitRbrac(asm *amd64.Assembler, cc *compiled) {
	header := cc.stack[len(cc.stack)-1]
	cc.stack = cc.stack[:len(cc.stack)-1]
	asm.JmpRel(gojit.Addr(asm.Buf[header:]))
	end := asm.Off

	asm.Off = header
	asm.Testb(amd64.Imm{0xff}, amd64.Indirect{amd64.Rax, 0, 8})
	asm.JccRel(amd64.CC_Z, gojit.Addr(asm.Buf[end:]))
	asm.Off = end
}
Example #2
0
File: bf.go Project: tizgrape/gojit
func jcc(a *amd64.Assembler, cc byte, over func(*amd64.Assembler)) {
	start := a.Off
	a.JccShort(cc, 0)
	base := a.Off
	over(a)
	end := a.Off
	a.Off = start
	if int(int8(end-base)) != end-base {
		panic("jcc: too far!")
	}
	a.JccShort(cc, int8(end-base))
	a.Off = end
}