Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ch06 运行结果有异常 #33

Closed
lvxinrong opened this issue Nov 14, 2019 · 2 comments
Closed

ch06 运行结果有异常 #33

lvxinrong opened this issue Nov 14, 2019 · 2 comments

Comments

@lvxinrong
Copy link

作者您好,在拜读您的著作 自己动手写Java虚拟机。在运行ch06的代码的时候,发现有两处和书本结果不同的地方

  1. facoty.go 不支持0xb1 在运行的时候会抛出异常
  2. 在参照ch07的时候,发现会多出一个栈信息 pc:53 inst:*control.RETURN{}.然后提示jvm stack is empty 个人理解为这个时候return是结束标示,操作栈中应该是空,因此删除了frame.Thread().PopFrame()。此时提示index out of range。

如果想和书本上的运行结果一致,应该如何修改ch06的代码,谢谢

@zxh0
Copy link
Owner

zxh0 commented Nov 15, 2019

你好,能提供一下具体的代码吗?比如把你自己写的ch06、ch07代码zip一下传上来。或者加入这本书的读者群交流更方便一些。

@zxh0 zxh0 closed this as completed Feb 21, 2020
@IamChuancey
Copy link

@lvxinrong 这个错误是因为
func catchErr(frame *rtda.Frame) {
if r := recover(); r != nil {
fmt.Printf("LocalVars:%v\n", frame.LocalVars())
fmt.Printf("OperandStack:%v\n", frame.OperandStack())
panic(r)
}
}
这个错误属于正常报错,只需将其注释掉就行。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants