MCPcopy Create free account
hub / github.com/cretz/stackparam / get_local_var

Function get_local_var

src/native.rs:521–581  ·  view source on GitHub ↗
(jni_env: *mut JNIEnv, thread: jthread, depth: jint, slot: jint, typ: &str)

Source from the content-addressed store, hash-verified

519}
520
521unsafe fn get_local_var(jni_env: *mut JNIEnv, thread: jthread, depth: jint, slot: jint, typ: &str) -> Result<jobject, String> {
522 return match typ {
523 "Z" => {
524 let val = get_local_int(thread, depth, slot)?;
525 let (box_class, box_meth) = primitive_box_methods(jni_env)?.boolean;
526 util::result_or_jni_ex(
527 (**jni_env).CallStaticObjectMethod.unwrap()(jni_env, box_class, box_meth, val as c_uint), jni_env)
528 },
529 "B" => {
530 let val = get_local_int(thread, depth, slot)?;
531 let (box_class, box_meth) = primitive_box_methods(jni_env)?.byte;
532 util::result_or_jni_ex(
533 (**jni_env).CallStaticObjectMethod.unwrap()(jni_env, box_class, box_meth, val as c_int), jni_env)
534 },
535 "C" => {
536 let val = get_local_int(thread, depth, slot)?;
537 let (box_class, box_meth) = primitive_box_methods(jni_env)?.char;
538 util::result_or_jni_ex(
539 (**jni_env).CallStaticObjectMethod.unwrap()(jni_env, box_class, box_meth, val as c_uint), jni_env)
540 },
541 "S" => {
542 let val = get_local_int(thread, depth, slot)?;
543 let (box_class, box_meth) = primitive_box_methods(jni_env)?.short;
544 util::result_or_jni_ex(
545 (**jni_env).CallStaticObjectMethod.unwrap()(jni_env, box_class, box_meth, val as c_int), jni_env)
546 },
547 "I" => {
548 let val = get_local_int(thread, depth, slot)?;
549 let (box_class, box_meth) = primitive_box_methods(jni_env)?.int;
550 util::result_or_jni_ex(
551 (**jni_env).CallStaticObjectMethod.unwrap()(jni_env, box_class, box_meth, val), jni_env)
552 },
553 "J" => {
554 let mut val: jlong = 0;
555 util::unit_or_jvmti_err((**JVMTI_ENV).GetLocalLong.unwrap()(JVMTI_ENV, thread, depth, slot, &mut val))?;
556 let (box_class, box_meth) = primitive_box_methods(jni_env)?.long;
557 util::result_or_jni_ex(
558 (**jni_env).CallStaticObjectMethod.unwrap()(jni_env, box_class, box_meth, val), jni_env)
559 },
560 "F" => {
561 let mut val: jfloat = 0.0;
562 util::unit_or_jvmti_err((**JVMTI_ENV).GetLocalFloat.unwrap()(JVMTI_ENV, thread, depth, slot, &mut val))?;
563 let (box_class, box_meth) = primitive_box_methods(jni_env)?.float;
564 util::result_or_jni_ex(
565 (**jni_env).CallStaticObjectMethod.unwrap()(jni_env, box_class, box_meth, val as c_double), jni_env)
566 },
567 "D" => {
568 let mut val: jdouble = 0.0;
569 util::unit_or_jvmti_err((**JVMTI_ENV).GetLocalDouble.unwrap()(JVMTI_ENV, thread, depth, slot, &mut val))?;
570 let (box_class, box_meth) = primitive_box_methods(jni_env)?.double;
571 util::result_or_jni_ex(
572 (**jni_env).CallStaticObjectMethod.unwrap()(jni_env, box_class, box_meth, val as c_double), jni_env)
573 },
574 typ if typ.starts_with("[") || typ.starts_with("L") => {
575 let mut val: jobject = ptr::null_mut();
576 let local_res = (**JVMTI_ENV).GetLocalObject.unwrap()(JVMTI_ENV, thread, depth, slot, &mut val);
577 util::result_or_jvmti_err(val, local_res)
578 },

Callers 1

get_frame_paramsFunction · 0.85

Calls 5

get_local_intFunction · 0.85
primitive_box_methodsFunction · 0.85
result_or_jni_exFunction · 0.85
unit_or_jvmti_errFunction · 0.85
result_or_jvmti_errFunction · 0.85

Tested by

no test coverage detected