summaryrefslogtreecommitdiff
path: root/tool/ruby_vm
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2022-06-27 16:30:32 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2022-06-29 16:21:48 -0700
commit8d157bc80614be1b222ca2158d211399c40d151c (patch)
tree793b4c9a8074826da5ca39e6a5b16bd87b6f9022 /tool/ruby_vm
parente3ab525f699b5191db70ef095b3d110890441940 (diff)
downloadruby-8d157bc80614be1b222ca2158d211399c40d151c.tar.gz
Move function to `static inline` so we don't have leaked globals
This function shouldn't leak and is only needed during instruction assembly
Diffstat (limited to 'tool/ruby_vm')
-rw-r--r--tool/ruby_vm/views/_insn_type_chars.erb16
1 files changed, 16 insertions, 0 deletions
diff --git a/tool/ruby_vm/views/_insn_type_chars.erb b/tool/ruby_vm/views/_insn_type_chars.erb
index 4e1f63e660..a9c112d369 100644
--- a/tool/ruby_vm/views/_insn_type_chars.erb
+++ b/tool/ruby_vm/views/_insn_type_chars.erb
@@ -11,3 +11,19 @@ enum ruby_insn_type_chars {
<%= t %> = '<%= c %>',
% end
};
+
+static inline union iseq_inline_storage_entry * ISEQ_IS_ENTRY_START(const struct rb_iseq_constant_body *body, char op_type) {
+ unsigned int relative_ic_offset = 0;
+ switch(op_type) {
+ case TS_IC:
+ relative_ic_offset += body->ise_size;
+ case TS_ISE:
+ relative_ic_offset += body->ivc_size;
+ case TS_IVC:
+ case TS_ICVARC:
+ break;
+ default:
+ rb_bug("Wrong op type");
+ }
+ return &body->is_entries[relative_ic_offset];
+}