Created
July 20, 2021 18:10
-
-
Save Geolykt/a1225e44bcee8982d869a86a30029773 to your computer and use it in GitHub Desktop.
Bytecode and Documentation of snoddasmannen/galimulator/Empire.S()Ljava/lang/String; (Galimulator Version 4.9-beta.7)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DEFINE PUBLIC S()Ljava/lang/String; | |
A: | |
LDC "" | |
ASTORE 1 | |
ALOAD this | |
INVOKEVIRTUAL snoddasmannen/galimulator/Empire.getName()Ljava/lang/String; | |
LDC " " | |
INVOKEVIRTUAL java/lang/String.split(Ljava/lang/String;)[Ljava/lang/String; | |
ASTORE 2 // save Array | |
ALOAD 2 // obtain array length | |
ARRAYLENGTH | |
ISTORE 3 // store array length | |
ICONST_0 | |
ISTORE 4 // The loop counter | |
B: | |
ILOAD 4 // obtain loop counter | |
ILOAD 3 // obtain array length | |
IF_ICMPGE E // jump to "E" if index out of bounds | |
ALOAD 2 // obtain array | |
ILOAD 4 // obtain array counter | |
AALOAD | |
ASTORE 5 // store obtained object are array index - this is the thing we want to create an LVT entry for | |
ALOAD 5 // load the obtained object | |
INVOKEVIRTUAL java/lang/String.length()I | |
IFNE C // this case shouldn't be possible, but apparently it can be, otherwise this would not exist | |
LDC "WTF" | |
ARETURN | |
C: | |
ALOAD 5 // get stored string | |
ICONST_0 | |
INVOKEVIRTUAL java/lang/String.charAt(I)C | |
INVOKESTATIC java/lang/Character.isUpperCase(C)Z // append the first character of the obtained string to the string at index 1 if and only if the first character is uppercase. | |
IFEQ D | |
NEW java/lang/StringBuilder | |
DUP | |
INVOKESPECIAL java/lang/StringBuilder.<init>()V | |
ALOAD 1 | |
INVOKEVIRTUAL java/lang/StringBuilder.append(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
ALOAD 5 | |
ICONST_0 | |
INVOKEVIRTUAL java/lang/String.charAt(I)C | |
INVOKEVIRTUAL java/lang/StringBuilder.append(C)Ljava/lang/StringBuilder; | |
INVOKEVIRTUAL java/lang/StringBuilder.toString()Ljava/lang/String; | |
ASTORE 1 | |
D: | |
IINC 4 1 | |
GOTO B | |
E: | |
ALOAD 1 | |
ARETURN | |
F: | |
G: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment