Struct rust_jvm::vm::class_loader::ClassLoader
[−]
[src]
pub struct ClassLoader { classes: HashMap<Class, Rc<Class>>, pending: HashSet<Class>, }
A class loader suitable for loading classes into the JVM.
Fields
classes | The classes that have already been resolved by this class loader. |
pending | The signatures of classes that have not yet been resolved by this class loader. |
Methods
impl ClassLoader
fn new() -> ClassLoader
fn find_class_bytes(&mut self, name: &str) -> Result<Vec<u8>, Error>
Given a class name, read the bytes from the corresponding class file.
fn get_class_ref(rcp: &RuntimeConstantPool, index: u16) -> Result<&Class, Error>
Get the symbolic reference to a class from a runtime constant pool index.
fn resolve_class(&mut self, symref: &Class) -> Result<Rc<Class>, Error>
Load a class based on a symbolic reference.
fn derive_super_class(&mut self, rcp: &RuntimeConstantPool, class_file: &ClassFile) -> Result<Option<Rc<Class>>, Error>
Derives the super class (if it exists) of the specified class.
fn derive_class(&mut self, original_name: &str, sig: &Class, class_bytes: &[u8]) -> Result<Rc<Class>, Error>
Derives the specified class and its interfaces, but not its superclass.
fn load_class_bytes(&mut self, name: &str, sig: &Class, class_bytes: &[u8]) -> Result<Rc<Class>, Error>
Attempts to create, load, and prepare the specified class from the specified bytes. The bootstrap class loader searches the current directory for a class file with the correct fully-qualified name. If none is found, the bootstrap class loader then attempts to load the class from the standard library JAR.
This implementation lazily resolves symbolic references, so no resolution of references within the loaded class is performed by this function.
This implementation does not attempt to perform bytecode verification; we assume that any class files we attempt to load are valid.
fn load_class(&mut self, sig: &Class) -> Result<Rc<Class>, Error>
Attempts to create, load, and prepare the specified class using the bootstrap class loader implementation. The bootstrap class loader searches the current directory for a class file with the correct fully-qualified name. If none is found, the bootstrap class loader then attempts to load the class from the standard library JAR.
This implementation lazily resolves symbolic references, so no resolution of references within the loaded class is performed by this function.
This implementation does not attempt to perform bytecode verification; we assume that any class files we attempt to load are valid.