ms partition iii

Download MS Partition III

Post on 18-Nov-2014

108 views

Category:

Documents

3 download

Embed Size (px)

TRANSCRIPT

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15

Common Language Infrastructure (CLI) Partition III CIL Instruction Set

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 1 1. 1 1. 1. 1 1. 1. 2 1. 1. 3 1. 1. 4 1. 2 1. 2. 1 1. 3 1. 4 1. 5 1. 6 1. 7 1. 7. 1 1. 7. 2 1. 7. 3 1. 7. 4 1. 7. 5 1. 7. 6 1. 8 1. 8. 1 1. 9 1. 1 0 2 2. 1 2. 2 Int r o du ct i o n Dat a t yp e s N u mer ic da ta t yp e s B o ol e a n d at a t yp e O b je c t r ef er e nc e s R u nt i me p oi n ter t yp e s I n st r u c t i on var ia n t t a bl e O pc od e e nc od i n gs Sta c k t r a n si ti on d ia gr a m En g l i sh de sc ri p ti on O per a n d t yp e ta b le

Table of Contents1 1 2 4 4 4 6 6 11 11 11 14 16 16 16 17 17 17 17 17 18 23 23 24 25 27 28 29 30 31 32 33 34 35 36 Partition III i

I mp l i ci t a r gu me n t c oer c i on Re s tr ic t i on s on C I L c od e s e q ue nc es Th e i n st r uct i on str ea m Val i d br a n c h t a r ge ts Ex c e pt i on ra n ge s Mu s t pr o vi d e ma x s tac k Ba c kwa r d br a nc h c on s tr a i nt s Br a n c h ver if i ca t i on c on s tr ai n t s Ver i f ia b i l it y a n d c or r ec t ne s s Fl ow c on t r ol re str ic t i on s f o r ve r if ia b le C I L Met a dat a t o ke n s Ex c e pt i on s t hr ow n Pr ef ix e s t o i n str uc t i o ns c ons t r ai ne d. ( p r ef i x ) in v o ke a m e m be r on a v al u e of a var ia b le t yp e no. ( pr ef i x) p os si bl y s ki p a f a ul t c he c k

2. 3 r ead o nl y. ( pr ef i x) f ol l o wi n g i n st r uc t i on r e t ur n s a c on tr ol l e d- m ut a bi li t y ma n a ge d p oi n t er 2. 4 2. 5 2. 6 3 3. 1 3. 2 3. 3 3. 4 ta il. ( pr ef i x) c al l t e r m in a t es c ur r e n t m et h od una l ig ned . ( pr ef i x) p oi n ter i n str u ct i on m i gh t b e u n al i g n e d v o la t il e. ( pr ef i x) p oi n te r r e f er e n ce is v ola ti le B a se in st ru ct i o ns add a d d n u mer ic va l u es add .o v f.< s ign ed> a d d i nte ge r va l ue s wi t h o v e r fl o w c he c k and b it wi se A N D ar gl is t ge t a r g u m e nt l i st

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39

3. 5 3. 6

beq .< le ngt h> br a n c h on e q ua l bge .< le ngt h> br a n c h on gr eat er t h a n or e q ual t o

37 38

bge .u n.< l eng th> br a n ch on gre a ter t ha n or e q u a l t o, u n si gn e d or 3. 7 u n or de r e d 3 9 3. 8 3. 9 3. 1 0 3. 1 1 3. 1 2 3. 1 3 3. 1 4 3. 1 5 3. 1 6 3. 1 7 3. 1 8 3. 1 9 3. 2 0 3. 2 1 3. 2 2 3. 2 3 3. 2 4 3. 2 5 3. 2 6 3. 2 7 3. 2 8 3. 2 9 de te c ti on 3. 3 0 3. 3 1 3. 3 2 3. 3 3 3. 3 4 3. 3 5 3. 3 6 3. 3 7 3. 3 8 3. 3 9 3. 4 0 3. 4 1 ii bgt. < le ng th> bra n c h on gr e at er t h a n bgt. un.< leng th> br a n ch on gr ea t er t ha n, u nsi gn e d or u n or der e d b le .< len gt h> br a nc h o n le s s t h a n or e q u a l t o b le .u n.< le ngt h> br a n c h on le ss t ha n or e q ua l t o, u n si gn e d or u n or de r e d b lt .< le ngt h> br a n c h o n le s s t h a n b lt .u n.< l eng th> br a n c h on le s s t h a n, u n si gn e d or u n or d e re d bne .u n< len gt h> br a n ch on n ot e q ual or u n or d er e d br. < len g th> u nc on d i ti on a l br a n c h bre ak b r ea kp oi n t i n str uc ti on brf al se. < len gt h> b r a n ch on f a l se, n ul l, or zer o brt r u e.< l eng th> br a n ch on n on - f a lse or n on - n ul l c a ll ca l l a me t h od c a lli i n d i re c t me t h od c all c eq c om p a r e e q u al c gt c o mp ar e gr e ate r t h an c gt .u n c om p ar e gr e a te r t ha n, u n s i gn e d or u n or der e d ck fin it e c hec k f or a f i ni t e r ea l n u mbe r c lt c om p a r e le ss t ha n c lt . un c omp a r e l e ss t h an, u nsi gn e d or u n or der ed c onv .< t o t yp e> da ta c on ver si on c onv . o vf .< t o t yp e> d a ta c on ver si o n wi t h o ve r f l ow d e te ct i on c onv . o vf .< t o t yp e> .u n u n si gn e d da ta c on ve r si on w it h o ve r f l ow 62 c pblk c o p y d a ta f r om me m or y t o m e m or y d iv di vi d e va l u es d iv. un di vi d e i nt e ge r va l ue s, u n s i gn e d dup d u p li ca te t h e t op va l ue of t he sta c k end fi lter e n d e xce p t i o n h a n dli n g f i lt er c l a u se end fi na ll y e n d t he f i n a ll y or f a u lt cla u s e of a n e x c e p ti on b l oc k init blk i n it i a liz e a b l o c k of me m or y t o a va l ue jm p ju m p t o m et h od ldar g.< le ngt h> l o a d a r gu m e nt on t o t h e sta c k ldar ga.< leng th> l oa d an a r gu m e n t a d dr e ss ld c.< t ype> l oa d n u m e r ic c on st a n t ldf tn l o a d met h od p oi nt er Partition III 63 64 65 66 67 68 69 70 71 72 73 74 40 41 42 43 44 45 46 47 48 49 50 51 53 54 55 56 57 58 59 60 61

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38

3. 4 2 3. 4 3 3. 4 4 3. 4 5 3. 4 6 3. 4 7 3. 4 8 3. 4 9 3. 5 0 3. 5 1 3. 5 2 3. 5 3 3. 5 4 3. 5 5 3. 5 6 3. 5 7 3. 5 8 3. 5 9 3. 6 0 3. 6 1 3. 6 2 3. 6 3 3. 6 4 3. 6 5 3. 6 6 3. 6 7 4 4. 1 4. 2 4. 3 4. 4 4. 5 4. 6 4. 7 4. 8 4. 9 4. 1 0 4. 1 1

ldi nd.< t ype> l oa d va l ue i n di r ec t on t o t he st ac k ldl oc l oa d l oc al v a r ia b le on t o t he sta c k ldl oc a.< len gth> l oa d l oca l var ia b le a d dr e ss ldn u ll l oa d a n u ll p o i n ter lea v e.< l eng th> e x it a pr ot ec te d r e gi on of c od e lo ca ll oc a ll oc at e spac e i n t he l oc a l d yn a mic m e mor y p o ol mu l m ul ti p l y va l ue s mu l. ov f. < t yp e> mul t i pl y i n te ger val u e s w it h o ver f l ow c he c k neg n e ga te nop n o op er a ti on not b it wi se c omp l e me nt or b it wi se O R pop r e mo ve t he t op e l e me nt of t h e sta c k r e m c omp u t e r e ma i n d er r e m. un c om p u t e i nt e g er r e ma i n d er , u ns i gn e d r et r e t ur n fr om m et h o d s h l shif t i n te ge r l ef t s hr s hif t i nte g e r r i gh t s hr . un shif t i n te ge r r i gh t , u n si gn e d st ar g. < l eng t h> st or e a val u e i n a n ar gu m e nt s l ot st i nd.< t yp e> s t or e va l ue i n di r e c t f r om sta c k st l oc p op val u e f r om s tac k t o l o c a l va r i a bl e s ub s u b tr a ct n u m er i c va l ue s s ub. ovf . su b tr a ct i nt e ger va l ue s, c hec ki n g f or o ver f l ow sw it c h t a bl e swi tc h b a se d on va l u e x or b it wi se XO R O bj e c t mo d el inst ru ct i o ns box c on ve r t a b ox a bl e va l ue t o i t s b o x e d f or m c a ll v ir t c al l a m et h od as s oc iat e d, a t r u n ti me , wit h a n ob je c t c a st c la s s c as t a n o b je ct t o a c la s s c pob j c op y a va l ue f r o m on e a d dr e ss t o a n ot h e r ini t ob j i ni ti a l ize t he v a l ue a t a n a d dr ess is in s t te st i f a n ob je ct is a n i nsta nc e of a c l a ss or i nt er f a ce lde le m l oa d e le me n t f r om ar r a y lde le m.< t yp e > l oa d a n e le m e nt of a n a rr a y lde le ma l oa d a d dr e ss of a n e le me n t of a n ar r a y ldf l d l oa d fi e l d of a n o b jec t ldf l da l oa d f ie l d a d d r e s s Partition III

75 77 78 79 80 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 113 114 116 iii

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24

4. 1 2 4. 1 3 4. 1 4 4. 1 5 4. 1 6 4. 1 7 4. 1 8 4. 1 9 4. 2 0 4. 2 1 4. 2 2 4. 2 3 4. 2 4 4. 2 5 4. 2 6 4. 2 7 4. 2 8 4. 2 9 4. 3 0 4. 3 1 4. 3 2 4. 3 3 5

ldle n l oa d t he le n gt h of a n ar r a y ldo bj c op y a va l ue f r o m a n a d dr e ss t o t h e sta c k ld sf ld l oa d sta ti c f iel d of a c la ss ld sf lda l o a d s ta tic f i el d a d d re ss ld str l o a d a l it er a l str i n g ldt ok en l oa d t he r u n ti me r e pr e s e nta ti on of a me ta d ata t oke n ld vir tf t n l oa d a vi r t ual me t h od p oi n t er mk r ef an y p u sh a t yp e d r ef er e n ce on t he st ac k new ar r cr ea te a ze r o- ba se d , on e- d i me n si on a l a rr a y new ob j cr e ate a ne w o b jec t r ef an yt yp e l oa d t h e t yp e ou t of a t yp e d re f er en ce r ef an yv a l l oa d t he a d dr e s s ou t of a t yp e d r ef e r e n ce r et hr ow r et h r ow t h e c ur r e nt e x ce p t i on s ize o f l oa d t he si z e, i n b yt e s, of a t yp e st e lem st or e el e me n t t o a r r a y st e lem .< t yp e> st or e a n e le me nt of a n ar r a y st f ld st or e i n t o a f ie l d of a n ob je c t st o bj st or e a va l u e a t a n a d dr e s s st s f ld st or e a st at ic f i el d o f a c l a ss thr ow t hr ow a n e x c e pt i on unb o x c on ve r t b ox e d va l ue t yp e t o i t s ra w f or m unb o x. a n y c on ve r t b o xe d t yp e t o va l ue In de x

117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139

iv

Partition III

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

1

IntroductionThis partition is a detailed description of the Common Intermediate Language (CIL) instruction set, part of the specification of the CLI. Partition I describes the architecture of the CLI and provides an overview of a large number of issues relating to the CIL instruction set. That overview is essential to an understanding of the instruction set as described here. In this partition, each instruction is described in its own subclause, one per page. Related CLI machine instructions are described together. Each instruction description consists of the following parts: A table describing the binary format, assembly language notation, and description of each variant of the instruction. See 1.2. A stack tra