This commit is contained in:
Sander Hautvast 2023-09-30 18:20:00 +02:00
parent 027fd99312
commit 8effcda91a
2 changed files with 25 additions and 2 deletions

View file

@ -1 +1,22 @@
**So you wanted to build a JVM**
_as in why not???_
actually:
`System.out.println("Hello World")` would actually be a major achievement. It's nowhere near that level...
**so far**
* starts a main class (TODO cmdline args)
* loads classes from a classpath, including jar/jmod files
* instantiates classes (TODO implement superclass instantiation)
* runs bytecode (TODO more opcodes)
* has INVOKEVIRTUAL and INVOKESPECIAL, including stackframes (TODO more invokes)
**more TODO's**
* native methods
* stacktraces
* check visibility
* IO
**Ultimate goal**
* Hello world domination

View file

@ -73,6 +73,7 @@ impl Vm {
}
pub fn new_instance(&self, class: Arc<Class>) -> Object {
//TODO add fields from superclasses
let mut data = HashMap::new();
for f in &class.fields {
let value = match f.type_of().as_str() {
@ -263,11 +264,12 @@ impl Vm {
//TODO implement all opcodes
_ => {
panic!("opcode not implemented {:?}", self.stack)
//TODO implement proper stacktraces
}
}
}
}
Err(anyhow!("should not happen"))
panic!("should not happen")
}
}