Skip to content

Commit cfc6ade

Browse files
authored
Merge pull request #14 from Shopify/ruby-4-static
Ruby 4 static
2 parents 137ece8 + b9ada5a commit cfc6ade

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

interpreter/ruby/ruby.go

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ func Loader(ebpf interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interpr
13991399
// https://www.jetbrains.com/lp/devecosystem-2020/ruby/
14001400
// Reason for maximum supported version 3.5.x:
14011401
// - this is currently the newest stable version
1402-
minVer, maxVer := rubyVersion(2, 5, 0), rubyVersion(3, 6, 0)
1402+
minVer, maxVer := rubyVersion(2, 5, 0), rubyVersion(4, 1, 0)
14031403
if version < minVer || version >= maxVer {
14041404
return nil, fmt.Errorf("unsupported Ruby %d.%d.%d (need >= %d.%d.%d and <= %d.%d.%d)",
14051405
(version>>16)&0xff, (version>>8)&0xff, version&0xff,
@@ -1554,6 +1554,13 @@ func Loader(ebpf interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interpr
15541554
vms.rclass_and_rb_classext_t.classext = 32
15551555
vms.rb_classext_struct.as_singleton_class_attached_object = 96
15561556
vms.rb_classext_struct.classpath = 120
1557+
case version >= rubyVersion(4, 0, 0) && version < rubyVersion(4, 1, 0):
1558+
rid.hasClassPath = true
1559+
rid.rubyFlSingleton = libpf.Address(RUBY_FL_USER1)
1560+
1561+
vms.rclass_and_rb_classext_t.classext = 24
1562+
vms.rb_classext_struct.as_singleton_class_attached_object = 112
1563+
vms.rb_classext_struct.classpath = 128
15571564
default:
15581565
rid.hasClassPath = true
15591566
rid.rubyFlSingleton = libpf.Address(RUBY_FL_USER1)
@@ -1574,6 +1581,8 @@ func Loader(ebpf interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interpr
15741581
rid.lastOpId = 169
15751582
case version < rubyVersion(3, 5, 0):
15761583
rid.lastOpId = 170
1584+
case version < rubyVersion(4, 1, 0):
1585+
rid.lastOpId = 171
15771586
default:
15781587
rid.lastOpId = 170
15791588
}
@@ -1619,6 +1628,15 @@ func Loader(ebpf interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interpr
16191628
vms.vm_struct.gc_objspace = 1320
16201629
}
16211630
vms.objspace.flags = 16
1631+
case version >= rubyVersion(4, 0, 0) && version < rubyVersion(4, 1, 0):
1632+
rid.hasObjspace = true
1633+
if runtime.GOARCH == "amd64" {
1634+
vms.vm_struct.gc_objspace = 1248
1635+
} else {
1636+
// TODO fixme
1637+
vms.vm_struct.gc_objspace = 1320
1638+
}
1639+
vms.objspace.flags = 28
16221640
default:
16231641
rid.hasObjspace = true
16241642
vms.objspace.flags = 20
@@ -1682,6 +1700,12 @@ func Loader(ebpf interpreter.EbpfHandler, info *interpreter.LoaderInfo) (interpr
16821700
vms.iseq_constant_body.succ_index_table = 136
16831701
vms.iseq_constant_body.local_iseq = 168
16841702
vms.iseq_constant_body.size_of_iseq_constant_body = 352
1703+
case version >= rubyVersion(4, 0, 0) && version < rubyVersion(4, 1, 0):
1704+
vms.iseq_constant_body.insn_info_body = 112
1705+
vms.iseq_constant_body.insn_info_size = 128
1706+
vms.iseq_constant_body.succ_index_table = 136
1707+
vms.iseq_constant_body.local_iseq = 176
1708+
vms.iseq_constant_body.size_of_iseq_constant_body = 352
16851709
default: // 3.3.x and 3.5.x have the same values
16861710
vms.iseq_constant_body.insn_info_body = 112
16871711
vms.iseq_constant_body.insn_info_size = 128

0 commit comments

Comments
 (0)