• 沉淀的梦想
    2019-10-16
    老师,栈顶为什么要16字节对齐呢?

    作者回复: 调用约定。 可以参考一下https://en.wikipedia.org/wiki/X86_calling_conventions

    "In Linux, GCC sets the de facto standard for calling conventions. Since GCC version 4.5, the stack must be aligned to a 16-byte boundary when calling a function (previous versions only required a 4-byte alignment.)"

    如果不遵守这个调用约定,有些功能会出错。比如调试的时候。

    还可以参考一下这篇:https://software.intel.com/en-us/forums/intel-isa-extensions/topic/291241

    
    
  • 沉淀的梦想
    2019-10-16
    https://github.com/RichardGong/PlayWithCompiler/blob/d1f393d98000e8e9a7b22b870b690cd80de35bae/playscript-java/src/main/play/AsmGen.java#L470

    这一行是不是应该改成`Function function = (Function) at.node2Scope.get(ctx);`,不然运行时会出现空指针异常

    作者回复: 是的,我后来似乎改过了。因为修改了一些语义分析的代码,使得一些类型信息不再保存在AnnotatedTree.typeOfNode中了。

    我抽时间应该加上一些自动的测试用例,避免修改一个地方,让另一个地方break掉。

    
    
我们在线,来聊聊吧