Comments by "" (@diadetediotedio6918) on "JVM in Rust?? | | Prime Reacts" video.
-
12
-
@CottidaeSEA
It is not a cached result of an interpretation, really. It turns the IL into machine code that will then run and give the result, it's not like the JIT is doing 2 + 2 = 4 then storing 4 as machine code, is more like JIT is converting:
IL ->
.maxstack 3
.locals init (
[0] int32 'a',
[1] int32 'y',
[2] int32 'z'
)
IL_0000: ldc.i4.2
IL_0001: stloc.0
IL_0002: ldc.i4.2
IL_0003: stloc.1
IL_0004: ldloc.0
IL_0005: ldloc.1
IL_0006: add
IL_0007: stloc.2
IL_0008: ret
into ASM ->
mov eax, 2
mov ebx, 2
add ecx, eax
(this is just a simple example)
Of course, JIT also does some optimizations in the process, so something like 2 + 2 would probably be optimized right into 4, but it is not a general rule nor it guides the entire generation, it is much more a just in time compilation rather than a just in time intepretation + caching.
3
-
2
-
2
-
1