Module: Bootsnap::CompileCache::ISeq
- Defined in:
- lib/bootsnap/compile_cache/iseq.rb
Defined Under Namespace
Modules: InstructionSequenceMixin
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.cache_dir ⇒ Object
Returns the value of attribute cache_dir.
10
11
12
|
# File 'lib/bootsnap/compile_cache/iseq.rb', line 10
def cache_dir
@cache_dir
end
|
Class Method Details
.compile_option_updated ⇒ Object
103
104
105
106
107
|
# File 'lib/bootsnap/compile_cache/iseq.rb', line 103
def self.compile_option_updated
option = RubyVM::InstructionSequence.compile_option
crc = Zlib.crc32(option.inspect)
Bootsnap::CompileCache::Native.compile_option_crc32 = crc
end
|
.fetch(path, cache_dir: ISeq.cache_dir) ⇒ Object
80
81
82
|
# File 'lib/bootsnap/compile_cache/iseq.rb', line 80
def self.input_to_output(_data, _kwargs)
nil end
|
31
32
33
34
35
36
37
38
39
40
41
42
43
|
# File 'lib/bootsnap/compile_cache/iseq.rb', line 31
def self.input_to_storage(_, path)
iseq = begin
RubyVM::InstructionSequence.compile_file(path)
rescue SyntaxError
return UNCOMPILABLE end
begin
iseq.to_binary
rescue TypeError
UNCOMPILABLE end
end
|
.install!(cache_dir) ⇒ Object
.precompile(path) ⇒ Object
.storage_to_output(binary, _args) ⇒ Object
52
53
54
55
56
57
58
59
60
61
|
# File 'lib/bootsnap/compile_cache/iseq.rb', line 52
def self.storage_to_output(binary, _args)
RubyVM::InstructionSequence.load_from_binary(binary)
rescue RuntimeError => error
if error.message == "broken binary format"
$stderr.puts("[Bootsnap::CompileCache] warning: rejecting broken binary")
nil
else
raise
end
end
|
.supported? ⇒ Boolean
16
17
18
|
# File 'lib/bootsnap/compile_cache/iseq.rb', line 16
def supported?
CompileCache.supported? && defined?(RubyVM)
end
|