Je n'arrive pas à comprendre le prologue de la fonction que génère le poteau Java. Considérez cet exemple fictif:Présentation de la fonction Java Hotspot Prologue
public static int getLen(String s) {
return s.length();
}
public static void main(String[] args) {
for(int i = 0; i < 1_000_000; i++) {
getLen("abcd");
}
}
Le code généré pour getLen
, par C2, est la suivante:
[Entry Point]
[Verified Entry Point]
[Constants]
# {method} {0x00007fbed3fc2318} 'getLen' '(Ljava/lang/String;)I' in 'examples/Main'
# parm0: rsi:rsi = 'java/lang/String'
# [sp+0x20] (sp of caller)
0x00007fbefd11a960: mov %eax,-0x14000(%rsp)
0x00007fbefd11a967: push %rbp
0x00007fbefd11a968: sub $0x10,%rsp ;*synchronization entry
; - examples.Main::[email protected] (line 6)
0x00007fbefd11a96c: mov 0xc(%rsi),%r11d ;*getfield value
; - java.lang.String::[email protected] (line 623)
; - examples.Main::[email protected] (line 6)
; implicit exception: dispatches to 0x00007fbefd11a981
0x00007fbefd11a970: mov 0xc(%r12,%r11,8),%eax ;*arraylength
; - java.lang.String::[email protected] (line 623)
; - examples.Main::[email protected] (line 6)
; implicit exception: dispatches to 0x00007fbefd11a991
Question:
- Quel est le but de
mov %eax,-0x14000(%rsp)
? - L'exemple de code n'a pas de synchronisation; Alors, quelle est l'entrée
sub $0x10,%rsp ;*synchronization
?