readme
This commit is contained in:
parent
027fd99312
commit
8effcda91a
2 changed files with 25 additions and 2 deletions
21
README.md
21
README.md
|
|
@ -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...
|
`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
|
||||||
|
|
@ -73,6 +73,7 @@ impl Vm {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn new_instance(&self, class: Arc<Class>) -> Object {
|
pub fn new_instance(&self, class: Arc<Class>) -> Object {
|
||||||
|
//TODO add fields from superclasses
|
||||||
let mut data = HashMap::new();
|
let mut data = HashMap::new();
|
||||||
for f in &class.fields {
|
for f in &class.fields {
|
||||||
let value = match f.type_of().as_str() {
|
let value = match f.type_of().as_str() {
|
||||||
|
|
@ -263,11 +264,12 @@ impl Vm {
|
||||||
//TODO implement all opcodes
|
//TODO implement all opcodes
|
||||||
_ => {
|
_ => {
|
||||||
panic!("opcode not implemented {:?}", self.stack)
|
panic!("opcode not implemented {:?}", self.stack)
|
||||||
|
//TODO implement proper stacktraces
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(anyhow!("should not happen"))
|
panic!("should not happen")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue