Project

General

Profile

« Previous | Next » 

Revision e9cd3060

Added by Stan Lo 3 days ago

ZJIT: Support guarding *Exact types (#13797)

ZJIT already can generate guard type instructions for *Exact types.

For example:

def test(strings)
  strings.map do |string|
    string.bytesize
  end
end

test(["foo", "bar"])
HIR:
fn block in test:
bb0(v0:BasicObject, v1:BasicObject):
  PatchPoint MethodRedefined(String@0x1014be890, bytesize@0x19f1)
  v7:StringExact = GuardType v1, StringExact
  v8:Fixnum = CCall bytesize@0x16fa4cc18, v7
  Return v8

But zjit only supported guarding fixnums so this script would panic.

This commit adds support for guarding *Exact types.