GC Roots misunderstanding?

I know Roots:

  • static fields
  • method parameters
  • local fielfs
  • f-queue, which also contains a pointer to objects to be completed.
  • cpu register <= ???

enter image description here

Now let's talk about registers.

the code that they may contain looks like:

mov bx, 0034h   ; bx = 52 (stored in 16 bits)
mov cl, bl      ; cl = lower 8-bits of bx
mov eax, ecx
call print_int

but wait !

If im not mistaken, this is really a code that Holding those static, localand parameters- the first time!

So why write this TWICE ? (or from another direction?)

Why write (for example)

  Foo f = new Foo();

**and also** 

mov bx, 0034h   //<-------- represents the `f` address or something like that 

change

my register question comes from here: enter image description here

enter image description here

+2
source share
3 answers

Consider

string sentence = ...
int wordCount = sentence.Split(' ').Length;

String.Split() , () . , , , , .

CPU () .

+2

.

, :

Foo f = new Foo();

, . . , , . - , .


, , , . , , , .

+2

JIT , , .

, :

object a = new object(), b = new object(), c = new object();
DoSomething(a, b, c);

JIT , . , X86, :

00000082  push        dword ptr [ebp-10h] 
00000085  mov         ecx,dword ptr [ebp-8] 
00000088  mov         edx,dword ptr [ebp-0Ch] 
0000008b  call        dword ptr ds:[00742078h] 

, /.

+2

All Articles