Created
March 16, 2014 10:41
-
-
Save antonijn/9581372 to your computer and use it in GitHub Desktop.
Only two heap-allocations! Not bad!
This file contains 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
private static void foo() { | |
byte b = 10; | |
short s = 10; | |
void() f = void () s = b; | |
void(int) g = void (int a) a = b; | |
} | |
private static void bar() { | |
final int x = 10; | |
void(int) f = void (int a) a = x; | |
} |
This file contains 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 private void @anon.0(i8* %this) { | |
%1 = bitcast i8* %this to { i16, i8* }* | |
%2 = getelementptr inbounds { i16, i8* }* %1, i32 0, i32 0 | |
%3 = getelementptr inbounds { i16, i8* }* %1, i32 0, i32 1 | |
%4 = load i8** %3 | |
%5 = load i8* %4 | |
%6 = zext i8 %5 to i16 | |
store i16 %6, i16* %2 | |
ret void | |
; <label>:7 | |
} | |
define private void @anon.1(i8* %this, i32 %a) { | |
%1 = alloca i32 | |
%2 = alloca i8* | |
store i8* %this, i8** %2 | |
%3 = bitcast i8** %2 to { i8* }* | |
store i32 %a, i32* %1 | |
%4 = getelementptr inbounds { i8* }* %3, i32 0, i32 0 | |
%5 = load i8** %4 | |
%6 = load i8* %5 | |
%7 = zext i8 %6 to i32 | |
store i32 %7, i32* %1 | |
ret void | |
; <label>:8 | |
} | |
define internal void @class.my.pack.MyClass.foo.0(i8* %this) { | |
%1 = alloca i8* | |
%2 = alloca { i8*, void (i8*,i32)* } | |
%3 = alloca { i8*, void (i8*)* } | |
%4 = call i8* @aqua_alloc(i64 1) | |
%5 = bitcast i8* %4 to i8* | |
store i8 10, i8* %5 | |
%6 = call i8* @aqua_alloc(i64 16) | |
%7 = bitcast i8* %6 to { i16, i8* }* | |
%8 = getelementptr inbounds { i16, i8* }* %7, i32 0, i32 0 | |
store i16 10, i16* %8 | |
%9 = getelementptr inbounds { i16, i8* }* %7, i32 0, i32 1 | |
store i8* %5, i8** %9 | |
%10 = bitcast { i16, i8* }* %7 to i8* | |
%11 = insertvalue { i8*, void (i8*)* } undef, i8* %10, 0 | |
%12 = insertvalue { i8*, void (i8*)* } %11, void (i8*)* @anon.0, 1 | |
store { i8*, void (i8*)* } %12, { i8*, void (i8*)* }* %3 | |
%13 = bitcast i8** %1 to { i8* }* | |
%14 = getelementptr inbounds { i8* }* %13, i32 0, i32 0 | |
store i8* %5, i8** %14 | |
%15 = bitcast { i8* }* %13 to i8** | |
%16 = load i8** %15 | |
%17 = insertvalue { i8*, void (i8*,i32)* } undef, i8* %16, 0 | |
%18 = insertvalue { i8*, void (i8*,i32)* } %17, void (i8*,i32)* @anon.1, 1 | |
store { i8*, void (i8*,i32)* } %18, { i8*, void (i8*,i32)* }* %2 | |
ret void | |
; <label>:19 | |
} | |
define private void @anon.2(i8* %this, i32 %a) { | |
%1 = alloca i32 | |
%2 = alloca i8* | |
store i8* %this, i8** %2 | |
%3 = bitcast i8** %2 to { i32 }* | |
store i32 %a, i32* %1 | |
%4 = getelementptr inbounds { i32 }* %3, i32 0, i32 0 | |
%5 = load i32* %4 | |
store i32 %5, i32* %1 | |
ret void | |
; <label>:6 | |
} | |
define internal void @class.my.pack.MyClass.bar.0(i8* %this) { | |
%1 = alloca i8* | |
%2 = alloca { i8*, void (i8*,i32)* } | |
%3 = alloca i32 | |
store i32 10, i32* %3 | |
%4 = bitcast i8** %1 to { i32 }* | |
%5 = load i32* %3 | |
%6 = getelementptr inbounds { i32 }* %4, i32 0, i32 0 | |
store i32 %5, i32* %6 | |
%7 = bitcast { i32 }* %4 to i8** | |
%8 = load i8** %7 | |
%9 = insertvalue { i8*, void (i8*,i32)* } undef, i8* %8, 0 | |
%10 = insertvalue { i8*, void (i8*,i32)* } %9, void (i8*,i32)* @anon.2, 1 | |
store { i8*, void (i8*,i32)* } %10, { i8*, void (i8*,i32)* }* %2 | |
ret void | |
; <label>:11 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment