use crate::Result;
use crate::frame::ExecutionResult::Continue;
use crate::frame::{ExecutionResult, Frame};
use crate::instruction::resolve_method_ref;
use crate::method_ref_cache::InvokeKind;
use crate::operand_stack::OperandStack;
#[inline]
pub(crate) async fn invokestatic(
frame: &Frame,
stack: &mut OperandStack,
method_index: u16,
) -> Result<ExecutionResult> {
let thread = frame.thread()?;
let resolution = resolve_method_ref(frame, method_index, InvokeKind::Static).await?;
let parameters = stack.drain_last(resolution.param_count);
let result =
Box::pin(thread.execute(&resolution.declaring_class, &resolution.method, ¶meters))
.await?;
if resolution.has_return_type
&& let Some(value) = result
{
stack.push(value)?;
}
Ok(Continue)
}