Skip to content

Build a new pass that ensures that ruby locals / IR tmps are initialized  #2465

@subbuss

Description

@subbuss

So, in the snippet below, x is not initialized on all paths.

def foo
  x = 1 if bar
  p x
end

So, this requires JRuby to return nil if a local var look fails. We can get rid of those if the IR can introduce necessarily initializations on all code paths. This will simply DynamicScope var looks and also eliminate conditionals in variable retrieves (see https://github.com/jruby/jruby/blob/master/core/src/main/java/org/jruby/ir/operands/TemporaryLocalVariable.java#L48-L61)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions