Skip to main content

VarTable

Struct VarTable 

Source
pub struct VarTable {
    pub vars: Vec<VarInfo>,
    pub by_slot: Vec<Vec<(u16, u16, u32)>>,
    pub has_lvt: bool,
    pub stack_vars: Vec<u32>,
    pub wide_stack_vars: HashSet<u32>,
    pub handler_starts: Vec<u16>,
}

Fields§

§vars: Vec<VarInfo>§by_slot: Vec<Vec<(u16, u16, u32)>>

Per slot: (range_start, range_end, var_id), sorted by range_start.

§has_lvt: bool§stack_vars: Vec<u32>

Synthetic stack-merge variables (need declaration hoisting).

§wide_stack_vars: HashSet<u32>

Merge variables whose branches disagreed on type (or carried a generic/plain-Object value); they must stay Object so every branch assignment type-checks. Evidence inference may not narrow them.

§handler_starts: Vec<u16>

Exception-table handler start pcs: an LVT range beginning at one (or at its astore + 1/2) is a catch parameter binding. Such ranges never receive forward store attribution — a store just BEFORE a handler initializes the try-body variable, not the catch param (jdk11 HostnameChecker.matchDNS: sni = new SNIHostName(..) at pc 8 landed on iae whose handler range starts at 14, within the 8-byte lead-in — SNIHostName无法转换为 IllegalArgumentException).

Implementations§

Source§

impl VarTable

Pull the typed Code attribute out of a method, if any.

Source

pub fn add_stack_var(&mut self, slot: u16, name: String, ty: TypeRef) -> u32

Source

pub fn add_split(&mut self, slot: u16, name: String, ty: TypeRef) -> u32

Allocate a synthetic variable that is NOT a stack-merge temp (e.g. a catch parameter); it must not be hoisted by the stack-var pass. Add a new variable identity for slot-reuse splitting (post-build; not registered in pc-range lookups).

Source

pub fn add_catch_var(&mut self, slot: u16, name: String, ty: TypeRef) -> u32

Source

pub fn at(&self, slot: u16, pc: u16) -> Option<u32>

Resolve the variable live at (pc, slot). Falls back to the nearest preceding range, then to any var on the slot.

Source

pub fn sole_on_slot(&self, slot: u16) -> Option<u32>

The single variable covering a slot (when the slot is not reused).

Source

pub fn vars_on_slot(&self, slot: u16) -> &[(u16, u16, u32)]

Source

pub fn var(&self, id: u32) -> &VarInfo

Source

pub fn var_mut(&mut self, id: u32) -> &mut VarInfo

Trait Implementations§

Source§

impl Clone for VarTable

Source§

fn clone(&self) -> VarTable

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VarTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for VarTable

Source§

fn default() -> VarTable

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.