From dfb6060df9e00daecf1ef7da2abd94b9a1e98fcf Mon Sep 17 00:00:00 2001 From: VegOwOtenks Date: Wed, 6 Nov 2024 23:39:26 +0100 Subject: [PATCH] Implemented opcodes, natives, fixed iterators --- src/bytecode.rs | 14 + src/heap_area.rs | 2 +- src/iterators.rs | 7 +- src/jvm.rs | 101 +- src/native_methods.rs | 2938 +++++++++++++++++++---------------------- src/stackframe.rs | 8 +- 6 files changed, 1485 insertions(+), 1585 deletions(-) diff --git a/src/bytecode.rs b/src/bytecode.rs index a88fdb3..a077f36 100644 --- a/src/bytecode.rs +++ b/src/bytecode.rs @@ -88,6 +88,8 @@ impl Bytecode { 0x5A => (Instruction::DuplicateInsertDown(), 1), 0x60 => (Instruction::AddInt(), 1), + 0x61 => (Instruction::AddLong(), 1), + 0x63 => (Instruction::AddDouble(), 1), 0x64 => (Instruction::SubtractInt(), 1), 0x65 => (Instruction::SubtractLong(), 1), 0x68 => (Instruction::MultiplyInt(), 1), @@ -95,10 +97,12 @@ impl Bytecode { 0x6A => (Instruction::MultiplyFloat(), 1), 0x6C => (Instruction::DivideInt(), 1), 0x6D => (Instruction::DivideLong(), 1), + 0x6E => (Instruction::DivideFloat(), 1), 0x74 => (Instruction::NegateInt(), 1), 0x75 => (Instruction::NegateLong(), 1), 0x78 => (Instruction::ArithmeticShiftIntLeft(), 1), + 0x79 => (Instruction::ArithmeticShiftLongLeft(), 1), 0x7A => (Instruction::ArithmeticShiftIntRight(), 1), 0x7C => (Instruction::LogicalShiftIntRight(), 1), 0x7E => (Instruction::AndInt(), 1), @@ -110,7 +114,10 @@ impl Bytecode { 0x86 => (Instruction::ConvertIntToFloat(), 1), 0x88 => (Instruction::ConvertLongToInt(), 1), + 0x89 => (Instruction::ConvertLongToFloat(), 1), 0x8B => (Instruction::ConvertFloatToInt(), 1), + 0x8D => (Instruction::ConvertFloatToDouble(), 1), + 0x8F => (Instruction::ConvertDoubleToLong(), 1), 0x91 => (Instruction::ConvertIntToByte(), 1), 0x92 => (Instruction::ConvertIntToChar(), 1), 0x94 => (Instruction::CompareLong(), 1), @@ -361,6 +368,8 @@ pub enum Instruction { DuplicateInsertDown() = 0x5A, // duplicate top stack value and insert two low AddInt() = 0x60, // int addition + AddLong() = 0x61, // long addition + AddDouble() = 0x63, // double addition SubtractInt() = 0x64, // int subtraction SubtractLong() = 0x65, // long subtraction MultiplyInt() = 0x68, // int multiplication @@ -368,10 +377,12 @@ pub enum Instruction { MultiplyFloat() = 0x6A, // float multiplication DivideInt() = 0x6C, // integer division, round toward zero and more rules DivideLong() = 0x6D, // long division + DivideFloat() = 0x6E, // float division NegateInt() = 0x74, // arithmetic negation NegateLong() = 0x75, // arithmetic negation ArithmeticShiftIntLeft() = 0x78, // shift int left, preserve sign + ArithmeticShiftLongLeft() = 0x79, // shift long left, preserve sign ArithmeticShiftIntRight() = 0x7A, // shift int right, preserve sign LogicalShiftIntRight() = 0x7C, // shift int right with zero extension AndInt() = 0x7E, // bitwise and @@ -383,7 +394,10 @@ pub enum Instruction { ConvertIntToFloat() = 0x86, // change data type ConvertLongToInt() = 0x88, // change data type + ConvertLongToFloat() = 0x89, // change data type ConvertFloatToInt() = 0x8B, // change data type + ConvertFloatToDouble() = 0x8D, // change data type + ConvertDoubleToLong() = 0x8F, // change data type ConvertIntToByte() = 0x91, // truncate int to 8 bits ConvertIntToChar() = 0x92, // truncate int to 16 bits CompareLong() = 0x94, // compare long diff --git a/src/heap_area.rs b/src/heap_area.rs index ed03cb8..ac5e3fd 100644 --- a/src/heap_area.rs +++ b/src/heap_area.rs @@ -710,7 +710,7 @@ pub struct ObjectField { pub value: FieldValue, } -#[derive(Debug, Clone, Copy)] +#[derive(Debug, Clone, Copy, PartialEq)] pub enum FieldValue { Boolean(bool), Byte(i8), diff --git a/src/iterators.rs b/src/iterators.rs index 0a44ba8..01946c0 100644 --- a/src/iterators.rs +++ b/src/iterators.rs @@ -74,14 +74,15 @@ impl <'i> Iterator for CompatibleTypesIterator<'i>{ Some(class_file.get_super_class_name().unwrap()) } else { - None + let recursive_next = self.next(); + recursive_next } } else { let interface_name = class_file.gather_class(class_file.interfaces[interface_index]).unwrap(); - let interface_index = self.class_store.class_idx_from_name(interface_name).unwrap(); + let interface_class_index = self.class_store.class_idx_from_name(interface_name).unwrap(); self.class_stack.push((class_index, interface_index + 1)); - self.class_stack.push((interface_index, 0)); + self.class_stack.push((interface_class_index, 0)); Some(interface_name) } diff --git a/src/jvm.rs b/src/jvm.rs index aadd7b3..ab5c77b 100644 --- a/src/jvm.rs +++ b/src/jvm.rs @@ -157,7 +157,7 @@ impl JVM { fn make_array_class(&mut self, element_class_ref: ObjectReference, element_descriptor: AbstractTypeDescription) { let class_class_index = self.class_store.class_idx_from_name(&"java/lang/Class".to_string()).unwrap(); - let array_class_object = self.heap_area.make_object(&self.class_store, 6); + let array_class_object = self.heap_area.make_object(&self.class_store, class_class_index); let array_class_data_object = self.heap_area.make_object(&self.class_store, 1); let array_type_description = AbstractTypeDescription { array_level: 1 + element_descriptor.array_level, @@ -341,12 +341,12 @@ impl JVM { self.class_store.add_class(entry_class, true)?; // 0 self.class_store.add_class(JVM::class_native_class_data(), true)?; // 1 - self.load_class(&"java/lang/Object".to_string())?; // 2 - self.load_class(&"java/lang/Number".to_string())?; // 3 - let byte_class_index = self.load_class(&"java/lang/Byte".to_string())?; // 4 - let string_class_index = self.load_class(&"java/lang/String".to_string())?; // 5 - let class_class_index = self.load_class(&"java/lang/Class".to_string())?; // 6 - let system_class_index = self.load_class(&"java/lang/System".to_string())?; // 7 + self.load_class_hierarchy(&"java/lang/Object".to_string())?; // 2 + self.load_class_hierarchy(&"java/lang/Number".to_string())?; // 3 + let byte_class_index = self.load_class_hierarchy(&"java/lang/Byte".to_string())?; // 4 + let string_class_index = self.load_class_hierarchy(&"java/lang/String".to_string())?; // 5 + let class_class_index = self.load_class_hierarchy(&"java/lang/Class".to_string())?; // 6 + let system_class_index = self.load_class_hierarchy(&"java/lang/System".to_string())?; // 7 self.make_class_class("Ljava/lang/Byte;"); self.make_class_class("Ljava/lang/String;"); @@ -466,15 +466,21 @@ impl JVM { Ok(()) } - fn load_class_hierarchy(&mut self, name: &String) -> Result<(), Error> { + fn load_class_hierarchy(&mut self, name: &String) -> Result { let mut waiting_queue = VecDeque::new(); waiting_queue.push_back(name.clone()); + let mut return_class_index = usize::MAX; while waiting_queue.len() != 0 { let class_name = waiting_queue.pop_front().unwrap(); if ! self.class_store.have_class(&class_name) { let new_class_index = self.load_class(&class_name)?; + + if class_name == *name { + return_class_index = new_class_index; + } + let (file, _) = self.class_store.get_class(&class_name).unwrap(); if file.has_super_class() { waiting_queue.push_back(file.get_super_class_name()?.to_string()); @@ -488,7 +494,7 @@ impl JVM { } } - Ok(()) + Ok(return_class_index) } fn init_class_hierarchy(&mut self, name: &String) -> Result<(), Error> { @@ -678,6 +684,13 @@ impl JVM { match instruction { + Instruction::AddDouble() => { + let value_0 = wrap_stackframe_error(class, method, frame.operand_stack.pop_double(0))?; + let value_1 = wrap_stackframe_error(class, method, frame.operand_stack.pop_double(0))?; + + wrap_stackframe_error(class, method, frame.operand_stack.push_double(value_0 + value_1))?; + } + Instruction::AddInt() => { let value_0 = wrap_stackframe_error(class, method, frame.operand_stack.pop_int(0))?; let value_1 = wrap_stackframe_error(class, method, frame.operand_stack.pop_int(0))?; @@ -685,6 +698,13 @@ impl JVM { wrap_stackframe_error(class, method, frame.operand_stack.push(StackValue::Int(value_0 + value_1)))?; } + Instruction::AddLong() => { + let value_0 = wrap_stackframe_error(class, method, frame.operand_stack.pop_long(0))?; + let value_1 = wrap_stackframe_error(class, method, frame.operand_stack.pop_long(0))?; + + wrap_stackframe_error(class, method, frame.operand_stack.push_long(value_0 + value_1))?; + } + Instruction::ArithmeticShiftIntLeft() => { let shift = wrap_stackframe_error(class, method, frame.operand_stack.pop_int(0))? as u8 & 0b00011111; let int = wrap_stackframe_error(class, method, frame.operand_stack.pop_int(0))?; @@ -700,6 +720,14 @@ impl JVM { wrap_stackframe_error(class, method, frame.operand_stack.push(StackValue::Int(int >> shift)))?; } + Instruction::ArithmeticShiftLongLeft() => { + let shift = wrap_stackframe_error(class, method, frame.operand_stack.pop_int(0))? as u8 % 64; + let long = wrap_stackframe_error(class, method, frame.operand_stack.pop_long(0))?; + + // rust does arithmetic shift on signed values + wrap_stackframe_error(class, method, frame.operand_stack.push_long(long << shift))?; + } + Instruction::ArrayLength() => { let array_reference = wrap_stackframe_error(class, method, frame.operand_stack.pop_reference(0))?; @@ -884,6 +912,19 @@ impl JVM { Instruction::CheckCast(classref_index) => { // TODO: Class loading checks let class_name = class.gather_class(classref_index)?; + if ! class_name.starts_with("[") { // don't load array classes + if ! self.class_store.have_class(class_name) { + // rewind the bytecode offset, I'll need to execute this instruction again + frame.instruction_pointer -= offset as u32; + return Ok(JVMCallbackOperation::LoadClass(class_name.to_string())); + } + if ! self.class_store.was_init(class_name).unwrap() { + // rewind the bytecode offset, I'll need to execute this instruction again + frame.instruction_pointer -= offset as u32; + return Ok(JVMCallbackOperation::InitClass(class_name.to_string())); + } + } + let object = wrap_stackframe_error(class, method, frame.operand_stack.pop_reference(0))?; if object != ObjectReference::NULL { let native_class_name = self.heap_area.object_area.get_reference_native_class_name(object, &self.class_store); @@ -957,6 +998,13 @@ impl JVM { wrap_stackframe_error(class, method, frame.operand_stack.push(StackValue::Int(comparison_result)))?; } + Instruction::ConvertFloatToDouble() => { + let float = wrap_stackframe_error(class, method, frame.operand_stack.pop_float(0))?; + let double = float as f64; + + wrap_stackframe_error(class, method, frame.operand_stack.push_double(double))?; + } + Instruction::ConvertFloatToInt() => { let float = wrap_stackframe_error(class, method, frame.operand_stack.pop_float(0))?; let int_value = match float { @@ -965,7 +1013,18 @@ impl JVM { v @ _ => if v.is_nan() { 0 } else { v as i32 } , }; - frame.operand_stack.push(StackValue::Int(int_value)).unwrap(); + wrap_stackframe_error(class, method, frame.operand_stack.push(StackValue::Int(int_value)))?; + } + + Instruction::ConvertDoubleToLong() => { + let double = wrap_stackframe_error(class, method, frame.operand_stack.pop_double(0))?; + let long = match double { + f64::INFINITY => i64::MAX, + f64::NEG_INFINITY => i64::MIN, + v @ _ => if v.is_nan() { 0 } else { v as i64 } + }; + + wrap_stackframe_error(class, method, frame.operand_stack.push_long(long))?; } Instruction::ConvertIntToByte() => { @@ -1003,6 +1062,21 @@ impl JVM { wrap_stackframe_error(class, method, frame.operand_stack.push(StackValue::Int(int_value)))?; } + Instruction::ConvertLongToFloat() => { + let long_value = wrap_stackframe_error(class, method, frame.operand_stack.pop_long(0))?; + let float_value = long_value as f32; + + wrap_stackframe_error(class, method, frame.operand_stack.push(StackValue::Float(float_value)))?; + } + + Instruction::DivideFloat() => { + // TODO: Obey all the rules + let quotient = wrap_stackframe_error(class, method, frame.operand_stack.pop_float(0))?; + let divident = wrap_stackframe_error(class, method, frame.operand_stack.pop_float(0))?; + + frame.operand_stack.push(StackValue::Float(divident / quotient)).unwrap(); + } + Instruction::DivideInt() => { // TODO: Obey all the rules let quotient = wrap_stackframe_error(class, method, frame.operand_stack.pop_int(0))?; @@ -1051,10 +1125,10 @@ impl JVM { // TODO: Are there any methods callable on arrays? let this_object_class_index = self.heap_area.object_area.get_object_class_index(this_object); - let this_object_class_name = self.class_store.class_name_from_index(this_object_class_index).unwrap().to_string(); + let this_object_class_name = self.class_store.class_name_from_index(this_object_class_index).unwrap(); let this_object_descriptor = AbstractTypeDescription { array_level: 0, - kind: AbstractTypeKind::Classname(this_object_class_name.clone()) + kind: AbstractTypeKind::Classname(this_object_class_name.to_string()) }; let object_descriptor = AbstractTypeDescription { array_level: 0, @@ -1815,6 +1889,9 @@ impl JVM { wrap_stackframe_error(class, method, frame.operand_stack.pop_computational_1(0))?; } + Instruction::PushConstDouble1() => { + wrap_stackframe_error(class, method, frame.operand_stack.push_double(1.0))?; + } Instruction::PushConstFloat0() => { wrap_stackframe_error(class, method, frame.operand_stack.push(StackValue::Float(0.0)))?; } diff --git a/src/native_methods.rs b/src/native_methods.rs index b64b88a..0d455f8 100644 --- a/src/native_methods.rs +++ b/src/native_methods.rs @@ -347,6 +347,48 @@ impl JavaLangStringUTF16 { struct JdkInternalMiscUnsafe {} impl JdkInternalMiscUnsafe { + pub fn compare_and_set_int(jvm: &mut JVM) -> Result { + let frame = { + let frame_index = jvm.stack_frames.len() - 1; + &mut jvm.stack_frames[frame_index] + }; + + let object = frame.load_local_reference(1).unwrap(); + let offset = frame.load_local_long(2).unwrap(); + let expected = frame.load_local_int(4).unwrap(); + let replacement = frame.load_local_int(5).unwrap(); + + let object_class_descriptor = jvm.heap_area.object_area.get_reference_native_class_name(object, &jvm.class_store); + let object_class_index = jvm.class_store.class_index_for_type(AbstractTypeDescription::parse_full(object_class_descriptor).unwrap()).unwrap(); + + let mut offset_counter = offset; + let field = match ClassFieldIterator::new(object_class_index, &jvm.class_store) + .take_while(|f| { + let result = offset_counter >= 0; + offset_counter -= f.descriptor.storage_size() as i64; + + result + }) + .last() { + Some(f) => f, + None => return Err(Error::RunTimeError(format!("Couldn't find int field at offset {offset} in class {object_class_descriptor}"))) + }; + + let function_result = if jvm.heap_area.object_area.get_object_field(object, &field.name, object_class_index, &jvm.class_store)? == FieldValue::Int(expected) { + jvm.heap_area.object_area.set_object_field( + object, + &field.name, + FieldValue::Int(replacement), + object_class_index, + &jvm.class_store + )?; + true + } else { + false + }; + + Ok(JVMCallbackOperation::ReturnFrame(FieldValue::Boolean(function_result))) + } pub fn object_field_offset_1(jvm: &mut JVM) -> Result { // args: Class class, String fieldName @@ -505,10 +547,11 @@ impl JdkInternalMiscVM { pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Result { let method_name: &str = &m.name; - match (class_name, method_name) { - - ("java/lang/Class", "forName0") => { - let expected_descriptor = MethodDescriptor { + let native_mappings: Vec<(&str, &str, MethodDescriptor, NativeMethodCallable)> = vec![ + ( + "java/lang/Class", + "forName0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, @@ -516,715 +559,559 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul 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/Class"))}, - }; + }, + todo_call + ), - 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/Class", "desiredAssertionStatus0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "desiredAssertionStatus0", + 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()}, - }; + }, + JavaLangClass::desired_assertion_status_0 + ), - 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(JavaLangClass::desired_assertion_status_0) - } - - ("java/lang/Class", "getClassAccessFlagsRaw0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getClassAccessFlagsRaw0", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, - }; + }, + todo_call + ), - 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/Class", "getClassFileVersion0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getClassFileVersion0", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, - }; + }, + todo_call + ), - 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/Class", "getConstantPool") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getConstantPool", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("jdk/internal/reflect/ConstantPool".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getDeclaredClasses0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getDeclaredClasses0", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getDeclaredConstructors0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getDeclaredConstructors0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/reflect/Constructor".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getDeclaredFields0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getDeclaredFields0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/reflect/Field".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getDeclaredMethods0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getDeclaredMethods0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/reflect/Method".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getDeclaringClass0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getDeclaringClass0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getEnclosingMethod0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getEnclosingMethod0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getGenericSignature0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getGenericSignature0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getInterfaces0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getInterfaces0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getNestMembers0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getNestMembers0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getModifiers") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getModifiers", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, - }; + }, + todo_call + ), - 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/Class", "getNestHost0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getNestHost0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getPermittedSubclasses0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getPermittedSubclasses0", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getPrimitiveClass") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getPrimitiveClass", + 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/Class".to_string()) }, - }; + }, + JavaLangClass::get_primitive_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(JavaLangClass::get_primitive_class) - } - - ("java/lang/Class", "getProtectionDomain0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getProtectionDomain0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/security/ProtectionDomain".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getRawAnnotations") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getRawAnnotations", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Byte() }, - }; + }, + todo_call + ), - 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/Class", "getRawTypeAnnotations") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getRawTypeAnnotations", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Byte() }, - }; + }, + todo_call + ), - 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/Class", "getRecordComponents0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getRecordComponents0", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/reflect/RecordComponent".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getSimpleBinaryName0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getSimpleBinaryName0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getSigners") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getSigners", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "getSuperclass") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "getSuperclass", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Class".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "isAssignableFrom") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "isAssignableFrom", + 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()}, - }; + }, + todo_call + ), - 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/Class", "initClassName") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "initClassName", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) }, - }; + }, + todo_call + ), - 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/Class", "isArray") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "isArray", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()}, - }; + }, + todo_call + ), - 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/Class", "isHidden") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "isHidden", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()}, - }; + }, + todo_call + ), - 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/Class", "isInstance") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "isInstance", + 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::Boolean()}, - }; + }, + todo_call + ), - 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/Class", "isInterface") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "isInterface", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()}, - }; + }, + todo_call + ), - 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/Class", "isPrimitive") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "isPrimitive", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()}, - }; + }, + todo_call + ), - 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/Class", "isRecord0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "isRecord0", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean()}, - }; + }, + todo_call + ), - 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/Class", "registerNatives") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "registerNatives", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + ignore_call + ), - 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/Class", "setSigners") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Class", + "setSigners", + 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::Void() }, - }; + }, + todo_call + ), - 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/Double", "doubleToRawLongBits") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Double", + "doubleToRawLongBits", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() } ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, - }; + }, + JavaLangDouble::double_to_raw_long_bits + ), - 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(JavaLangDouble::double_to_raw_long_bits) - } - - ("java/lang/Double", "longBitsToDouble") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Double", + "longBitsToDouble", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() } ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, - }; + }, + JavaLangDouble::double_to_raw_long_bits + ), - 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(JavaLangDouble::double_to_raw_long_bits) - } - - ("java/lang/Float", "intBitsToFloat") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Float", + "intBitsToFloat", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() } ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, - }; + }, + todo_call + ), - 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/Float", "floatToRawIntBits") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Float", + "floatToRawIntBits", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() } ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, - }; + }, + JavaLangFloat::float_to_raw_int_bits + ), - 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(JavaLangFloat::float_to_raw_int_bits) - } - - ("java/lang/String", "intern") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/String", + "intern", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/String"))}, - }; + }, + todo_call + ), - 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/StringUTF16", "isBigEndian") => { - // until JDK 23 - let expected_descriptor = MethodDescriptor { + // until JDK 23 + ( + "java/lang/StringUTF16", + "isBigEndian", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + JavaLangStringUTF16::is_big_endian + ), - 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(JavaLangStringUTF16::is_big_endian) - } - - ("java/lang/Object", "clone") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Object", + "clone", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Object"))}, - }; + }, + todo_call + ), - 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/Object", "getClass") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Object", + "getClass", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname(String::from("java/lang/Class"))}, - }; + }, + todo_call + ), - 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/Object", "hashCode") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Object", + "hashCode", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()}, - }; + }, + todo_call + ), - 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/Object", "notifyAll") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Object", + "notifyAll", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + todo_call + ), - 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/Object", "notify") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Object", + "notify", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + todo_call + ), - 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/Object", "wait0") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Object", + "wait0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + todo_call + ), - 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/Runtime", "availableProcessors") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Runtime", + "availableProcessors", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()}, - }; + }, + JavaLangRuntime::available_processors + ), - 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(JavaLangRuntime::available_processors) - } - - ("java/lang/Runtime", "freeMemory") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Runtime", + "freeMemory", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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/Runtime", "gc") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Runtime", + "gc", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + todo_call + ), - 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/Runtime", "maxMemory") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Runtime", + "maxMemory", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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/Runtime", "totalMemory") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Runtime", + "totalMemory", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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", "arraycopy") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/System", + "arraycopy", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, @@ -1233,207 +1120,165 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + todo_call + ), - 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 { + ( + "java/lang/System", + "currentTimeMillis", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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 { + ( + "java/lang/System", + "identityHashCode", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "java/lang/System", + "mapLibraryName", + 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()) }, - }; + }, + todo_call + ), - 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 { + ( + "java/lang/System", + "nanoTime", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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 { + ( + "java/lang/System", + "registerNatives", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + ignore_call + ), - 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 { + ( + "java/lang/System", + "setIn0", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "java/lang/System", + "setOut0", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "java/lang/System", + "setErr0", + 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()}, - }; + }, + todo_call + ), - 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/Thread", "registerNatives") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Thread", + "registerNatives", + MethodDescriptor { argument_types: Box::new([]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + ignore_call + ), - 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", "arrayBaseOffset0") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/Unsafe", + "arrayBaseOffset0", + 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() }, - }; + }, + JdkInternalMiscUnsafe::array_base_offset_0 + ), - 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(JdkInternalMiscUnsafe::array_base_offset_0) - } - - ("jdk/internal/misc/Unsafe", "arrayIndexScale0") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/Unsafe", + "arrayIndexScale0", + 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() }, - }; + }, + JdkInternalMiscUnsafe::array_index_scale_0 + ), - 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(JdkInternalMiscUnsafe::array_index_scale_0) - } - - ("jdk/internal/misc/Unsafe", "allocateInstance") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/Unsafe", + "allocateInstance", + 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"))}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "allocateMemory0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "copyMemory0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1442,17 +1287,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "copySwapMemory0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1462,48 +1304,39 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "freeMemory0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "reallocateMemory0", + 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() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "setMemory0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1511,17 +1344,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetBoolean", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1529,18 +1359,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetByte", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1548,18 +1374,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetChar", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1567,18 +1389,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetDouble", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1586,18 +1404,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetFloat", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1605,17 +1419,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetInt", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1623,17 +1434,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + JdkInternalMiscUnsafe::compare_and_set_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", "compareAndSetLong") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetLong", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1641,17 +1449,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetReference", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1659,17 +1464,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndSetShort", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1677,17 +1479,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeBoolean", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1695,18 +1494,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Boolean() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeByte", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1714,18 +1509,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Byte() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeChar", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1733,18 +1524,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Char() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeDouble", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1752,18 +1539,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Double() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeFloat", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1771,17 +1554,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Float() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeInt", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1789,17 +1569,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeLong", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1807,18 +1584,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeShort", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1826,18 +1599,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Short() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "compareAndExchangeReference", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string()) }, AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, @@ -1845,17 +1614,14 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul 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"))}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "defineClass0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/String".to_string()) }, AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Byte() }, @@ -1865,1030 +1631,1072 @@ pub fn function_for(class_name: &str, m: &crate::classfile::MethodInfo) -> Resul 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"))}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "ensureClassInitialized0", + 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() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "fullFence", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void() }, - }; + }, + ignore_call // TODO: Understand and implement + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getBooleanVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getByteVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getCharVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getFloatVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getDoubleVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getIntVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getLongVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getShortVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getReferenceVolatile", + 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"))}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getBoolean", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getByte", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getChar", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getDouble", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getFloat", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getInt", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getLoadAverage0", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getLong", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getReference", + 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"))}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getShort", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "getUncompressedObject", + 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"))}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "objectFieldOffset0", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "objectFieldOffset1", + 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()}, - }; + }, + JdkInternalMiscUnsafe::object_field_offset_1 + ), - 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(JdkInternalMiscUnsafe::object_field_offset_1) - } - - ("jdk/internal/misc/Unsafe", "registerNatives") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/Unsafe", + "registerNatives", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + ignore_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "park", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putBoolean", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putByte", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putChar", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putDouble", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putFloat", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putInt", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putLong", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putReference", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putShort", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putBooleanVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putByteVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putCharVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putFloatVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putDoubleVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putIntVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putLongVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putShortVolatile", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "putReferenceVolatile", + 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() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "shouldBeInitialized0", + 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() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "staticFieldOffset0", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "staticFieldOffset1", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "staticFieldBase0", + 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()) }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "unpark", + 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() }, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "throwException", + 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()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "writeback0", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() }, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + todo_call, + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "writebackPostSync0", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + todo_call + ), - 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 { + ( + "jdk/internal/misc/Unsafe", + "writebackPreSync0", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + todo_call + ), - 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/VM", "getgid") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/VM", + "getgid", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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/VM", "getegid") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/VM", + "getegid", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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/VM", "geteuid") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/VM", + "geteuid", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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/VM", "getuid") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/VM", + "getuid", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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/VM", "getNanoTimeAdjustment") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/VM", + "getNanoTimeAdjustment", + MethodDescriptor { argument_types: Box::new([ AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, - }; + }, + todo_call + ), - 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/VM", "getRuntimeArguments") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/VM", + "getRuntimeArguments", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/String".to_string())}, - }; + }, + todo_call + ), - 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/VM", "initialize") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/VM", + "initialize", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, - }; + }, + JdkInternalMiscVM::initialize + ), - 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(JdkInternalMiscVM::initialize) - } - - ("jdk/internal/misc/VM", "latestUserDefinedLoader0") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/misc/VM", + "latestUserDefinedLoader0", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/ClassLoader".to_string())}, - }; + }, + todo_call + ), - 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/util/SystemProps$Raw", "platformProperties") => { - let expected_descriptor = MethodDescriptor { + ( + "jdk/internal/util/SystemProps$Raw", + "platformProperties", + MethodDescriptor { argument_types: Box::new([ ]), return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/String".to_string())}, - }; + }, + JdkInternalUtilSystemPropsRaw::platform_properties + ), - 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()))); - } + ( + "jdk/internal/util/SystemProps$Raw", + "vmProperties", + MethodDescriptor { + argument_types: Box::new([]), + return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/String".to_string())}, + }, + JdkInternalUtilSystemPropsRaw::vm_properties + ), - Ok(JdkInternalUtilSystemPropsRaw::platform_properties) - } + ( + "java/lang/Thread", + "findScopedValueBindings", + MethodDescriptor { + argument_types: Box::new([]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())}, + }, + todo_call + ), - ("jdk/internal/util/SystemProps$Raw", "vmProperties") => { - let expected_descriptor = MethodDescriptor { + ( + "java/lang/Thread", + "currentCarrierThread", + MethodDescriptor { + argument_types: Box::new([]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Thread".to_string())}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "currentThread", + MethodDescriptor { + argument_types: Box::new([]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Thread".to_string())}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "setCurrentThread", + MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Thread".to_string())} + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "scopedValueCache", + MethodDescriptor { argument_types: Box::new([ ]), - return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/String".to_string())}, - }; + return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())}, + }, + todo_call + ), - 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()))); - } + ( + "java/lang/Thread", + "setScopedValueCache", + 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::Void()}, + }, + todo_call + ), - Ok(JdkInternalUtilSystemPropsRaw::vm_properties) + ( + "java/lang/Thread", + "ensureMaterializedForStackWalk", + 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()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "ensureMaterializedForStackWalk", + MethodDescriptor { + argument_types: Box::new([]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "yield0", + MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "sleepNanos0", + MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long() } + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "start0", + MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "holdsLock", + 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::Boolean()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "getStackTrace0", + MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "dumpThreads", + MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Thread".to_string())} + ]), + return_type: AbstractTypeDescription { array_level: 2, kind: AbstractTypeKind::Classname("java/lang/StackTraceElement".to_string())}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "getThreads", + MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/Thread".to_string())}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "setPriority0", + MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()} + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "interrupt0", + MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + + ( + "java/lang/Thread", + "clearInterruptEvent", + MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + ( + "java/lang/Thread", + "setNativeName", + 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 + ), + + ( + "java/lang/Thread", + "getNextThreadIdOffset", + MethodDescriptor { + argument_types: Box::new([ + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Long()}, + }, + todo_call + ), + + ( + "java/lang/StackTraceElement", + "initStackTraceElements", + MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 1, kind: AbstractTypeKind::Classname("java/lang/StackTraceElement".to_string())}, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/Object".to_string())}, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Int()} + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + + ( + "java/lang/StackTraceElement", + "initStackTraceElement", + MethodDescriptor { + argument_types: Box::new([ + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/StackTraceElement".to_string())}, + AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Classname("java/lang/StackFrameInfo".to_string())}, + ]), + return_type: AbstractTypeDescription { array_level: 0, kind: AbstractTypeKind::Void()}, + }, + todo_call + ), + ]; + + for (classname, methodname, methoddescriptor, binding) in native_mappings { + if classname != class_name || methodname != method_name { + continue; + } + if methoddescriptor != m.descriptor { + return Err(Error::RunTimeError(format!("Descriptor mismatch in native method resolution: internal is {} but classfile wants {}", methoddescriptor.source_string(), m.descriptor.source_string()))); } - - _ => Err(Error::RunTimeError(format!("Failed to find native implementation for method '{class_name}.{method_name}'"))), + return Ok(binding); } + + + Err(Error::RunTimeError(format!("Failed to find native implementation for method '{class_name}.{method_name}'"))) } diff --git a/src/stackframe.rs b/src/stackframe.rs index ce6ce48..0a4bfa6 100644 --- a/src/stackframe.rs +++ b/src/stackframe.rs @@ -268,14 +268,14 @@ impl OperandStack { pub fn pop_double(&mut self, index: usize) -> Result { let absolute_index = self.depth as usize - 1 - index; - let higher_bytes = self.stack[absolute_index]; - let lower_bytes = self.stack[absolute_index + 1]; + let double1 = self.stack[absolute_index]; + let double0 = self.stack[absolute_index - 1]; self.depth -= 2; - match (higher_bytes, lower_bytes) { + match (double0, double1) { (StackValue::Double0(double), StackValue::Double1()) => { Ok(double) }, - _ => Err(Error::LocalError(format!("Mismatched types at index {} of the function operand stack, expected (Double0, Double1) but found '{:?}'", index, (higher_bytes, lower_bytes)))) + _ => Err(Error::LocalError(format!("Mismatched types at index {} of the function operand stack, expected (Double0, Double1) but found '{:?}'", index, (double1, double0)))) } }