Exemplo n.º 1
0
Arquivo: x86.go Projeto: tsavola/wag
func (mach X86) OpInit(code gen.OpCoder, startAddr int32) (retAddr int32) {
	if code.Len() == 0 || code.Len() > functionAlignment {
		panic("inconsistency")
	}
	code.Align(functionAlignment, paddingByte)
	Add.opImm(code, types.I64, regStackLimit, gen.StackReserve)

	var notResume links.L

	Test.opFromReg(code, types.I64, regResult, regResult)
	Je.rel8.opStub(code)
	notResume.AddSite(code.Len())
	Ret.op(code) // simulate return from snapshot function call

	notResume.Addr = code.Len()
	mach.updateBranches8(code, &notResume)

	CallRel.op(code, startAddr)
	return code.Len()
}