From 64eef60c4e1d3f0565791cf563b9e47728dd3b0e Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Mon, 9 Sep 2024 17:01:08 +0200 Subject: [PATCH] Boilerplate is my hobby --- src/native_methods.rs | 1512 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1512 insertions(+) diff --git a/src/native_methods.rs b/src/native_methods.rs index 8aaf95b..7bcf502 100644 --- a/src/native_methods.rs +++ b/src/native_methods.rs @@ -582,6 +582,7 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul Ok(todo_call) } + ("java/lang/Object", "wait0") => { let expected_descriptor = MethodDescriptor { argument_types: Box::new([ @@ -597,6 +598,1517 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul Ok(todo_call) } + ("java/lang/System", "arraycopy") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("java/lang/System", "currentTimeMillis") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("java/lang/System", "identityHashCode") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("java/lang/System", "mapLibraryName") => { + let expected_descriptor = 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::Classname("java/lang/String".to_string()) }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("java/lang/System", "nanoTime") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("java/lang/System", "registerNatives") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(ignore_call) + } + + ("java/lang/System", "setIn0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/io/InputStream".to_string()) } + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("java/lang/System", "setOut0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/io/PrintStream".to_string()) } + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("java/lang/System", "setErr0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/io/PrintStream".to_string()) } + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "arrayBaseOffset0") => { + let expected_descriptor = 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::Int() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "arrayIndexScale0") => { + let expected_descriptor = 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::Int() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "allocateInstance") => { + let expected_descriptor = 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::Classname(String::from("java/lang/Object"))}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "allocateMemory0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "copyMemory0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "copySwapMemory0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "freeMemory0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "reallocateMemory0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "setMemory0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "compareAndSetBoolean") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndSetByte") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndSetChar") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndSetDouble") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndSetFloat") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "compareAndSetInt") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "compareAndSetLong") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "compareAndSetReference") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "compareAndSetShort") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "compareAndExchangeBoolean") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndExchangeByte") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndExchangeChar") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndExchangeDouble") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndExchangeFloat") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "compareAndExchangeInt") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "compareAndExchangeLong") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndExchangeShort") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "compareAndExchangeReference") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "defineClass0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) }, + AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Byte() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/ClassLoader".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/security/ProtectionDomain".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Class"))}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "ensureClassInitialized0") => { + let expected_descriptor = 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() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "fullFence") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getBooleanVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "getByteVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "getCharVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "getFloatVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "getDoubleVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "getIntVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "getLongVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "getShortVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "getReferenceVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getBoolean") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getByte") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getChar") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getDouble") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getFloat") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getInt") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getLoadAverage0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Double() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getLong") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getReference") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getShort") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "getUncompressedObject") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "objectFieldOffset0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/reflect/Field".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "objectFieldOffset1") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "registerNatives") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(ignore_call) + } + + ("jdk/internal/misc/Unsafe", "park") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "putBoolean") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putByte") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putChar") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putDouble") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putFloat") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putInt") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putLong") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "putReference") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "putShort") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "putBooleanVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putByteVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putCharVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putFloatVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putDoubleVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putIntVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putLongVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putShortVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + + ("jdk/internal/misc/Unsafe", "putReferenceVolatile") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "shouldBeInitialized0") => { + let expected_descriptor = 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::Boolean() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "staticFieldOffset0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/reflect/Field".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "staticFieldOffset1") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "staticFieldBase0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/reflect/Field".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + // This will require some changes in the future + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "unpark") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "throwException") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Throwable".to_string()) }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "writeback0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "writebackPostSync0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + + ("jdk/internal/misc/Unsafe", "writebackPreSync0") => { + let expected_descriptor = MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }; + + if m.descriptor != expected_descriptor { + return Err(Error::RunTimeError(format!("Native descriptor mismatch for method '{class_name}.{method_name}': found '{}' but expected '{}'", m.descriptor.source_string(), expected_descriptor.source_string()))); + } + + Ok(todo_call) + } + _ => Err(Error::RunTimeError(format!("Failed to find native implementation for method '{class_name}.{method_name}'"))), }