本文整理汇总了Golang中github.com/TheJumpCloud/rsc/c2go/liblink.Link.Cursym方法的典型用法代码示例。如果您正苦于以下问题:Golang Link.Cursym方法的具体用法?Golang Link.Cursym怎么用?Golang Link.Cursym使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/TheJumpCloud/rsc/c2go/liblink.Link
的用法示例。
在下文中一共展示了Link.Cursym方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: follow
func follow(ctxt *liblink.Link, s *liblink.LSym) {
var firstp *liblink.Prog
var lastp *liblink.Prog
ctxt.Cursym = s
firstp = ctxt.Prg()
lastp = firstp
xfol(ctxt, s.Text, &lastp)
lastp.Link = nil
s.Text = firstp.Link
}
示例2: addstacksplit
func addstacksplit(ctxt *liblink.Link, cursym *liblink.LSym) {
var p *liblink.Prog
var q *liblink.Prog
var autoffset int64
var deltasp int64
var a int
if ctxt.Symmorestack[0] == nil {
ctxt.Symmorestack[0] = liblink.Linklookup(ctxt, "runtime.morestack", 0)
ctxt.Symmorestack[1] = liblink.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
}
if ctxt.Headtype == liblink.Hplan9 && ctxt.Plan9privates == nil {
ctxt.Plan9privates = liblink.Linklookup(ctxt, "_privates", 0)
}
ctxt.Cursym = cursym
if cursym.Text == nil || cursym.Text.Link == nil {
return
}
p = cursym.Text
autoffset = p.To.Offset
if autoffset < 0 {
autoffset = 0
}
cursym.Locals = autoffset
cursym.Args = p.To.Offset2
q = nil
if p.From.Scale&liblink.NOSPLIT == 0 || (p.From.Scale&liblink.WRAPPER != 0) {
p = liblink.Appendp(ctxt, p)
p = load_g_cx(ctxt, p) // load g into CX
}
if cursym.Text.From.Scale&liblink.NOSPLIT == 0 {
p = stacksplit(ctxt, p, autoffset, bool2int(cursym.Text.From.Scale&liblink.NEEDCTXT == 0), &q) // emit split check
}
if autoffset != 0 {
p = liblink.Appendp(ctxt, p)
p.As = AADJSP
p.From.Typ = D_CONST
p.From.Offset = autoffset
p.Spadj = autoffset
} else {
// zero-byte stack adjustment.
// Insert a fake non-zero adjustment so that stkcheck can
// recognize the end of the stack-splitting prolog.
p = liblink.Appendp(ctxt, p)
p.As = ANOP
p.Spadj = -ctxt.Arch.Ptrsize
p = liblink.Appendp(ctxt, p)
p.As = ANOP
p.Spadj = ctxt.Arch.Ptrsize
}
if q != nil {
q.Pcond = p
}
deltasp = autoffset
if cursym.Text.From.Scale&liblink.WRAPPER != 0 {
// g->panicwrap += autoffset + ctxt->arch->ptrsize;
p = liblink.Appendp(ctxt, p)
p.As = AADDL
p.From.Typ = D_CONST
p.From.Offset = autoffset + ctxt.Arch.Ptrsize
p.To.Typ = D_INDIR + D_CX
p.To.Offset = 2 * ctxt.Arch.Ptrsize
}
if ctxt.Debugzerostack != 0 && autoffset != 0 && cursym.Text.From.Scale&liblink.NOSPLIT == 0 {
// 8l -Z means zero the stack frame on entry.
// This slows down function calls but can help avoid
// false positives in garbage collection.
p = liblink.Appendp(ctxt, p)
p.As = AMOVL
p.From.Typ = D_SP
p.To.Typ = D_DI
p = liblink.Appendp(ctxt, p)
p.As = AMOVL
p.From.Typ = D_CONST
p.From.Offset = autoffset / 4
p.To.Typ = D_CX
p = liblink.Appendp(ctxt, p)
p.As = AMOVL
p.From.Typ = D_CONST
p.From.Offset = 0
p.To.Typ = D_AX
p = liblink.Appendp(ctxt, p)
p.As = AREP
p = liblink.Appendp(ctxt, p)
p.As = ASTOSL
}
for ; p != nil; p = p.Link {
a = p.From.Typ
if a == D_AUTO {
p.From.Offset += deltasp
}
if a == D_PARAM {
p.From.Offset += deltasp + 4
}
a = p.To.Typ
if a == D_AUTO {
p.To.Offset += deltasp
}
if a == D_PARAM {
p.To.Offset += deltasp + 4
}
//.........这里部分代码省略.........
示例3: addstacksplit
func addstacksplit(ctxt *liblink.Link, cursym *liblink.LSym) {
var p *liblink.Prog
var pl *liblink.Prog
var q *liblink.Prog
var q1 *liblink.Prog
var q2 *liblink.Prog
var o int
var autosize int64
var autoffset int64
autosize = 0
if ctxt.Symmorestack[0] == nil {
ctxt.Symmorestack[0] = liblink.Linklookup(ctxt, "runtime.morestack", 0)
ctxt.Symmorestack[1] = liblink.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
}
q = nil
ctxt.Cursym = cursym
if cursym.Text == nil || cursym.Text.Link == nil {
return
}
softfloat(ctxt, cursym)
p = cursym.Text
autoffset = p.To.Offset
if autoffset < 0 {
autoffset = 0
}
cursym.Locals = autoffset
cursym.Args = p.To.Offset2
if ctxt.Debugzerostack != 0 {
if autoffset != 0 && p.Reg&liblink.NOSPLIT == 0 {
// MOVW $4(R13), R1
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Reg = 13
p.From.Offset = 4
p.To.Typ = D_REG
p.To.Reg = 1
// MOVW $n(R13), R2
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Reg = 13
p.From.Offset = 4 + autoffset
p.To.Typ = D_REG
p.To.Reg = 2
// MOVW $0, R3
p = liblink.Appendp(ctxt, p)
p.As = AMOVW
p.From.Typ = D_CONST
p.From.Offset = 0
p.To.Typ = D_REG
p.To.Reg = 3
// L:
// MOVW.nil R3, 0(R1) +4
// CMP R1, R2
// BNE L
pl = liblink.Appendp(ctxt, p)
p = pl
p.As = AMOVW
p.From.Typ = D_REG
p.From.Reg = 3
p.To.Typ = D_OREG
p.To.Reg = 1
p.To.Offset = 4
p.Scond |= C_PBIT
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Typ = D_REG
p.From.Reg = 1
p.Reg = 2
p = liblink.Appendp(ctxt, p)
p.As = ABNE
p.To.Typ = D_BRANCH
p.Pcond = pl
}
}
/*
* find leaf subroutines
* strip NOPs
* expand RET
* expand BECOME pseudo
*/
for p = cursym.Text; p != nil; p = p.Link {
switch p.As {
case ACASE:
if ctxt.Flag_shared != 0 {
linkcase(p)
}
case ATEXT:
p.Mark |= LEAF
case ARET:
break
case ADIV,
ADIVU,
AMOD,
AMODU:
q = p
if ctxt.Sym_div == nil {
initdiv(ctxt)
}
//.........这里部分代码省略.........