perb 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0fb76541355fc902835ad93d741308842b5584144792c28dfa8eb4469e31cddd
4
- data.tar.gz: b62d38a2b288de14cf358d6e9c641a20adf22a09916e421e9b349a7ba42b6a03
3
+ metadata.gz: 4e2b31874ab34c3592fb1ff666587e2e8f63824b82918a12b25fc6584bd2d83e
4
+ data.tar.gz: 8f380ba1e2f81f88c61e2c0d24719c640496e8957d0a0b14ca1dfbd35799ef79
5
5
  SHA512:
6
- metadata.gz: 7f97bad10720d07a8589988f6e1f42a43213b048094043d5e483ff002d74454d11f14dd6a5f8f552206b36f65e4546311735301be5d5dfbd66529bd5f980211c
7
- data.tar.gz: 6e0940843ed723f4db6845b596f6014268adeabc1e1727f766255b1cb234da95995bcb6304ed33eab71658823de95535ac9ebcf2c36d0035642313a9744c03cb
6
+ metadata.gz: 2d200d78a18061b00c58f1ec813707dcaa65ce61424cde11623f318d46cba60ceca821a086e166a2e16857ebfe32f6e4029a54867c14cc94788d91cda8de49b7
7
+ data.tar.gz: d2bdc4d71a6bb2b51aeaeb2180b6b13db702b9ab14da8ff8988113a9555871f63640d402d970c47baf2c3b020825841248cc9811039113f613b997b64dc45b1c
data/Gemfile.lock CHANGED
@@ -1,8 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- perb (0.1.0)
5
- parser (~> 3.1)
4
+ perb (0.3.0)
5
+ parser (~> 3.2)
6
6
  rb_sys (~> 0.9.53)
7
7
 
8
8
  GEM
@@ -13,7 +13,7 @@ GEM
13
13
  language_server-protocol (3.17.0.2)
14
14
  minitest (5.16.3)
15
15
  parallel (1.22.1)
16
- parser (3.1.3.0)
16
+ parser (3.2.0.0)
17
17
  ast (~> 2.4.1)
18
18
  prettier_print (1.1.0)
19
19
  rainbow (3.1.1)
@@ -23,17 +23,17 @@ GEM
23
23
  rb_sys (0.9.53)
24
24
  regexp_parser (2.6.1)
25
25
  rexml (3.2.5)
26
- rubocop (1.40.0)
26
+ rubocop (1.42.0)
27
27
  json (~> 2.3)
28
28
  parallel (~> 1.10)
29
29
  parser (>= 3.1.2.1)
30
30
  rainbow (>= 2.2.2, < 4.0)
31
31
  regexp_parser (>= 1.8, < 3.0)
32
32
  rexml (>= 3.2.5, < 4.0)
33
- rubocop-ast (>= 1.23.0, < 2.0)
33
+ rubocop-ast (>= 1.24.1, < 2.0)
34
34
  ruby-progressbar (~> 1.7)
35
35
  unicode-display_width (>= 1.4.0, < 3.0)
36
- rubocop-ast (1.24.0)
36
+ rubocop-ast (1.24.1)
37
37
  parser (>= 3.1.1.0)
38
38
  ruby-lsp (0.3.7)
39
39
  language_server-protocol (~> 3.17.0)
data/ext/perb/Cargo.lock CHANGED
@@ -2,6 +2,17 @@
2
2
  # It is not intended for manual editing.
3
3
  version = 3
4
4
 
5
+ [[package]]
6
+ name = "ahash"
7
+ version = "0.7.6"
8
+ source = "registry+https://github.com/rust-lang/crates.io-index"
9
+ checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47"
10
+ dependencies = [
11
+ "getrandom",
12
+ "once_cell",
13
+ "version_check",
14
+ ]
15
+
5
16
  [[package]]
6
17
  name = "aho-corasick"
7
18
  version = "0.7.20"
@@ -11,6 +22,24 @@ dependencies = [
11
22
  "memchr",
12
23
  ]
13
24
 
25
+ [[package]]
26
+ name = "anyhow"
27
+ version = "1.0.68"
28
+ source = "registry+https://github.com/rust-lang/crates.io-index"
29
+ checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
30
+
31
+ [[package]]
32
+ name = "arrayvec"
33
+ version = "0.7.2"
34
+ source = "registry+https://github.com/rust-lang/crates.io-index"
35
+ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6"
36
+
37
+ [[package]]
38
+ name = "autocfg"
39
+ version = "1.1.0"
40
+ source = "registry+https://github.com/rust-lang/crates.io-index"
41
+ checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
42
+
14
43
  [[package]]
15
44
  name = "bindgen"
16
45
  version = "0.60.1"
@@ -36,6 +65,12 @@ version = "1.3.2"
36
65
  source = "registry+https://github.com/rust-lang/crates.io-index"
37
66
  checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
38
67
 
68
+ [[package]]
69
+ name = "bumpalo"
70
+ version = "3.11.1"
71
+ source = "registry+https://github.com/rust-lang/crates.io-index"
72
+ checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba"
73
+
39
74
  [[package]]
40
75
  name = "byteorder"
41
76
  version = "1.4.3"
@@ -69,29 +104,173 @@ dependencies = [
69
104
  ]
70
105
 
71
106
  [[package]]
72
- name = "dynasm"
73
- version = "1.2.3"
107
+ name = "cranelift"
108
+ version = "0.91.0"
74
109
  source = "registry+https://github.com/rust-lang/crates.io-index"
75
- checksum = "add9a102807b524ec050363f09e06f1504214b0e1c7797f64261c891022dce8b"
110
+ checksum = "2d2082df9c9d5d55fbee89510b47749905ec39f3c96776262986f612c3de07ec"
76
111
  dependencies = [
77
- "bitflags",
78
- "byteorder",
79
- "lazy_static",
80
- "proc-macro-error",
81
- "proc-macro2",
82
- "quote",
83
- "syn",
112
+ "cranelift-codegen",
113
+ "cranelift-frontend",
84
114
  ]
85
115
 
86
116
  [[package]]
87
- name = "dynasmrt"
88
- version = "1.2.3"
117
+ name = "cranelift-bforest"
118
+ version = "0.91.0"
89
119
  source = "registry+https://github.com/rust-lang/crates.io-index"
90
- checksum = "64fba5a42bd76a17cad4bfa00de168ee1cbfa06a5e8ce992ae880218c05641a9"
120
+ checksum = "fc952b310b24444fc14ab8b9cbe3fafd7e7329e3eec84c3a9b11d2b5cf6f3be1"
121
+ dependencies = [
122
+ "cranelift-entity",
123
+ ]
124
+
125
+ [[package]]
126
+ name = "cranelift-codegen"
127
+ version = "0.91.0"
128
+ source = "registry+https://github.com/rust-lang/crates.io-index"
129
+ checksum = "e73470419b33011e50dbf0f6439cbccbaabe9381de172da4e1b6efcda4bb8fa7"
130
+ dependencies = [
131
+ "arrayvec",
132
+ "bumpalo",
133
+ "cranelift-bforest",
134
+ "cranelift-codegen-meta",
135
+ "cranelift-codegen-shared",
136
+ "cranelift-egraph",
137
+ "cranelift-entity",
138
+ "cranelift-isle",
139
+ "gimli",
140
+ "log",
141
+ "regalloc2",
142
+ "smallvec",
143
+ "target-lexicon",
144
+ ]
145
+
146
+ [[package]]
147
+ name = "cranelift-codegen-meta"
148
+ version = "0.91.0"
149
+ source = "registry+https://github.com/rust-lang/crates.io-index"
150
+ checksum = "911a1872464108a11ac9965c2b079e61bbdf1bc2e0b9001264264add2e12a38f"
151
+ dependencies = [
152
+ "cranelift-codegen-shared",
153
+ ]
154
+
155
+ [[package]]
156
+ name = "cranelift-codegen-shared"
157
+ version = "0.91.0"
158
+ source = "registry+https://github.com/rust-lang/crates.io-index"
159
+ checksum = "e036f3f07adb24a86fb46e977e8fe03b18bb16b1eada949cf2c48283e5f8a862"
160
+
161
+ [[package]]
162
+ name = "cranelift-egraph"
163
+ version = "0.91.0"
164
+ source = "registry+https://github.com/rust-lang/crates.io-index"
165
+ checksum = "2d6c623f4b5d2a6bad32c403f03765d4484a827eb93ee78f8cb6219ef118fd59"
166
+ dependencies = [
167
+ "cranelift-entity",
168
+ "fxhash",
169
+ "hashbrown",
170
+ "indexmap",
171
+ "log",
172
+ "smallvec",
173
+ ]
174
+
175
+ [[package]]
176
+ name = "cranelift-entity"
177
+ version = "0.91.0"
178
+ source = "registry+https://github.com/rust-lang/crates.io-index"
179
+ checksum = "74385eb5e405b3562f0caa7bcc4ab9a93c7958dd5bcd0e910bffb7765eacd6fc"
180
+
181
+ [[package]]
182
+ name = "cranelift-frontend"
183
+ version = "0.91.0"
184
+ source = "registry+https://github.com/rust-lang/crates.io-index"
185
+ checksum = "8a4ac920422ee36bff2c66257fec861765e3d95a125cdf58d8c0f3bba7e40e61"
186
+ dependencies = [
187
+ "cranelift-codegen",
188
+ "log",
189
+ "smallvec",
190
+ "target-lexicon",
191
+ ]
192
+
193
+ [[package]]
194
+ name = "cranelift-isle"
195
+ version = "0.91.0"
196
+ source = "registry+https://github.com/rust-lang/crates.io-index"
197
+ checksum = "c541263fb37ad2baa53ec8c37218ee5d02fa0984670d9419dedd8002ea68ff08"
198
+
199
+ [[package]]
200
+ name = "cranelift-jit"
201
+ version = "0.91.0"
202
+ source = "registry+https://github.com/rust-lang/crates.io-index"
203
+ checksum = "48a844e3500d313b69f3eec4b4e15bf9cdbd529756add06a468e0e281c0f6bee"
204
+ dependencies = [
205
+ "anyhow",
206
+ "cranelift-codegen",
207
+ "cranelift-entity",
208
+ "cranelift-module",
209
+ "cranelift-native",
210
+ "libc",
211
+ "log",
212
+ "region",
213
+ "target-lexicon",
214
+ "wasmtime-jit-icache-coherence",
215
+ "windows-sys",
216
+ ]
217
+
218
+ [[package]]
219
+ name = "cranelift-module"
220
+ version = "0.91.0"
221
+ source = "registry+https://github.com/rust-lang/crates.io-index"
222
+ checksum = "0699ea5fc6ca943456ba80ad49f80212bd6e2b846b992ec59f0f2b912a1d25fa"
223
+ dependencies = [
224
+ "anyhow",
225
+ "cranelift-codegen",
226
+ ]
227
+
228
+ [[package]]
229
+ name = "cranelift-native"
230
+ version = "0.91.0"
231
+ source = "registry+https://github.com/rust-lang/crates.io-index"
232
+ checksum = "1de5d7a063e8563d670aaca38de16591a9b70dc66cbad4d49a7b4ae8395fd1ce"
233
+ dependencies = [
234
+ "cranelift-codegen",
235
+ "libc",
236
+ "target-lexicon",
237
+ ]
238
+
239
+ [[package]]
240
+ name = "fallible-iterator"
241
+ version = "0.2.0"
242
+ source = "registry+https://github.com/rust-lang/crates.io-index"
243
+ checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7"
244
+
245
+ [[package]]
246
+ name = "fxhash"
247
+ version = "0.2.1"
248
+ source = "registry+https://github.com/rust-lang/crates.io-index"
249
+ checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
91
250
  dependencies = [
92
251
  "byteorder",
93
- "dynasm",
94
- "memmap2",
252
+ ]
253
+
254
+ [[package]]
255
+ name = "getrandom"
256
+ version = "0.2.8"
257
+ source = "registry+https://github.com/rust-lang/crates.io-index"
258
+ checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31"
259
+ dependencies = [
260
+ "cfg-if",
261
+ "libc",
262
+ "wasi",
263
+ ]
264
+
265
+ [[package]]
266
+ name = "gimli"
267
+ version = "0.26.2"
268
+ source = "registry+https://github.com/rust-lang/crates.io-index"
269
+ checksum = "22030e2c5a68ec659fde1e949a745124b48e6fa8b045b7ed5bd1fe4ccc5c4e5d"
270
+ dependencies = [
271
+ "fallible-iterator",
272
+ "indexmap",
273
+ "stable_deref_trait",
95
274
  ]
96
275
 
97
276
  [[package]]
@@ -100,6 +279,25 @@ version = "0.3.0"
100
279
  source = "registry+https://github.com/rust-lang/crates.io-index"
101
280
  checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
102
281
 
282
+ [[package]]
283
+ name = "hashbrown"
284
+ version = "0.12.3"
285
+ source = "registry+https://github.com/rust-lang/crates.io-index"
286
+ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
287
+ dependencies = [
288
+ "ahash",
289
+ ]
290
+
291
+ [[package]]
292
+ name = "indexmap"
293
+ version = "1.9.2"
294
+ source = "registry+https://github.com/rust-lang/crates.io-index"
295
+ checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399"
296
+ dependencies = [
297
+ "autocfg",
298
+ "hashbrown",
299
+ ]
300
+
103
301
  [[package]]
104
302
  name = "lazy_static"
105
303
  version = "1.4.0"
@@ -128,6 +326,24 @@ dependencies = [
128
326
  "winapi",
129
327
  ]
130
328
 
329
+ [[package]]
330
+ name = "log"
331
+ version = "0.4.17"
332
+ source = "registry+https://github.com/rust-lang/crates.io-index"
333
+ checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
334
+ dependencies = [
335
+ "cfg-if",
336
+ ]
337
+
338
+ [[package]]
339
+ name = "mach"
340
+ version = "0.3.2"
341
+ source = "registry+https://github.com/rust-lang/crates.io-index"
342
+ checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa"
343
+ dependencies = [
344
+ "libc",
345
+ ]
346
+
131
347
  [[package]]
132
348
  name = "magnus"
133
349
  version = "0.4.3"
@@ -156,15 +372,6 @@ version = "2.5.0"
156
372
  source = "registry+https://github.com/rust-lang/crates.io-index"
157
373
  checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d"
158
374
 
159
- [[package]]
160
- name = "memmap2"
161
- version = "0.5.8"
162
- source = "registry+https://github.com/rust-lang/crates.io-index"
163
- checksum = "4b182332558b18d807c4ce1ca8ca983b34c3ee32765e47b3f0f69b90355cc1dc"
164
- dependencies = [
165
- "libc",
166
- ]
167
-
168
375
  [[package]]
169
376
  name = "minimal-lexical"
170
377
  version = "0.2.1"
@@ -183,9 +390,9 @@ dependencies = [
183
390
 
184
391
  [[package]]
185
392
  name = "once_cell"
186
- version = "1.16.0"
393
+ version = "1.17.0"
187
394
  source = "registry+https://github.com/rust-lang/crates.io-index"
188
- checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
395
+ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
189
396
 
190
397
  [[package]]
191
398
  name = "peeking_take_while"
@@ -197,36 +404,14 @@ checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099"
197
404
  name = "perb"
198
405
  version = "0.1.0"
199
406
  dependencies = [
200
- "dynasmrt",
407
+ "cranelift",
408
+ "cranelift-jit",
409
+ "cranelift-module",
410
+ "cranelift-native",
201
411
  "magnus",
202
- "once_cell",
203
412
  "rb-sys",
204
413
  ]
205
414
 
206
- [[package]]
207
- name = "proc-macro-error"
208
- version = "1.0.4"
209
- source = "registry+https://github.com/rust-lang/crates.io-index"
210
- checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c"
211
- dependencies = [
212
- "proc-macro-error-attr",
213
- "proc-macro2",
214
- "quote",
215
- "syn",
216
- "version_check",
217
- ]
218
-
219
- [[package]]
220
- name = "proc-macro-error-attr"
221
- version = "1.0.4"
222
- source = "registry+https://github.com/rust-lang/crates.io-index"
223
- checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869"
224
- dependencies = [
225
- "proc-macro2",
226
- "quote",
227
- "version_check",
228
- ]
229
-
230
415
  [[package]]
231
416
  name = "proc-macro2"
232
417
  version = "1.0.49"
@@ -271,6 +456,18 @@ version = "0.1.1"
271
456
  source = "registry+https://github.com/rust-lang/crates.io-index"
272
457
  checksum = "74c38752410925faeb82c400c06ba2fd9ee6aa8f719dd33994c9e53f5242d25f"
273
458
 
459
+ [[package]]
460
+ name = "regalloc2"
461
+ version = "0.5.1"
462
+ source = "registry+https://github.com/rust-lang/crates.io-index"
463
+ checksum = "300d4fbfb40c1c66a78ba3ddd41c1110247cf52f97b87d0f2fc9209bd49b030c"
464
+ dependencies = [
465
+ "fxhash",
466
+ "log",
467
+ "slice-group-by",
468
+ "smallvec",
469
+ ]
470
+
274
471
  [[package]]
275
472
  name = "regex"
276
473
  version = "1.7.0"
@@ -288,6 +485,18 @@ version = "0.6.28"
288
485
  source = "registry+https://github.com/rust-lang/crates.io-index"
289
486
  checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848"
290
487
 
488
+ [[package]]
489
+ name = "region"
490
+ version = "2.2.0"
491
+ source = "registry+https://github.com/rust-lang/crates.io-index"
492
+ checksum = "877e54ea2adcd70d80e9179344c97f93ef0dffd6b03e1f4529e6e83ab2fa9ae0"
493
+ dependencies = [
494
+ "bitflags",
495
+ "libc",
496
+ "mach",
497
+ "winapi",
498
+ ]
499
+
291
500
  [[package]]
292
501
  name = "rustc-hash"
293
502
  version = "1.1.0"
@@ -306,6 +515,24 @@ version = "1.1.0"
306
515
  source = "registry+https://github.com/rust-lang/crates.io-index"
307
516
  checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3"
308
517
 
518
+ [[package]]
519
+ name = "slice-group-by"
520
+ version = "0.3.0"
521
+ source = "registry+https://github.com/rust-lang/crates.io-index"
522
+ checksum = "03b634d87b960ab1a38c4fe143b508576f075e7c978bfad18217645ebfdfa2ec"
523
+
524
+ [[package]]
525
+ name = "smallvec"
526
+ version = "1.10.0"
527
+ source = "registry+https://github.com/rust-lang/crates.io-index"
528
+ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0"
529
+
530
+ [[package]]
531
+ name = "stable_deref_trait"
532
+ version = "1.2.0"
533
+ source = "registry+https://github.com/rust-lang/crates.io-index"
534
+ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3"
535
+
309
536
  [[package]]
310
537
  name = "syn"
311
538
  version = "1.0.107"
@@ -317,6 +544,12 @@ dependencies = [
317
544
  "unicode-ident",
318
545
  ]
319
546
 
547
+ [[package]]
548
+ name = "target-lexicon"
549
+ version = "0.12.5"
550
+ source = "registry+https://github.com/rust-lang/crates.io-index"
551
+ checksum = "9410d0f6853b1d94f0e519fb95df60f29d2c1eff2d921ffdf01a4c8a3b54f12d"
552
+
320
553
  [[package]]
321
554
  name = "unicode-ident"
322
555
  version = "1.0.6"
@@ -329,6 +562,23 @@ version = "0.9.4"
329
562
  source = "registry+https://github.com/rust-lang/crates.io-index"
330
563
  checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f"
331
564
 
565
+ [[package]]
566
+ name = "wasi"
567
+ version = "0.11.0+wasi-snapshot-preview1"
568
+ source = "registry+https://github.com/rust-lang/crates.io-index"
569
+ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
570
+
571
+ [[package]]
572
+ name = "wasmtime-jit-icache-coherence"
573
+ version = "3.0.0"
574
+ source = "registry+https://github.com/rust-lang/crates.io-index"
575
+ checksum = "22d9c2e92b0fc124d2cad6cb497a4c840580a7dd2414a37109e8c7cfe699c0ea"
576
+ dependencies = [
577
+ "cfg-if",
578
+ "libc",
579
+ "windows-sys",
580
+ ]
581
+
332
582
  [[package]]
333
583
  name = "winapi"
334
584
  version = "0.3.9"
@@ -350,3 +600,60 @@ name = "winapi-x86_64-pc-windows-gnu"
350
600
  version = "0.4.0"
351
601
  source = "registry+https://github.com/rust-lang/crates.io-index"
352
602
  checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
603
+
604
+ [[package]]
605
+ name = "windows-sys"
606
+ version = "0.42.0"
607
+ source = "registry+https://github.com/rust-lang/crates.io-index"
608
+ checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7"
609
+ dependencies = [
610
+ "windows_aarch64_gnullvm",
611
+ "windows_aarch64_msvc",
612
+ "windows_i686_gnu",
613
+ "windows_i686_msvc",
614
+ "windows_x86_64_gnu",
615
+ "windows_x86_64_gnullvm",
616
+ "windows_x86_64_msvc",
617
+ ]
618
+
619
+ [[package]]
620
+ name = "windows_aarch64_gnullvm"
621
+ version = "0.42.0"
622
+ source = "registry+https://github.com/rust-lang/crates.io-index"
623
+ checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e"
624
+
625
+ [[package]]
626
+ name = "windows_aarch64_msvc"
627
+ version = "0.42.0"
628
+ source = "registry+https://github.com/rust-lang/crates.io-index"
629
+ checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4"
630
+
631
+ [[package]]
632
+ name = "windows_i686_gnu"
633
+ version = "0.42.0"
634
+ source = "registry+https://github.com/rust-lang/crates.io-index"
635
+ checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7"
636
+
637
+ [[package]]
638
+ name = "windows_i686_msvc"
639
+ version = "0.42.0"
640
+ source = "registry+https://github.com/rust-lang/crates.io-index"
641
+ checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246"
642
+
643
+ [[package]]
644
+ name = "windows_x86_64_gnu"
645
+ version = "0.42.0"
646
+ source = "registry+https://github.com/rust-lang/crates.io-index"
647
+ checksum = "bf7b1b21b5362cbc318f686150e5bcea75ecedc74dd157d874d754a2ca44b0ed"
648
+
649
+ [[package]]
650
+ name = "windows_x86_64_gnullvm"
651
+ version = "0.42.0"
652
+ source = "registry+https://github.com/rust-lang/crates.io-index"
653
+ checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028"
654
+
655
+ [[package]]
656
+ name = "windows_x86_64_msvc"
657
+ version = "0.42.0"
658
+ source = "registry+https://github.com/rust-lang/crates.io-index"
659
+ checksum = "f40009d85759725a34da6d89a94e63d7bdc50a862acf0dbc7c8e488f1edcb6f5"
data/ext/perb/Cargo.toml CHANGED
@@ -11,8 +11,10 @@ crate-type = ["cdylib"]
11
11
  [dependencies]
12
12
  magnus = { version = "0.4", features = ["rb-sys-interop"] }
13
13
  rb-sys = "0.9.53"
14
- dynasmrt = "1"
15
- once_cell = "1"
14
+ cranelift = "0.91.0"
15
+ cranelift-jit = "0.91.0"
16
+ cranelift-native = "0.91.0"
17
+ cranelift-module = "0.91.0"
16
18
 
17
19
  [profile.release]
18
20
  debug = true
data/ext/perb/src/lib.rs CHANGED
@@ -1,60 +1,49 @@
1
- use std::{io::Write, mem, sync::RwLock};
1
+ use std::{mem};
2
2
 
3
- use dynasmrt::{dynasm, AssemblyOffset, DynasmApi};
3
+ use cranelift::{prelude::{Signature, FunctionBuilderContext, FunctionBuilder, InstBuilder, settings, Configurable}};
4
+ use cranelift_module::{Module, Linkage};
4
5
  use magnus::{define_module, function, rb_sys::FromRawValue};
5
- use once_cell::sync::Lazy;
6
-
7
- static ASSEMBLER: Lazy<RwLock<dynasmrt::x64::Assembler>> =
8
- Lazy::new(|| RwLock::new(dynasmrt::x64::Assembler::new().unwrap()));
9
6
 
10
7
  fn build_wrapper(fn_name: String) -> usize {
11
- let mut ops = ASSEMBLER.write().unwrap();
12
- let asm_wrapper = ops.offset();
13
-
14
- dynasm!(ops
15
- ; push rbp
16
- ; mov rbp, rsp
17
- ; xor rdi, rdi
18
- ; mov rax, QWORD rb_sys::rb_yield as _
19
- ; call rax
20
- ; leave
21
- ; ret
22
- );
23
-
24
- let end_offset = AssemblyOffset(ops.offset().0 - 1);
25
-
26
- ops.commit().unwrap();
27
-
28
- let executor = ops.reader();
29
- let buf = executor.lock();
30
-
31
- let file_name = format!("/tmp/perf-{}.map", std::process::id());
32
- let file = std::fs::OpenOptions::new()
33
- .append(true)
34
- .create(true)
35
- .open(file_name)
36
- .unwrap();
37
-
38
- let mut line_writer = std::io::LineWriter::new(file);
39
- let len = unsafe { buf.ptr(end_offset).offset_from(buf.ptr(asm_wrapper)) };
40
- let perf_map = format!(
41
- "{:x} {:x} {}\n",
42
- buf.ptr(asm_wrapper) as usize,
43
- len,
44
- fn_name
45
- );
46
- line_writer.write_all(perf_map.as_bytes()).unwrap();
8
+ let mut builder = settings::builder();
9
+ builder.enable("unwind_info").unwrap();
10
+ let flags = settings::Flags::new(builder);
11
+ let isa = cranelift_native::builder().unwrap().finish(flags).unwrap();
12
+ let jit_builder = cranelift_jit::JITBuilder::with_isa(isa, cranelift_module::default_libcall_names());
13
+ let mut jit_module = cranelift_jit::JITModule::new(jit_builder);
14
+ let mut ctx = jit_module.make_context();
15
+
16
+ ctx.func.signature.returns.push(cranelift::prelude::AbiParam::new(cranelift::prelude::types::I64));
17
+ let mut fn_builder_ctx = FunctionBuilderContext::new();
18
+ {
19
+ let mut builder = FunctionBuilder::new(&mut ctx.func, &mut fn_builder_ctx);
20
+ let block = builder.create_block();
21
+ builder.append_block_params_for_function_params(block);
22
+
23
+ let mut external_func_sig = Signature::new(cranelift::prelude::isa::CallConv::SystemV);
24
+ external_func_sig.returns.push(cranelift::prelude::AbiParam::new(cranelift::prelude::types::I64));
25
+ external_func_sig.params.push(cranelift::prelude::AbiParam::new(cranelift::prelude::types::I64));
26
+ let sif_ref = builder.import_signature(external_func_sig);
27
+
28
+ builder.switch_to_block(block);
29
+ let args = &[builder.ins().iconst(cranelift::prelude::types::I64, 0)];
30
+ let fn_ptr = builder.ins().iconst(cranelift::prelude::types::I64, rb_sys::rb_yield as usize as i64);
31
+ let result = builder.ins().call_indirect(
32
+ sif_ref,
33
+ fn_ptr,
34
+ args,
35
+ );
36
+ let result = builder.inst_results(result)[0];
37
+ builder.ins().return_(&[result]);
38
+ }
47
39
 
48
- asm_wrapper.0
40
+ let f_id = jit_module.declare_function(&fn_name, Linkage::Export, &ctx.func.signature).unwrap();
41
+ jit_module.define_function(f_id, &mut ctx).unwrap();
42
+ jit_module.finalize_definitions().unwrap();
43
+ jit_module.get_finalized_function(f_id) as usize
49
44
  }
50
45
 
51
46
  fn wrapper(fn_pointer: usize) -> magnus::Value {
52
- let fn_pointer = ASSEMBLER
53
- .read()
54
- .unwrap()
55
- .reader()
56
- .lock()
57
- .ptr(AssemblyOffset(fn_pointer));
58
47
  unsafe {
59
48
  let asm_wrapper_fn: extern "C" fn() -> rb_sys::Value = mem::transmute(fn_pointer);
60
49
  magnus::Value::from_raw(asm_wrapper_fn())
data/lib/perb/setup.rb CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  require_relative "../perb"
4
4
 
5
+ ENV["PERF_BUILDID_DIR"] = "1"
6
+
5
7
  class << RubyVM::InstructionSequence
6
8
  prepend(Perb::InstructionSequenceExt)
7
9
  end
data/lib/perb/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Perb
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end
data/lib/perb.rb CHANGED
@@ -19,7 +19,7 @@ module Perb
19
19
  return if block.nil?
20
20
 
21
21
  insert_before(block.loc.expression, "Perb::wrapper(#{Perb.build_wrapper(method_info)}) do\n")
22
- insert_after(block.loc.expression, "\nend")
22
+ insert_after(node.loc.expression, "\nend")
23
23
  end
24
24
  end
25
25
  end
@@ -35,7 +35,7 @@ module Perb
35
35
 
36
36
  ast = parser.parse(source)
37
37
  source = rewriter.rewrite(source, ast)
38
- RubyVM::InstructionSequence.compile(source)
38
+ RubyVM::InstructionSequence.compile(source, path, path)
39
39
  end
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marco Concetto Rudilosso
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-12-29 00:00:00.000000000 Z
12
+ date: 2023-01-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: parser
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '3.1'
20
+ version: '3.2'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '3.1'
27
+ version: '3.2'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rb_sys
30
30
  requirement: !ruby/object:Gem::Requirement