Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: move invokedynamic into separate module #227

Merged
merged 1 commit into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions ristretto_vm/src/instruction/invoke.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,16 +196,6 @@ pub(crate) async fn invokeinterface(
invoke_method(&thread, stack, class, method, &InvocationType::Interface).await
}

/// See: <https://docs.oracle.com/javase/specs/jvms/se23/html/jvms-6.html#jvms-6.5.invokedynamic>
#[inline]
pub(crate) async fn invokedynamic(
_frame: &Frame,
_stack: &mut OperandStack,
_method_index: u16,
) -> Result<ExecutionResult> {
todo!("invokedynamic")
}

/// Invoke the method at the specified index
///
/// # Errors
Expand Down
26 changes: 26 additions & 0 deletions ristretto_vm/src/instruction/invokedynamic.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use crate::frame::{ExecutionResult, Frame};
use crate::operand_stack::OperandStack;

/// See: <https://docs.oracle.com/javase/specs/jvms/se23/html/jvms-6.html#jvms-6.5.invokedynamic>
#[inline]
pub(crate) async fn invokedynamic(
_frame: &Frame,
_stack: &mut OperandStack,
_method_index: u16,
) -> crate::Result<ExecutionResult> {
todo!("invokedynamic")
}

#[cfg(test)]
mod tests {
use super::*;

#[tokio::test]
#[should_panic(expected = "invokedynamic")]
async fn test_invokedynamic() {
let (_vm, _thread, frame) = crate::test::frame().await.expect("frame");
let mut stack = OperandStack::with_max_size(1);
let method_index = 0;
let _ = invokedynamic(&frame, &mut stack, method_index).await;
}
}
2 changes: 2 additions & 0 deletions ristretto_vm/src/instruction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ mod field;
mod float;
mod integer;
mod invoke;
mod invokedynamic;
mod ldc;
mod long;
mod monitor;
Expand All @@ -33,6 +34,7 @@ pub(crate) use field::*;
pub(crate) use float::*;
pub(crate) use integer::*;
pub(crate) use invoke::*;
pub(crate) use invokedynamic::*;
pub(crate) use ldc::*;
pub(crate) use long::*;
pub(crate) use monitor::*;
Expand Down
Loading