本文整理汇总了Golang中rsc/io/tmp/slowgc/liblink.Prog.Mark方法的典型用法代码示例。如果您正苦于以下问题:Golang Prog.Mark方法的具体用法?Golang Prog.Mark怎么用?Golang Prog.Mark使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rsc/io/tmp/slowgc/liblink.Prog
的用法示例。
在下文中一共展示了Prog.Mark方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: addstacksplit
//.........这里部分代码省略.........
p.To.Type_ = D_OREG
p.To.Reg = 1
p.To.Offset = 4
p.Scond |= C_PBIT
p = liblink.Appendp(ctxt, p)
p.As = ACMP
p.From.Type_ = D_REG
p.From.Reg = 1
p.Reg = 2
p = liblink.Appendp(ctxt, p)
p.As = ABNE
p.To.Type_ = 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)
}
cursym.Text.Mark &^= LEAF
continue
case ANOP:
q1 = p.Link
q.Link = q1 /* q is non-nop */
if q1 != nil {
q1.Mark |= p.Mark
}
continue
case ABL,
ABX,
ADUFFZERO,
ADUFFCOPY:
cursym.Text.Mark &^= LEAF
fallthrough
case ABCASE,
AB,
示例2: xfol
func xfol(ctxt *liblink.Link, p *liblink.Prog, last **liblink.Prog) {
var q *liblink.Prog
var r *liblink.Prog
var a int
var i int
loop:
if p == nil {
return
}
a = int(p.As)
if a == AB {
q = p.Pcond
if q != nil && q.As != ATEXT {
p.Mark |= FOLL
p = q
if !(p.Mark&FOLL != 0) {
goto loop
}
}
}
if p.Mark&FOLL != 0 {
i = 0
q = p
for ; i < 4; (func() { i++; q = q.Link })() {
if q == *last || q == nil {
break
}
a = int(q.As)
if a == ANOP {
i--
continue
}
if a == AB || (a == ARET && q.Scond == C_SCOND_NONE) || a == ARFE || a == AUNDEF {
goto copy
}
if q.Pcond == nil || (q.Pcond.Mark&FOLL != 0) {
continue
}
if a != ABEQ && a != ABNE {
continue
}
copy:
for {
r = ctxt.Arch.Prg()
*r = *p
if !(r.Mark&FOLL != 0) {
fmt.Printf("can't happen 1\n")
}
r.Mark |= FOLL
if p != q {
p = p.Link
(*last).Link = r
*last = r
continue
}
(*last).Link = r
*last = r
if a == AB || (a == ARET && q.Scond == C_SCOND_NONE) || a == ARFE || a == AUNDEF {
return
}
r.As = ABNE
if a == ABNE {
r.As = ABEQ
}
r.Pcond = p.Link
r.Link = p.Pcond
if !(r.Link.Mark&FOLL != 0) {
xfol(ctxt, r.Link, last)
}
if !(r.Pcond.Mark&FOLL != 0) {
fmt.Printf("can't happen 2\n")
}
return
}
}
a = AB
q = ctxt.Arch.Prg()
q.As = int16(a)
q.Lineno = p.Lineno
q.To.Type_ = D_BRANCH
q.To.Offset = p.Pc
q.Pcond = p
p = q
}
p.Mark |= FOLL
(*last).Link = p
*last = p
if a == AB || (a == ARET && p.Scond == C_SCOND_NONE) || a == ARFE || a == AUNDEF {
return
}
if p.Pcond != nil {
if a != ABL && a != ABX && p.Link != nil {
//.........这里部分代码省略.........
示例3: xfol
func xfol(ctxt *liblink.Link, p *liblink.Prog, last **liblink.Prog) {
var q *liblink.Prog
var r *liblink.Prog
var a int
var b int
var i int
loop:
if p == nil {
return
}
a = int(p.As)
if a == ABR {
q = p.Pcond
if (p.Mark&NOSCHED != 0) || q != nil && (q.Mark&NOSCHED != 0) {
p.Mark |= FOLL
(*last).Link = p
*last = p
p = p.Link
xfol(ctxt, p, last)
p = q
if p != nil && !(p.Mark&FOLL != 0) {
goto loop
}
return
}
if q != nil {
p.Mark |= FOLL
p = q
if !(p.Mark&FOLL != 0) {
goto loop
}
}
}
if p.Mark&FOLL != 0 {
i = 0
q = p
for ; i < 4; (func() { i++; q = q.Link })() {
if q == *last || (q.Mark&NOSCHED != 0) {
break
}
b = 0 /* set */
a = int(q.As)
if a == ANOP {
i--
continue
}
if a == ABR || a == ARETURN || a == ARFI || a == ARFCI || a == ARFID || a == AHRFID {
goto copy
}
if !(q.Pcond != nil) || (q.Pcond.Mark&FOLL != 0) {
continue
}
b = relinv(a)
if !(b != 0) {
continue
}
copy:
for {
r = ctxt.Arch.Prg()
*r = *p
if !(r.Mark&FOLL != 0) {
fmt.Printf("cant happen 1\n")
}
r.Mark |= FOLL
if p != q {
p = p.Link
(*last).Link = r
*last = r
continue
}
(*last).Link = r
*last = r
if a == ABR || a == ARETURN || a == ARFI || a == ARFCI || a == ARFID || a == AHRFID {
return
}
r.As = int16(b)
r.Pcond = p.Link
r.Link = p.Pcond
if !(r.Link.Mark&FOLL != 0) {
xfol(ctxt, r.Link, last)
}
if !(r.Pcond.Mark&FOLL != 0) {
fmt.Printf("cant happen 2\n")
}
return
}
}
a = ABR
q = ctxt.Arch.Prg()
q.As = int16(a)
q.Lineno = p.Lineno
q.To.Type_ = D_BRANCH
q.To.Offset = p.Pc
//.........这里部分代码省略.........
示例4: addstacksplit
func addstacksplit(ctxt *liblink.Link, cursym *liblink.LSym) {
var p *liblink.Prog
var q *liblink.Prog
var p1 *liblink.Prog
var p2 *liblink.Prog
var q1 *liblink.Prog
var o int
var mov int
var aoffset int
var textstksiz int64
var textarg int64
var autosize int32
if ctxt.Symmorestack[0] == nil {
ctxt.Symmorestack[0] = liblink.Linklookup(ctxt, "runtime.morestack", 0)
ctxt.Symmorestack[1] = liblink.Linklookup(ctxt, "runtime.morestack_noctxt", 0)
}
// TODO(minux): add morestack short-cuts with small fixed frame-size.
ctxt.Cursym = cursym
if cursym.Text == nil || cursym.Text.Link == nil {
return
}
p = cursym.Text
parsetextconst(p.To.Offset, &textstksiz, &textarg)
cursym.Args = int32(p.To.Offset >> 32)
cursym.Locals = int32(textstksiz)
/*
* find leaf subroutines
* strip NOPs
* expand RET
* expand BECOME pseudo
*/
if ctxt.Debugvlog != 0 {
fmt.Fprintf(ctxt.Bso, "%5.2f noops\n", liblink.Cputime())
}
liblink.Bflush(ctxt.Bso)
q = nil
for p = cursym.Text; p != nil; p = p.Link {
switch p.As {
/* too hard, just leave alone */
case ATEXT:
q = p
p.Mark |= LABEL | LEAF | SYNC
if p.Link != nil {
p.Link.Mark |= LABEL
}
case ANOR:
q = p
if p.To.Type_ == D_REG {
if p.To.Reg == REGZERO {
p.Mark |= LABEL | SYNC
}
}
case ALWAR,
ASTWCCC,
AECIWX,
AECOWX,
AEIEIO,
AICBI,
AISYNC,
ATLBIE,
ATLBIEL,
ASLBIA,
ASLBIE,
ASLBMFEE,
ASLBMFEV,
ASLBMTE,
ADCBF,
ADCBI,
ADCBST,
ADCBT,
ADCBTST,
ADCBZ,
ASYNC,
ATLBSYNC,
APTESYNC,
ATW,
AWORD,
ARFI,
ARFCI,
ARFID,
AHRFID:
q = p
p.Mark |= LABEL | SYNC
continue
case AMOVW,
AMOVWZ,
AMOVD:
q = p
//.........这里部分代码省略.........
示例5: xfol
func xfol(ctxt *liblink.Link, p *liblink.Prog, last **liblink.Prog) {
var q *liblink.Prog
var i int
var a int
loop:
if p == nil {
return
}
if p.As == AJMP {
q = p.Pcond
if q != nil && q.As != ATEXT {
/* mark instruction as done and continue layout at target of jump */
p.Mark = 1
p = q
if p.Mark == 0 {
goto loop
}
}
}
if p.Mark != 0 {
/*
* p goes here, but already used it elsewhere.
* copy up to 4 instructions or else branch to other copy.
*/
i = 0
q = p
for ; i < 4; (func() { i++; q = q.Link })() {
if q == nil {
break
}
if q == *last {
break
}
a = int(q.As)
if a == ANOP {
i--
continue
}
if nofollow(a) != 0 || pushpop(a) != 0 {
break // NOTE(rsc): arm does goto copy
}
if q.Pcond == nil || q.Pcond.Mark != 0 {
continue
}
if a == ACALL || a == ALOOP {
continue
}
for {
if p.As == ANOP {
p = p.Link
continue
}
q = liblink.Copyp(ctxt, p)
p = p.Link
q.Mark = 1
(*last).Link = q
*last = q
if int(q.As) != a || q.Pcond == nil || q.Pcond.Mark != 0 {
continue
}
q.As = int16(relinv(int(q.As)))
p = q.Pcond
q.Pcond = q.Link
q.Link = p
xfol(ctxt, q.Link, last)
p = q.Link
if p.Mark != 0 {
return
}
goto loop
/* */
}
}
q = ctxt.Arch.Prg()
q.As = AJMP
q.Lineno = p.Lineno
q.To.Type_ = D_BRANCH
q.To.Offset = p.Pc
q.Pcond = p
p = q
}
/* emit p */
p.Mark = 1
(*last).Link = p
*last = p
a = int(p.As)
/* continue loop with what comes after p */
if nofollow(a) != 0 {
return
//.........这里部分代码省略.........
示例6: addstacksplit
//.........这里部分代码省略.........
case AJHI:
return AJLS
case AJCS:
return AJCC
case AJCC:
return AJCS
case AJPS:
return AJPC
case AJPC:
return AJPS
case AJOS:
return AJOC
case AJOC:
return AJOS
}
log.Fatalf("unknown relation: %s", anames6[a])
return 0
}
func xfol(ctxt *liblink.Link, p *liblink.Prog, last **liblink.Prog) {
var q *liblink.Prog
var i int
var a int
loop:
if p == nil {
return
}
if p.As == AJMP {
q = p.Pcond
if q != nil && q.As != ATEXT {
/* mark instruction as done and continue layout at target of jump */
p.Mark = 1
p = q
if p.Mark == 0 {
goto loop
}
}
}
if p.Mark != 0 {
/*
* p goes here, but already used it elsewhere.
* copy up to 4 instructions or else branch to other copy.
*/
i = 0
q = p
for ; i < 4; (func() { i++; q = q.Link })() {
if q == nil {
break
}
if q == *last {
break
}
a = int(q.As)
if a == ANOP {
i--
continue
}
if nofollow(a) != 0 || pushpop(a) != 0 {
break // NOTE(rsc): arm does goto copy
}