Implemented Exception Throwing

This commit is contained in:
vegowotenks 2024-11-12 14:34:42 +01:00
parent f5428c79b2
commit 8e5b6bb2b8
5 changed files with 224 additions and 9 deletions

View file

@ -461,6 +461,14 @@ impl JavaLangThrowable {
}
}
struct JdkInternalMiscCDS {}
impl JdkInternalMiscCDS {
fn get_cds_config_status(_jvm: &mut JVM) -> Result<JVMCallbackOperation, Error> {
return Ok(JVMCallbackOperation::ReturnFrame(FieldValue::Int(0)));
}
}
struct JdkInternalMiscUnsafe {}
impl JdkInternalMiscUnsafe {
@ -2949,6 +2957,185 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul
},
JavaLangThrowable::fill_in_stacktrace
),
(
"java/lang/invoke/MethodHandle",
"invokeExact",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
},
todo_call
),
(
"java/lang/invoke/MethodHandle",
"invoke",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
},
todo_call
),
(
"java/lang/invoke/MethodHandle",
"invokeBasic",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
},
todo_call
),
(
"java/lang/invoke/MethodHandle",
"linkToVirtual",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
},
todo_call
),
(
"java/lang/invoke/MethodHandle",
"linkToStatic",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
},
todo_call
),
(
"java/lang/invoke/MethodHandle",
"linkToSpecial",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
},
todo_call
),
(
"java/lang/invoke/MethodHandle",
"linkToInterface",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
},
todo_call
),
(
"java/lang/invoke/MethodHandle",
"linkToNative",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())},
},
todo_call
),
(
"jdk/internal/misc/CDS",
"getCDSConfigStatus",
MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() },
},
JdkInternalMiscCDS::get_cds_config_status
),
(
"jdk/internal/misc/CDS",
"logLambdaFormInvoker",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
},
todo_call
),
(
"jdk/internal/misc/CDS",
"initializeFromArchive",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
},
ignore_call // TODO: idk
),
(
"jdk/internal/misc/CDS",
"defineArchivedModules",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/ClassLoader".to_string())},
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/ClassLoader".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
},
todo_call
),
(
"jdk/internal/misc/CDS",
"getRandomSeedForDumping",
MethodDescriptor {
argument_types: Box::new([
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() },
},
todo_call
),
(
"jdk/internal/misc/CDS",
"dumpClassList",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
},
todo_call
),
(
"jdk/internal/misc/CDS",
"dumpDynamicArchive",
MethodDescriptor {
argument_types: Box::new([
AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string())},
]),
return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() },
},
todo_call
),
];
for (classname, methodname, methoddescriptor, binding) in native_mappings {