jvm 第5章 jvm 指令集和解释器
1,https://github.com/zxh0/jvmgo-book提供的源代码
package main import "fmt" import "jvmgo/ch05/classfile" import "jvmgo/ch05/instructions" import "jvmgo/ch05/instructions/base" import "jvmgo/ch05/rtda" func interpret(methodInfo *classfile.MemberInfo) { codeAttr := methodInfo.CodeAttribute() maxLocals := codeAttr.MaxLocals() maxStack := codeAttr.MaxStack() bytecode := codeAttr.Code() fmt.Printf("IMF code: %v\n",bytecode) thread := rtda.NewThread() frame := thread.NewFrame(maxLocals, maxStack) thread.PushFrame(frame) defer catchErr(frame) loop(thread, bytecode) } 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) } } func loop(thread *rtda.Thread, bytecode []byte) { frame := thread.PopFrame() reader := &base.BytecodeReader{} for { pc := frame.NextPC() thread.SetPC(pc) // decode reader.Reset(bytecode, pc) opcode := reader.ReadUint8() fmt.Printf("IMF opcode: %v\n",opcode) inst := instructions.NewInstruction(opcode) inst.FetchOperands(reader) frame.SetNextPC(reader.PC()) // execute fmt.Printf("pc:%2d inst:%T %v\n", pc, inst, inst) inst.Execute(frame) } }
2,写一个简单的java代码
package jvmgo.book.ch05; public class Ch05addTest { public static void main(String[] args) { int sum = 0; for (int i = 1; i
- 计算机视觉系列 -MMDetection 之MobileNetV2YOLOV3 经典算法(一)
- Rasa 3.x 学习系列- Rasa - Issues 4635:Make Rasa X model pull interval configurable in local mode
- Rasa 3.x 学习系列- Rasa - Issues 4759:Training Luis data with luis_schema_version higher than 4.x.x will
- Rasa 3.x 学习系列- Rasa - Issues 4799 rasa interactive does not work without nlu data
- Rasa 3.x 学习系列- Rasa - Issues 4917 Support S3 namespaces when retrieving models from buckets
- Rasa 3.x 学习系列- Rasa - Issues 4925 “rasa init” will ask if user wants to train a model
- Rasa 3.x 学习系列- Rasa - Issues 4985 Fix errors during training in ResponseSelector学习笔记
- Rasa 3.x 学习系列- Rasa - Issues 4933 Improved error message that appears when an incorrect paramete学习笔记
- Rasa 3.x 学习系列- Rasa - Issues 4792 socket debug logs clog up debug feed学习笔记
- Rasa 3.x 学习系列- Rasa - Issues 4873 dispatcher.utter_message 学习笔记