본문 바로가기
Java bytecode 분석 Java bytecode 분석 http://arhipov.blogspot.kr/2011/01/java-bytecode-fundamentals.htmlhttps://en.wikipedia.org/wiki/Java_bytecode_instruction_listings -javap 는 java class file disassembler 이다.bytecode 는 위 javap 명령을 통해 볼 수 있다. -public class Foo { private String bar; public String getBar(){ return bar; } public void setBar(String bar) { this.bar = bar; } } 위 코드의 bytecode 는 아래와 같다. public class Foo ex.. 2018. 12. 19.
[Kotlin] Kotlin 의 숨겨진 비용 #1 [Kotlin] Kotlin 의 숨겨진 비용 #1 https://medium.com/@BladeCoder/exploring-kotlins-hidden-costs-part-1-fbb9935d9b62 -“With great power comes great responsibility” 를 기억해야 한다.( 간단한 코드를 짜는 대신 대가가 있다는 얘기다 ) -Kotlin bytecode inspector 를 사용하면 Kotlin 코드가 어떻게 bytecode 로 변환되는지 볼 수 있다.Android studio plugin 으로 접할 수 있다.이를 보면 primitive type 의 boxing, code 에서 보이지 않는 기타 object 들의 instantiation, 그리고 각종 추가 method 들의 추.. 2018. 1. 16.
[Java] Jit Compiler 에 대한 이야기 [Java] Jit Compiler 에 대한 이야기 http://blog.takipi.com/java-on-steroids-5-super-useful-jit-optimization-techniques/ -bytecode 는 original Java 코드를 그대로(dynamic optimization 없이) 나타낸 것이라고 보면 된다.JVM 이 bytecode 를 Assembly로 변환할 때 2가지 mode 가 작동한다. 1.Interpreted mode : JVM 이 bytecode 를 읽고 실행시킨다.2. Compiled mode(byte code to assembly) 이 두가지 mode 를 잇는 것이 JIT compiler 이다. Interpreted mode 가 assembly level 로 최적.. 2018. 1. 14.
[Kotlin Tutorial] Annotation 과 Reflection #2 [Kotlin Tutorial] Annotation 과 Reflection #2 참조 : Kotlin in action 10.2. Reflection: introspecting Kotlin objects at runtime -Kotlin 에서의 reflection 은 java.lang.reflect package 의 API 들과 kotlin.reflect package 의 API 들을 사용한다.Kotlin 의 reflection 은 Java 에 없는 nullable type 이나 properties 들의 접근을 가능하게 한다. -runtime lib 의 size 를 줄이기 위해, kotlin 의 reflection API 는 kotlin-reflect.jar 라는 별개의 jar 로 pakcage 되어 있.. 2017. 9. 12.
[Kotlin Tutorial] Annotation 과 Reflection #1 - Chap 10. Annotations and reflection [Kotlin Tutorial] Annotation 과 Reflection #1 - Chap 10. Annotations and reflection 참조 : Kotlin in action 10.1. Declaring and applying annotations. 10.1.1. Applying annotations -Annotation 사용법은 Java 와 동일하다. @ 를 prefix 로 하고 annotation name 을 써주면 된다. -@Deprecated 의 경우 Kotlin 은 Java 의 것에서 향상되었다.replaceWith parameter 가 추가되어, 새로운 version 의 API 에 연결될 수 있다.@Deprecated(“Use removeAt(index) instead.”, Rep.. 2017. 9. 7.
[Kotlin Tutorial] 한 차원 높은 함수 : 람다를 parameter 와 return value 로 - Chap8. Higher-order functions: lambdas as parameters and return values [Kotlin Tutorial] 한 차원 높은 함수 : 람다를 parameter 와 return value 로 - Chap8. Higher-order functions: lambdas as parameters and return values 참조 : Kotlin in action 8.1. Declaring higher-order functions -Higher-order function 이란 argument 와 return 으로 다른 function 을 갖는 것을 의미한다.Kotlin 에서는 function 이 lambda 나 function reference 로 표시된다. 8.1.1. Function types -val sum = { x:Int, y:Int -> x+y }val action = { pr.. 2017. 8. 31.
[Android] 새로운 Dex Compiler 가 나온다네용 -이 글은 D8 이 출시되기 전에 쓰여진 글이라 현재는 deprecated doc 이라고 볼 수 있겠다.D8 에 대한 이야기는 아래 링크를 참조하시길..[android] D8 이 뭐야? -Android APK 를 만들 때 Javac 를 이용해서 bytecode 인 .class 를 만든 후dex compiler 를 이용해서 bytecode 들을 .dex 로 만든다. -Android Studio 3.0 Beta 부터 "D8" 이라고 불리는 새로운 dex compiler 를 사용할 수 있다. D8 은 compile time 도 줄였고, .dex 파일 사이즈도 줄였다..Android 측에서 제공하는 자료에 따르면 Compile Time 은 약 30% 정도 줄었다. 파일 사이즈는 약 5% 정도 줄었다. ( 사이즈.. 2017. 8. 13.
[android] Kotlin (코틀린) 이 뭐야? [android] Kotlin (코틀린) 이 뭐야? 참조 : https://realm.io/kr/news/android-kotlin/ -kotlin 이 등장하기 시작한 것은, Oracle 과 Google 의 Java 에 대한 소송으로부터 야기된다.언젠가 Google 이 패소하거나, 소송에 지쳐 Java 를 버릴 수 있다는 판단 하에 사람들은 대안이 될 수 있는 언어를 찾는다.구글의 새로운 언어인 Go 가 그 위치를 차지한다는 이야기가 있었지만, 기존 android 가 Java 와 JVM 기반이기 때문에 이는 신빙성이 낮고..JVM 기반에서 작동할 수 있는 Kotlin 이 유력한 대안으로 이야기되고 있다가.. 이제 정식으로 공식 언어가 되었다!! -Kotlin 은 Jetbrains( Intelli J 만든.. 2017. 7. 25.
JIT 컴파일러(Compiler)에 대해 알아본다. JIT 컴파일러(Compiler)에 대해 알아본다. JIT 컴파일러의 JIT는 Just-In-Time 의 약자로, 말 그대로 하면, "그 순간" 컴파일러라는 뜻인데, 사용할 때 컴파일한다는 의미이다. 무슨 말인지 모를 것이다. 당연하다. 하지만 아래의 글을 읽어보면, 아아.. 그런 말이구나 할 것이다. 이 JIT Compiler는 자바에서 대표적으로 사용하고 있다.( 요즘은 Platform Independent 가 대세이기 때문에 .NET 도, 브라우저도 사용한다. ) Java에서 Compile 을 하면 Bytecode 로 변환된다.( 이는 수도없이 들어봤을 것이다. 하지만 제대로 이해하지 못했을 것이다.. ?? )이 바이트코드는 기계가 바로 읽을 수 있는 형태가 아니며, 이 바이트코드는 실제 실행될 때.. 2013. 6. 27.
반응형