jit_buffer 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -2
  3. data/lib/jit_buffer.rb +10 -10
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e21eec19f328c27e2b584d6c4644d405086e042126be6f295c27e38b2b228429
4
- data.tar.gz: c5a8593f5f8f800c495af6020e59a356edab4fca5ffbe82b57baef0f7781eb09
3
+ metadata.gz: 83c506373263745dc1425c011b5c87fb19e09056aa15193397e7a947490c6f69
4
+ data.tar.gz: 1b0b9ae7fba8f3a3da5eb92cd426e411cfdce42c7e6142c9b42308dd59e61cc8
5
5
  SHA512:
6
- metadata.gz: ad0deb2b19ea936057da4c21a2d06f3ccbf9c84204cd51e0776e9d1f93a99417a068836c0a9d595acec5084776e52d685929167021e6182bac275cc0022a5c88
7
- data.tar.gz: 017c1de99e6be6734445a1ec1474eb3ee640533f7d72906f5838c36724b03b27d183c75037befbd676f1beed065aaf0d3a6334456c92ce58f7ff1860c2f03dcc
6
+ metadata.gz: ab2ec25089b2a6037ca5c266e2cd51dc1228ab224c0662a768d7692491d9178d9d5491750c184090e9ec892d6dead2cca23dae89093cd90ec829262d1a3287ac
7
+ data.tar.gz: 3ca332072bdb7fecd76b5978ac6d39058f509ae61ab05a4539c1ba1548bea0d81a3fadac5e48c8b622a348a6f6931362f511f79f8611a4283f6e9e8882077066
data/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  This is a general purpose JIT Buffer object for building JITs in Ruby.
4
4
 
5
- Currently only works on macOS though I'll make it work on Linux too.
6
-
7
5
  ## Usage
8
6
 
9
7
  Create a JIT Buffer, then specify the size. The JIT Buffer can only be
data/lib/jit_buffer.rb CHANGED
@@ -8,7 +8,7 @@ class Fiddle::Function
8
8
  end unless Fiddle::Function.method_defined?(:to_proc)
9
9
 
10
10
  class JITBuffer
11
- VERSION = '1.0.4'
11
+ VERSION = '1.0.5'
12
12
 
13
13
  class Exception < StandardError
14
14
  end
@@ -70,22 +70,22 @@ class JITBuffer
70
70
 
71
71
  if respond_to?(:pthread_jit_write_protect_np)
72
72
  # MacOS
73
- def self.set_writeable ptr
73
+ def self.set_writeable ptr, _
74
74
  MMAP.pthread_jit_write_protect_np 0
75
75
  end
76
76
 
77
- def self.set_executable ptr
77
+ def self.set_executable ptr, size
78
78
  MMAP.pthread_jit_write_protect_np 1
79
- MMAP.sys_icache_invalidate ptr, ptr.size
79
+ MMAP.sys_icache_invalidate ptr, size
80
80
  end
81
81
  else
82
82
  # Linux
83
- def self.set_writeable ptr
84
- MMAP.mprotect ptr, ptr.size, PROT_READ | PROT_WRITE
83
+ def self.set_writeable ptr, size
84
+ MMAP.mprotect ptr, size, PROT_READ | PROT_WRITE
85
85
  end
86
86
 
87
- def self.set_executable ptr
88
- MMAP.mprotect ptr, ptr.size, PROT_READ | PROT_EXEC
87
+ def self.set_executable ptr, size
88
+ MMAP.mprotect ptr, size, PROT_READ | PROT_EXEC
89
89
  end
90
90
  end
91
91
  end
@@ -145,12 +145,12 @@ class JITBuffer
145
145
  end
146
146
 
147
147
  def executable!
148
- MMAP.set_executable @memory.to_i
148
+ MMAP.set_executable @memory.to_i, @size
149
149
  @writeable = false
150
150
  end
151
151
 
152
152
  def writeable!
153
- MMAP.set_writeable @memory.to_i
153
+ MMAP.set_writeable @memory.to_i, @size
154
154
  @writeable = true
155
155
  end
156
156
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jit_buffer
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Patterson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-21 00:00:00.000000000 Z
11
+ date: 2023-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake