[java live study] 1์ฃผ์ฐจ : JVM์€ ๋ฌด์—‡์ด๋ฉฐ ์ž๋ฐ” ์ฝ”๋“œ๋Š” ์–ด๋–ป๊ฒŒ ์‹คํ–‰ํ•˜๋Š” ๊ฒƒ์ธ๊ฐ€

2021-02-14

๋ชฉํ‘œ๐Ÿ”—

์ž๋ฐ” ์†Œ์Šค ํŒŒ์ผ(.java)์„ JVM์œผ๋กœ ์‹คํ–‰ํ•˜๋Š” ๊ณผ์ • ์ดํ•ดํ•˜๊ธฐ.

ํ•™์Šตํ•  ๊ฒƒ

  • JVM์ด๋ž€ ๋ฌด์—‡์ธ๊ฐ€
  • ์ปดํŒŒ์ผ ํ•˜๋Š” ๋ฐฉ๋ฒ•
  • ์‹คํ–‰ํ•˜๋Š” ๋ฐฉ๋ฒ•
  • ๋ฐ”์ดํŠธ์ฝ”๋“œ๋ž€ ๋ฌด์—‡์ธ๊ฐ€
  • JIT ์ปดํŒŒ์ผ๋Ÿฌ๋ž€ ๋ฌด์—‡์ด๋ฉฐ ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”์ง€
  • JVM ๊ตฌ์„ฑ ์š”์†Œ
  • JDK์™€ JRE์˜ ์ฐจ์ด
  • +) javac option

JVM์ด๋ž€ ๋ฌด์—‡์ธ๊ฐ€

Java Vertual Machine ์ง์—ญํ•˜๋ฉด โ€˜์ž๋ฐ”๋ฅผ ์‹คํ–‰ํ•˜๊ธฐ ์œ„ํ•œ ๊ฐ€์ƒ ๊ธฐ๊ณ„(=์ปดํ“จํ„ฐ)โ€™๋ผ๋Š” ๋œป์œผ๋กœ ๋ฐ”์ดํŠธ์ฝ”๋“œ(์ปดํŒŒ์ผ๋œ ์ž๋ฐ”์ฝ”๋“œ)๋ฅผ ์‹คํ–‰ํ•˜๋Š” ์ฃผ์ฒด๋‹ค.
Vertual Machine์€ ์†Œํ”„ํŠธ์›จ์–ด๋กœ ๊ตฌํ˜„๋œ ํ•˜๋“œ์›จ์–ด๋ฅผ ๋œปํ•˜๋Š” ๋„“์€ ์˜๋ฏธ์˜ ์šฉ์–ด๋กœ, ์‹ค์ œ ํ•˜๋“œ์›จ์–ด ์ปดํ“จํ„ฐ๊ฐ€ ์•„๋‹Œ ์†Œํ”„ํŠธ์›จ์–ด๋กœ ๊ตฌํ˜„๋œ ์ปดํ“จํ„ฐ๋ผ๋Š” ๋œป์œผ๋กœ ์ปดํ“จํ„ฐ ์†์˜ ์ปดํ“จํ„ฐ๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ๋œ๋‹ค.
์ž๋ฐ”๋กœ ์ž‘์„ฑ๋œ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ๋ชจ๋‘ ์ด JVM์—์„œ๋งŒ ์‹คํ–‰๋˜๊ธฐ ๋•Œ๋ฌธ์— ์ž๋ฐ” ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์‹คํ–‰๋˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ๋ฐ˜๋“œ์‹œ JVM์ด ํ•„์š”ํ•˜๋‹ค.

The Java Virtual Machine is an abstract computing machine. It is the component of the technology responsible for its hardware- and operating system-independence, the small size of its compiled code, and its ability to protect users from malicious programs.
์ž๋ฐ” ๊ฐ€์ƒ ๋จธ์‹ ์€ ์ถ”์ƒ ์ปดํ“จํŒ… ๋จธ์‹ ์ž…๋‹ˆ๋‹ค. ํ•˜๋“œ์›จ์–ด ๋ฐ ์šด์˜ ์ฒด์ œ ๋…๋ฆฝ์„ฑ, ์ปดํŒŒ์ผ ๋œ ์ฝ”๋“œ์˜ ์ž‘์€ ํฌ๊ธฐ ๋ฐ ์•…์„ฑ ํ”„๋กœ๊ทธ๋žจ์œผ๋กœ๋ถ€ํ„ฐ ์‚ฌ์šฉ์ž๋ฅผ ๋ณดํ˜ธํ•˜๋Š” ๊ธฐ๋Šฅ์„ ๋‹ด๋‹นํ•˜๋Š” ๊ธฐ์ˆ ์˜ ๊ตฌ์„ฑ ์š”์†Œ์ž…๋‹ˆ๋‹ค. - Oracle JVM ๋ฌธ์„œ

์ผ๋ฐ˜ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ OS์™€ ๋ฐ”๋กœ ๋งž๋ถ™์–ด ์žˆ๊ธฐ ๋•Œ๋ฌธ์— OS์— ์ข…์†์ ์ด๋‹ค. ์ข…์†์ ์ด๋ผ ํ•จ์€ OS์— ๋ณ€๋™์ด ์ƒ๊ธธ๋•Œ๋งˆ๋‹ค ๊ทธ์— ๋งž๊ฒŒ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜๋„ ๋ณ€๊ฒฝํ•ด์•ผํ•œ๋‹ค.
๋ฐ˜๋ฉด JAVA ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜์€ JVM๊ณผ ์ƒํ˜ธ์ž‘์šฉ์„ ํ•˜๊ธฐ๋•Œ๋ฌธ์— OS์™€ ํ•˜๋“œ์›จ์–ด์— ๋…๋ฆฝ์ ์ด๊ฒŒ ๋˜๋ฉฐ ๋‹ค๋ฅธ OS์—์„œ๋„ ์• ํ”Œ๋ฆฌ์ผ€์ด์…˜ ์ˆ˜์ •์—†์ด ์‹คํ–‰์ด ๊ฐ€๋Šฅํ•˜๋‹ค. (๋Œ€์‹  JVM์ด OS์ข…์†์ ์ด๊ธฐ ๋•Œ๋ฌธ์— ํ•ด๋‹นํ•˜๋Š” OS์— ๋งž๋Š” JVM์ด ํ•„์š”ํ•˜๋‹ค.)

๊ทธ๋ฆฌํ•˜์—ฌ ์ž๋ฐ”์˜ ์ค‘์š”ํ•œ ์žฅ์ ์ค‘์˜ ํ•˜๋‚˜์ธ โ€œWrite once, run anywhere. ํ•œ ๋ฒˆ ์ž‘์„ฑํ•˜๋ฉด ์–ด๋””์„œ๋“  ์‹คํ–‰๋œ๋‹ค.โ€๊ฐ€ ๊ฐ€๋Šฅํ•˜๊ฒŒ ๋˜๋Š” ๊ฒƒ์ด๋‹ค!

์ปดํŒŒ์ผํ•˜๋Š” ๋ฐฉ๋ฒ•&์‹คํ–‰ํ•˜๋Š” ๋ฐฉ๋ฒ•

๊ธฐ๋ณธ์ ์ธ ์‹คํ–‰ํ๋ฆ„ : ์†Œ์Šค์ฝ”๋“œ ์ž‘์„ฑ(.java) -> ์ปดํŒŒ์ผ(.class) -> ์ปดํŒŒ์ผ ๋œ classํŒŒ์ผ์„ JVM์—์„œ ์‹คํ–‰

compiler
๊ทธ๋ฆผ์ถœ์ฒ˜ : guru99.com

// ์ปดํŒŒ์ผ
$ javac fileName.java

// ์‹คํ–‰
$ java fileName.class

์‚ฌ์‹ค ์ด๋ ‡๊ฒŒ ํ•˜๋‚˜ํ•˜๋‚˜ ์ปดํŒŒ์ผํ•˜๊ณ  ์‹คํ–‰ํ•  ์ผ์€ ๊ฑฐ์˜ ์—†๋‹ค. ์‚ฌ์šฉํ•˜๊ณ  ์žˆ๋Š” IDE ์—์„œ ๊ฐ„๋‹จํ•˜๊ฒŒ ์‹คํ–‰๋ฒ„ํŠผ์œผ๋กœ ์‹คํ–‰ํ•˜๋ฉด ๋œ๋‹ค.

Q.์ƒ์œ„๋ฒ„์ „์˜ ์ž๋ฐ”๋กœ ์ปดํŒŒ์ผ์„ ํ•œ ํ›„ ํ•ด๋‹น ํด๋ž˜์ŠคํŒŒ์ผ์„ ํ•˜์œ„ ๋ฒ„์ „์˜ ์ž๋ฐ”๋กœ ์‹คํ–‰์ด ๋ ๊นŒ ? -> ์•ˆ๋œ๋‹ค.

๋ฐ˜๋Œ€๋กœ ํ•˜์œ„๋ฒ„์ „์˜ ํด๋ž˜์ŠคํŒŒ์ผ์€ ์ƒ์œ„๋ฒ„์ „์˜ ์ž๋ฐ”์—์„œ ์‹คํ–‰ํ•  ์ˆ˜ ์žˆ๋‹ค.

์—ฌ๊ธฐ์„œ ์ž๋ฐ” ์ปดํŒŒ์ผ ์˜ต์…˜์„ ์ƒ๊ฐํ•ด๋ณผ ์ˆ˜ ์žˆ์œผ๋ฉฐ javac -help ๋กœ ์ „์ฒด ์˜ต์…˜์„ ํ™•์ธํ•ด๋ณด๋ฉด ์•„๋ž˜์™€ ๊ฐ™๋‹ค.

โžœ  $ javac -help
Usage: javac <options> <source files>
where possible options include:
  -g                         Generate all debugging info
  -g:none                    Generate no debugging info
  -g:{lines,vars,source}     Generate only some debugging info
  -nowarn                    Generate no warnings
  -verbose                   Output messages about what the compiler is doing
  -deprecation               Output source locations where deprecated APIs are used
  -classpath <path>          Specify where to find user class files and annotation processors
  -cp <path>                 Specify where to find user class files and annotation processors
  -sourcepath <path>         Specify where to find input source files
  -bootclasspath <path>      Override location of bootstrap class files
  -extdirs <dirs>            Override location of installed extensions
  -endorseddirs <dirs>       Override location of endorsed standards path
  -proc:{none,only}          Control whether annotation processing and/or compilation is done.
  -processor <class1>[,<class2>,<class3>...] Names of the annotation processors to run; bypasses default discovery process
  -processorpath <path>      Specify where to find annotation processors
  -parameters                Generate metadata for reflection on method parameters
  -d <directory>             Specify where to place generated class files
  -s <directory>             Specify where to place generated source files
  -h <directory>             Specify where to place generated native header files
  -implicit:{none,class}     Specify whether or not to generate class files for implicitly referenced files
  -encoding <encoding>       Specify character encoding used by source files
  -source <release>          Provide source compatibility with specified release
  -target <release>          Generate class files for specific VM version
  -profile <profile>         Check that API used is available in the specified profile
  -version                   Version information
  -help                      Print a synopsis of standard options
  -Akey[=value]              Options to pass to annotation processors
  -X                         Print a synopsis of nonstandard options
  -J<flag>                   Pass <flag> directly to the runtime system
  -Werror                    Terminate compilation if warnings occur
  @<filename>                Read options and filenames from file

์ตœ๊ทผ ์Šคํ”„๋ง ํ”„๋ ˆ์ž„์›Œํฌ์—์„œ ์ž๋ฐ”15๋ฅผ ์ง€์›ํ•˜๊ฒŒ ๋˜์—ˆ๊ณ  ์ตœ์†Œ ์ง€์› ์ž๋ฐ”๋ฒ„์ „์€ 8 ์ด์ƒ์ด์—ฌ์•ผ ํ•œ๋‹ค. ์ฆ‰, ์ปดํŒŒ์ผํ• ๋•Œ ์˜ต์…˜์„ ์ฃผ์—ˆ๊ธฐ ๋•Œ๋ฌธ์—(source, target ์˜ต์…˜) ์ž๋ฐ”8~15๊นŒ์ง€์˜ ๋ฒ„์ „์—์„œ ์‚ฌ์šฉ๊ฐ€๋Šฅํ•˜๋‹ค.

*๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋‚˜ ํ”„๋ ˆ์ž„์›Œํฌ๋ฅผ ์ง€์›ํ•˜๋Š” ์ž…์žฅ์—์„œ๋Š” ๊ผญ ์ดํ•ดํ•˜๊ณ  ์žˆ์–ด์•ผ ํ•˜๋Š” ๋ถ€๋ถ„ (์ด์ง€๋งŒ, ์ •๋ง ์•ˆํƒ€๊น๊ฒŒ๋„ ์ผ๋ถ€ ๋ฉ”์ด๋ธ ํ”Œ๋Ÿฌ๊ทธ์ธ์—์„œ ์ž๋ฐ”9๋กœ๋งŒ ์ปดํŒŒ์ผ์„ ํ•˜๊ณ  ํŒจํ‚ค์ง•์„ ํ•ด๋ฒ„๋ฆฌ๊ธฐ๋„โ€ฆ)

๊ทธ๋ž˜์„œ..! ์ด๋Ÿฐ ๊ฒฝ์šฐ ๋ฐœ์ƒ๋œ ์—๋Ÿฌ ๋ฉ”์„ธ์ง€๋ฅผ ์ฝ๊ณ  ์ด ๊ฒฝ์šฐ์ž„์„ ์•Œ์•„์•ผ ํ•œ๋‹ค.
UnsupportedClassVersionError

class file version 58.0๋ฒ„์ „(์ž๋ฐ”14๋ฒ„์ „)์œผ๋กœ ์ปดํŒŒ์ผ๋œ ํŒŒ์ผ์„ 52.0๋ฒ„์ „(์ž๋ฐ”8)์œผ๋กœ ์‹คํ–‰ํ•ด์„œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ์–ด.

// ๋‹ค๋ฅธ๋ฒ„์ „(์˜ˆ 14๋ฒ„์ „)์œผ๋กœ ์ž‘์„ฑ๋œ ์†Œ์Šค๋ฅผ 8๋ฒ„์ „ ํƒ€๊ฒŸ์œผ๋กœ ์ปดํŒŒ์ผ
$ javac FileName.java -source 1.8 -target 1.8

//ํด๋ž˜์ŠคํŒŒ์ผ์˜ ๋ฒ„์ „์„ ํ™•์ธํ•˜๋ ค๋ฉด javap ๋กœ ํ™•์ธ๊ฐ€๋Šฅ
//ํ•ด๋‹น ํด๋ž˜์ŠคํŒŒ์ผ์˜ ํ˜ธํ™˜ ๋ฒ„์ „ ํ™•์ธ ๋ฐฉ๋ฒ•
$ javap -verbos class๋ช… | find /N "version"

๋” ์ž์„ธํ•œ ๋‚ด์šฉ์€ ๐Ÿ‘‰ ์˜ค๋ผํด 11๋ฒ„์ „ javac ๋ฌธ์„œ , ์˜ค๋ผํด 11๋ฒ„์ „ javap ๋ฌธ์„œ

๋ˆ„๊ตฐ๊ฐ€๋Š” ๊ถ๊ธˆํ•ด ํ•  ์ง€๋„ ๋ชจ๋ฅธ๋‹ค.
Q. ๋ฌด์กฐ๊ฑด ๋ฒ„์ „์„ ๋‚ฎ์ถ”์–ด ์ปดํŒŒ์ผํ•˜๋ฉด ๋‹ค ๋˜๋Š”๊ฒŒ ์•„๋‹Œ๊ฐ€?
A. ์ปดํŒŒ์ผ๋Ÿฌ๋„ ๋ฒ„์ „์ด ์˜ฌ๋ผ๊ฐˆ์ˆ˜๋ก ์„ฑ๋Šฅ์ด ์ข‹์•„์ง€๊ธฐ๋•Œ๋ฌธ์— ๋˜๋„๋ก ์ƒ์œ„๋ฒ„์ „์œผ๋กœ ์ปดํŒŒ์ผ์„ ํ•˜๋Š”๊ฒƒ์ด ์ข‹๊ณ , ํ•˜์œ„๋ฒ„์ „์œผ๋กœ ์ปดํŒŒ์ผํ•œ ๋ฐ”์ดํŠธ์ฝ”๋“œ๊ฐ€ ๊ณผ์—ฐ ํšจ์œจ์ ์ธ ์ฝ”๋“œ์ผ๊นŒ? ๋Š” ์•„๋‹์ง€๋„. ๊ฐ ๋ฒ„์ „์˜ ์ปดํŒŒ์ผ๋Ÿฌ๋กœ ์ปดํŒŒ์ผํ•œ ๋ฐ”์ดํŠธ์ฝ”๋“œ๊ฐ€ ๊ฐ€์žฅ ์ตœ์ ํ™” ๋˜์–ด์žˆ์„ ๊ฒƒ.

๊ทธ๋ž˜์„œ ๋ฐ”์ดํŠธ์ฝ”๋“œ? ํด๋ž˜์Šค ํŒŒ์ผ ์•ˆ์— ๋“ค์–ด์žˆ๋Š” ๊ฒƒ์ด ๋ฐ”์ดํŠธ์ฝ”๋“œ !
( * โ€˜๋ฐ”์ดํŠธ ์ฝ”๋“œโ€™ ์•„๋‹ˆ๊ณ  โ€˜๋ฐ”์ดํŠธ์ฝ”๋“œโ€™< )

// javap ๋กœ ๋ฐ”์ดํŠธ์ฝ”๋“œ๋ฅผ ๋ณด๋ฉด ์‚ฌ๋žŒ์ด ์ฝ์„ ์ˆ˜ ์žˆ๋Š” ํ˜•ํƒœ(OP์ฝ”๋“œ)๋กœ ํ•ด์„ํ•ด์„œ ๋ณด์—ฌ์คŒ
$ javap -c Hello.class

public class Hello {
  public Hello();
    Code:
      0: aload_0
      1: invokespecial  #1      // Method java/lang/Object."<init>":()V
      4: return

  public static void main(java.lang.String[]);
    Code:
      0: getstatic      #7      // Field java/lang/System.out:Ljava/io/PrintStream;
      3: ldc            #13     // String Hello java
      5: invokevirtual  #15     // Method java/io/PrintStream.println:(Ljava/lang/String;)V
      8: return
}

OP ์ฝ”๋“œ = Operation Code
์ปดํ“จํ„ฐ ๊ณผํ•™์—์„œ ๋ช…๋ น ์ฝ”๋“œ(opcodeโ†operation code, instruction syllable, instruction parcel, opstring)๋Š” ๊ธฐ๊ณ„์–ด์˜ ์ผ๋ถ€์ด๋ฉฐ ์ˆ˜ํ–‰ํ•  ๋ช…๋ น์–ด๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ๋ถ€ํ˜ธ๋ฅผ ๋งํ•œ๋‹ค. ์ด์— ๋Œ€ํ•œ ๊ทœ๊ฒฉ๊ณผ ํ˜•์‹์€ ํ”„๋กœ์„ธ์„œ ๋ช…๋ น์–ด ์ง‘ํ•ฉ์— ๋‚˜์™€ ์žˆ๋‹ค. (ํ”„๋กœ์„ธ์„œ๋Š” ์ผ๋ฐ˜ CPU์ผ ์ˆ˜๋„ ์žˆ๊ณ  ํŠน๋ณ„ํ•œ ์ฒ˜๋ฆฌ ์žฅ์น˜์ผ ์ˆ˜๋„ ์žˆ๋‹ค) ๊ธฐ๊ณ„์–ด ๋ช…๋ น์–ด(Instruction)๋Š” ๋ช…๋ น์–ด๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” opcode๋ฅผ ๊ฐ€์ง€๋ฉฐ, ์ผ๋ฐ˜์ ์œผ๋กœ ํ”ผ์—ฐ์‚ฐ์ž๋ฅผ ๋‚˜ํƒ€๋‚ด๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ์ง€์ •์ž๋ฅผ ๊ฐ€์ง„๋‹ค. - ์œ„ํ‚ค๋ฐฑ๊ณผ
*์—ฌ๊ธฐ์—์„œ๋Š” ์ž๋ฐ”์—์„œ ์ •๋ฆฌํ•ด๋‘” ๊ฐ๊ฐ์˜ ๋ช…๋ น์–ด๋“ค์ด ํ•œ ์ค„์”ฉ ํ•ด์„๋˜์–ด ์žˆ๋Š”๊ฒƒ์œผ๋กœ ์ดํ•ดํ•˜๋ฉด ๋จ

๋ฐ”์ดํŠธ์ฝ”๋“œ์ธ ์ด์œ ๊ฐ€ ํ•œ ์ค„์˜ OP์ฝ”๋“œ๊ฐ€ 1byte ๋ผ์„œ ๋ฐ”์ดํŠธ์ฝ”๋“œ๋‹ค. ์šฐ๋ฆฌ๋ˆˆ์—๋Š” ์ง€๊ธˆ String ์œผ๋กœ ๋ณด์ด์ง€๋งŒ ใ…Žใ…Ž

JIT ์ปดํŒŒ์ผ๋Ÿฌ๋ž€ ๋ฌด์—‡์ด๋ฉฐ ์–ด๋–ป๊ฒŒ ๋™์ž‘ํ•˜๋Š”๊ฐ€

JIT = Just In Time
javac ์™€ ์ „ํ˜€ ๊ด€๋ จ ์—†๋‹ค. ์ž๋ฐ”๋ฅผ ๊ฐ€์ง€๊ณ  ํ”„๋กœ๊ทธ๋žจ์„ ์‹คํ–‰ํ• ๋•Œ ๊ด€๋ จ์žˆ๋Š” ์ปดํŒŒ์ผ๋Ÿฌ(jvm์ด ์‹คํ–‰ํ•˜๋Š”).
์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•  ๋•Œ ์ธํ„ฐํ”„๋ฆฌํ„ฐ๊ฐ€ line by line ์œผ๋กœ ๋ฐ”์ดํŠธ์ฝ”๋“œ๋ฅผ ๊ธฐ๊ณ„์–ด๋กœ ๋ฒˆ์—ญํ•ด์„œ ์‹คํ–‰ ํ•˜๊ณ , ์ž์ฃผ ์‹คํ–‰ํ•˜๋Š” ์ฝ”๋“œ๊ฐ€ ์žˆ๋‹ค๋ฉด JIT์ด ๋ฒˆ์—ญ๋œ ๊ธฐ๊ณ„์–ด๋ฅผ ์บ์‹ฑํ•ด ์žฌ์‚ฌ์šฉํ•œ๋‹ค(jvm๋‚ด๋ถ€์— ์บ์‹ฑ๋จ).
์ธํ„ฐํ”„๋ฆฌํ„ฐ๊ฐ€ ๋งค๋ฒˆ ๊ธฐ๊ณ„์–ด๋กœ ๋ฒˆ์—ญํ•˜์ง€ ์•Š๊ณ  ๋ฐ”๋กœ ํ•ด์„๋œ ๊ฒƒ์„ ๊ฐ€์ ธ๋‹ค ์‚ฌ์šฉํ•˜๊ธฐ ๋•Œ๋ฌธ์— ๋น ๋ฅด๋‹ค.(*JIT ์ž์ฒด๊ฐ€ ๋น ๋ฅธ๊ฒƒ์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜๋ฉด ์•ˆ๋จ)
jvm์˜ ๋Ÿฐํƒ€์ž„ ์˜์—ญ์— ๋“ค์–ด๊ฐ€ ์žˆ์œผ๋ฉฐ JIT์€ ์ผ์ข…์˜ ์“ฐ๋ ˆ๋“œ๋กœ ๋™์ž‘ํ•˜๊ณ  ์ธํ„ฐํ”„๋ฆฌํ„ฐ๋„ ๊ฐ™์ด ๋™์ž‘ํ•œ๋‹ค. ์ฆ‰ ๋™์‹œ์— ์ง„ํ–‰๋˜๋Š” ํ˜•ํƒœ.

JVM ๊ตฌ์„ฑ ์š”์†Œ

Oracle JVM Structure ๋ฌธ์„œ ์˜์–ด๋ฅผ ์ž˜ํ•ด์„œ ์ˆ ์ˆ ์ฝ๊ณ  ์‹ถ๋‹ค..

2.5. ๋Ÿฐํƒ€์ž„ ๋ฐ์ดํ„ฐ ์˜์—ญ
2.5.1. pc ๋ ˆ์ง€์Šคํ„ฐ
2.5.2. ์ž๋ฐ” ๊ฐ€์ƒ ๋จธ์‹  Stack
2.5.3. Heap
2.5.4. Class (Method) ์˜์—ญ
2.5.5. Run-Time Constant Pool
2.5.6. Native Method Stacks

๋ฌธ์„œ 2.5 ๋ถ€๋ถ„์— ๋ณด๋ฉด ์ด๋Ÿฐ๊ฒƒ๋“ค์ด ๋ณด์ธ๋‹ค. ์Œ ์—ญ์‹œ ์ž˜ ๋ชจ๋ฅด๊ฒ ์œผ๋‹ˆ ๊ทธ๋ฆผ์„ ์ฐพ์•„๋ณด์ž.

JVM-Architecture-diagram
๊ทธ๋ฆผ์ถœ์ฒ˜ : geeksforgeeks.org