설명은 실제로 속이는 것이지만 Java 코드를 인쇄하는 것은 결코 아닙니다. 어쨌든 그렇게 할 수는 없습니다. 스칼라는 유효한 바이트 코드를 생성하지만 Java로 직접 변환 할 수있는 바이트 코드는 생성하지 않습니다.
cleanup
단계 이후에 코드를 생성합니다. cleanup
가 icode
전에 마지막 단계는
phase name id description
---------- -- -----------
parser 1 parse source into ASTs, perform simple desugaring
namer 2 resolve names, attach symbols to named trees
packageobjects 3 load package objects
typer 4 the meat and potatoes: type the trees
superaccessors 5 add super accessors in traits and nested classes
pickler 6 serialize symbol tables
refchecks 7 reference/override checking, translate nested objects
selectiveanf 8
liftcode 9 reify trees
selectivecps 10
uncurry 11 uncurry, translate function values to anonymous classes
tailcalls 12 replace tail calls by jumps
specialize 13 @specialized-driven class and method specialization
explicitouter 14 this refs to outer pointers, translate patterns
erasure 15 erase types, add interfaces for traits
lazyvals 16 allocate bitmaps, translate lazy vals into lazified defs
lambdalift 17 move nested functions to top level
constructors 18 move field definitions into constructors
flatten 19 eliminate inner classes
mixin 20 mixin composition
cleanup 21 platform-specific cleanups, generate reflective calls
icode 22 generate portable intermediate code
inliner 23 optimization: do inlining
closelim 24 optimization: eliminate uncalled closures
dce 25 optimization: eliminate dead code
jvm 26 generate JVM bytecode
terminal 27 The last phase in the compiler chain
하는 것으로, 그것은 정말 요점 : 당신이 스칼라 2.9.2에 -Xshow-phases
을하려고하면 지금, 당신은이를 볼 수 있습니다. 매개 변수 -print
은 추상 구문 트리를 변경 한 모든 것이 완료된 후에 내용을 인쇄합니다. 대서양 표준시가 코드를 생성 할 준비가되었을 때.
소리는 버그와 유사합니다. 형질은 자명 한 스칼라 특유의 것입니다! –
필자도 항상 저를 괴롭 혔지만, 컴파일러 개발자 관점에서 볼 때 스칼라의 대부분의 매개 변수가 처음부터 시작되었습니다. –