MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / emit_integer_switch

Method emit_integer_switch

src/lower2/translator.rs:171–252  ·  view source on GitHub ↗
(
        &mut self,
        discr: &oomir::Operand,
        discr_type: &Type,
        targets: &[(oomir::Constant, String)],
        otherwise: &str,
    )

Source from the content-addressed store, hash-verified

169 deferred_pointer_variables.insert(dest.clone());
170 }
171 }
172 }
173 propagate_deferred_pointer_moves(oomir_func, &mut deferred_pointer_variables);
174 let direct_cell_projections = direct_cell_projections(oomir_func);
175 let known_function_pointer_adapters = known_function_pointer_adapters(oomir_func);
176 let relative_signature =
177 relative_pointer_abi.then(|| oomir_func.signature.relative_pointer_abi_signature());
178 let initial_locals = stackmaps::initial_locals_for_oomir_signature(
179 &oomir_func.name,
180 oomir_func.owner_class.as_deref(),
181 relative_signature.as_ref().unwrap_or(&oomir_func.signature),
182 is_static,
183 owner_class_name,
184 );
185 let mut translator = FunctionTranslator {
186 oomir_func,
187 module,
188 relative_static_methods,
189 constant_pool,
190 bootstrap_methods,
191 local_var_map: HashMap::default(),
192 local_var_types: HashMap::default(),
193 typed_local_var_map: HashMap::default(),
194 deferred_pointer_variables,
195 pointer_offset_slots: HashMap::default(),
196 direct_field_projections,
197 direct_cell_projections,
198 direct_cell_slots: HashMap::default(),
199 known_function_pointer_adapters,
200 next_local_index: if is_static { 0 } else { 1 },
201 jvm_instructions: Vec::new(),
202 label_to_instr_index: HashMap::default(),
203 branch_fixups: Vec::new(),
204 switch_fixups: Vec::new(),
205 current_oomir_block_label: String::new(),
206 current_fallthrough_block_label: None,
207 initial_locals,
208 direct_this_aliases: HashSet::default(),
209 jvm_metadata: Vec::new(),
210 current_source_location: None,
211 current_active_variables: Rc::new(Vec::new()),
212 debug_info,
213 active_unwind_region: None,
214 unwind_regions: Vec::new(),
215 exception_table: Vec::new(),
216 max_locals_used: 0,
217 };
218
219 breadcrumbs::log!(
220 breadcrumbs::LogLevel::Info,
221 "bytecode-gen",
222 format!("static: {}, function_name: {}", is_static, oomir_func.name)
223 );
224
225 // For instance methods, map _1 (self) to JVM Slot 0
226 if !is_static {
227 if let Some(class_name) = owner_class_name {
228 // _1 is the receiver (this), maps to JVM Slot 0

Callers 1

translate_instructionMethod · 0.80

Calls 5

is_jvm_switch_typeFunction · 0.85
jvm_switch_keyFunction · 0.85
lenMethod · 0.80
load_operandMethod · 0.80
to_stringMethod · 0.80

Tested by

no test coverage detected