java百问总结(三)

1.How Compiler is works?

    Compiler consists the following phases: Lexical Analysis, Syntax Analysis, Semantic Analysis, IR Generation, IR Optimization, Code Generation, Optimization.  //编译器主要包括下面几个阶段:词法分析,语法分析,语义分析,生成IR,IR优化,代码生成,优化。

2.Type Checking for Object Oriented Features

    This post is about how object oriented features such as inheritance, overloading and overriding affect type checking. A type error occurs when an argument of an unexpected type is given to an operation. It can be signalled at compile time or at run time.

     ①.Inheritance:

         |-- Need to consider shape of class hierarchies.

         |-- When the least upper bound of A and B exists, we denote it A ∐ B.

    ②. Function overloading:

        |-- At compile-time, determine which function is mean by inspecting the types of the arguments. Report an error if no one function is the best function.

    ③. Function overriding:

        |-- Determine at run-time based on real object.

    Note: static type systems are often incomplete. So the goal is to make the language as expressive as possible while still making the type-checker sound.

3. What do Java objects look like in memory during run-time?

    Java methods are implemented as a stack(栈) of frames(帧) in JVM Stack and Java objects are allocated in Heap(堆).  // stack of frames “栈帧由三部分组成:局部变量区、操作数栈和栈数据区。

    

 

    




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值