wardite 0.9.0 → 1.0.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.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +191 -0
  3. data/Makefile +14 -0
  4. data/README.md +80 -1
  5. data/Rakefile +5 -0
  6. data/benchmark/README.md +500 -0
  7. data/benchmark/build_call_profile.rb +42 -0
  8. data/benchmark/call_cost_worker.rb +27 -0
  9. data/benchmark/compare.rb +93 -0
  10. data/benchmark/compare_call_types.rb +212 -0
  11. data/benchmark/compare_dispatch.rb +123 -0
  12. data/benchmark/compare_engines.rb +119 -0
  13. data/benchmark/compare_optimizations.rb +139 -0
  14. data/benchmark/engine_phases.rb +30 -0
  15. data/benchmark/figures/README.md +35 -0
  16. data/benchmark/figures/plot_spinel_comparison.py +137 -0
  17. data/benchmark/figures/spinel_new_vm_candlestick.png +0 -0
  18. data/benchmark/figures/spinel_new_vm_candlestick.svg +7615 -0
  19. data/benchmark/figures/spinel_new_vm_summary.csv +9 -0
  20. data/benchmark/figures/spinel_new_vm_summary.json +82 -0
  21. data/benchmark/float_m5.wat +42 -0
  22. data/benchmark/i32_call_arities.wat +89 -0
  23. data/benchmark/i32_calls.wat +174 -0
  24. data/benchmark/i32_memory.wat +58 -0
  25. data/benchmark/i32_mix.wat +80 -0
  26. data/benchmark/i64_m4.wat +55 -0
  27. data/benchmark/investigate_calls.rb +231 -0
  28. data/benchmark/investigate_generated_guards.rb +218 -0
  29. data/benchmark/m3_call_worker.rb +38 -0
  30. data/benchmark/measure_m1.rb +51 -0
  31. data/benchmark/measure_m2.rb +55 -0
  32. data/benchmark/measure_m3_calls.rb +89 -0
  33. data/benchmark/measure_m4.rb +134 -0
  34. data/benchmark/measure_m5_boundary.rb +41 -0
  35. data/benchmark/measure_wasi_write.rb +75 -0
  36. data/benchmark/optimization_worker.rb +23 -0
  37. data/benchmark/results/call_arities_exploratory_2026-11-04.json +4320 -0
  38. data/benchmark/results/call_arities_spinel_2026-11-04.json +1200 -0
  39. data/benchmark/results/call_cost_spinel_2026-11-04.json +2392 -0
  40. data/benchmark/results/call_protocol_exploratory_2026-11-04.json +3947 -0
  41. data/benchmark/results/call_protocol_profile_2026-11-04.json +383 -0
  42. data/benchmark/results/call_protocol_ruby_2026-11-04.json +1213 -0
  43. data/benchmark/results/call_protocol_spinel_2026-11-04.json +913 -0
  44. data/benchmark/results/call_types_ruby_2026-11-04.json +1212 -0
  45. data/benchmark/results/call_types_spinel_2026-11-04.json +923 -0
  46. data/benchmark/results/efflorescence-m1-cruby.json +799 -0
  47. data/benchmark/results/efflorescence-m1-spinel.json +799 -0
  48. data/benchmark/results/efflorescence-m2-bulk-loop.json +820 -0
  49. data/benchmark/results/efflorescence-m2-i32-cruby.json +799 -0
  50. data/benchmark/results/efflorescence-m2-i32-spinel.json +799 -0
  51. data/benchmark/results/efflorescence-m2-memory.json +408 -0
  52. data/benchmark/results/generated_guards_exploratory_2026-11-04.json +1225 -0
  53. data/benchmark/results/generated_guards_profile_2026-11-04.json +592 -0
  54. data/benchmark/results/generated_guards_spinel_2026-11-04.json +1650 -0
  55. data/benchmark/results/generated_guards_validation_2026-11-04.json +256 -0
  56. data/benchmark/results/inlining_engines_2026-11-04.json +241 -0
  57. data/benchmark/results/inlining_ruby_2026-11-04.json +1213 -0
  58. data/benchmark/results/inlining_spinel_2026-11-04.json +893 -0
  59. data/benchmark/results/operand_decode_exploratory_2026-11-04.json +1319 -0
  60. data/benchmark/results/operand_decode_ruby_2026-11-04.json +1213 -0
  61. data/benchmark/results/operand_decode_spinel_2026-11-04.json +924 -0
  62. data/benchmark/results/selective_reset_spinel_2026-11-04.json +454 -0
  63. data/benchmark/results/selective_reset_spinel_2026-11-04_exploratory.json +2679 -0
  64. data/benchmark/results/spinel_fetch_root_patch_2026-11-04.json +4523 -0
  65. data/benchmark/results/while_final_compiler_comparison_2026-11-04.json +324 -0
  66. data/benchmark/results/while_patched_external_2026-11-04.json +220 -0
  67. data/benchmark/results/while_user_unpatched_2026-11-04.json +230 -0
  68. data/benchmark/summarize_call_profile.py +54 -0
  69. data/benchmark/validate_m1_eh.rb +34 -0
  70. data/benchmark/validate_m2.rb +119 -0
  71. data/benchmark/validate_m3.rb +44 -0
  72. data/benchmark/validate_m4.rb +95 -0
  73. data/benchmark/validate_m5.rb +108 -0
  74. data/docs/adr/0001-efflorescence-m1-control-and-eh.md +319 -0
  75. data/docs/adr/0002-efflorescence-m2-memory-and-globals.md +185 -0
  76. data/docs/adr/0003-efflorescence-m3-host-and-indirect-calls.md +228 -0
  77. data/docs/adr/0004-efflorescence-m4-i64.md +202 -0
  78. data/docs/adr/0005-efflorescence-m5-floating-point.md +127 -0
  79. data/docs/adr/0006-efflorescence-m6-coverage-parity.md +101 -0
  80. data/docs/efflorescence-call-arities.md +115 -0
  81. data/docs/efflorescence-call-investigation.md +155 -0
  82. data/docs/efflorescence-call-transfer.md +128 -0
  83. data/docs/efflorescence-call-types.md +102 -0
  84. data/docs/efflorescence-coverage-ja.md +351 -0
  85. data/docs/efflorescence-generated-c-guards.md +405 -0
  86. data/docs/efflorescence-inlining.md +165 -0
  87. data/docs/efflorescence-ja.md +155 -0
  88. data/docs/efflorescence-m1.md +160 -0
  89. data/docs/efflorescence-m2.md +233 -0
  90. data/docs/efflorescence-m3.md +131 -0
  91. data/docs/efflorescence-m4.md +88 -0
  92. data/docs/efflorescence-m5.md +82 -0
  93. data/docs/efflorescence-m6.md +95 -0
  94. data/docs/efflorescence-operand-decoding.md +105 -0
  95. data/docs/efflorescence-phase2-ja.md +225 -0
  96. data/docs/efflorescence-phase2.md +240 -0
  97. data/docs/efflorescence-register-initialization.md +75 -0
  98. data/docs/efflorescence.md +144 -0
  99. data/docs/spinel-string-aset-inplace-proposal.md +200 -0
  100. data/lib/wardite/alu_f32.generated.rb +1 -0
  101. data/lib/wardite/alu_f64.generated.rb +1 -0
  102. data/lib/wardite/alu_i32.generated.rb +14 -9
  103. data/lib/wardite/alu_i64.generated.rb +18 -20
  104. data/lib/wardite/cli/cli.rb +61 -28
  105. data/lib/wardite/const.rb +1 -0
  106. data/lib/wardite/efflorescence/float_arithmetic.rb +216 -0
  107. data/lib/wardite/efflorescence/i64_arithmetic.rb +257 -0
  108. data/lib/wardite/efflorescence/inspection.rb +165 -0
  109. data/lib/wardite/efflorescence/ir.rb +1151 -0
  110. data/lib/wardite/efflorescence/optimizer.rb +580 -0
  111. data/lib/wardite/efflorescence/register_validation.rb +290 -0
  112. data/lib/wardite/efflorescence/store_access.rb +271 -0
  113. data/lib/wardite/efflorescence/translator.rb +859 -0
  114. data/lib/wardite/efflorescence/vm.rb +1006 -0
  115. data/lib/wardite/efflorescence/wasi.rb +108 -0
  116. data/lib/wardite/efflorescence.rb +11 -0
  117. data/lib/wardite/errors.rb +20 -0
  118. data/lib/wardite/float_bits.rb +46 -0
  119. data/lib/wardite/instruction.rb +35 -4
  120. data/lib/wardite/leb128.rb +33 -12
  121. data/lib/wardite/load.rb +203 -138
  122. data/lib/wardite/value.rb +169 -175
  123. data/lib/wardite/version.rb +1 -1
  124. data/lib/wardite/wasi/consts.rb +1 -0
  125. data/lib/wardite/wasm_module.rb +6 -3
  126. data/lib/wardite.rb +184 -70
  127. data/rbs_collection.lock.yaml +36 -96
  128. data/scripts/gen_alu.rb +66 -10
  129. data/sig/generated/wardite/cli/cli.rbs +8 -6
  130. data/sig/generated/wardite/const.rbs +2 -0
  131. data/sig/generated/wardite/efflorescence/float_arithmetic.rbs +65 -0
  132. data/sig/generated/wardite/efflorescence/i64_arithmetic.rbs +99 -0
  133. data/sig/generated/wardite/efflorescence/inspection.rbs +64 -0
  134. data/sig/generated/wardite/efflorescence/ir.rbs +881 -0
  135. data/sig/generated/wardite/efflorescence/optimizer.rbs +189 -0
  136. data/sig/generated/wardite/efflorescence/register_validation.rbs +76 -0
  137. data/sig/generated/wardite/efflorescence/store_access.rbs +134 -0
  138. data/sig/generated/wardite/efflorescence/translator.rbs +214 -0
  139. data/sig/generated/wardite/efflorescence/vm.rbs +179 -0
  140. data/sig/generated/wardite/efflorescence/wasi.rbs +47 -0
  141. data/sig/generated/wardite/errors.rbs +12 -0
  142. data/sig/generated/wardite/float_bits.rbs +30 -0
  143. data/sig/generated/wardite/instruction.rbs +22 -1
  144. data/sig/generated/wardite/leb128.rbs +3 -1
  145. data/sig/generated/wardite/load.rbs +29 -4
  146. data/sig/generated/wardite/value.rbs +70 -11
  147. data/sig/generated/wardite/wasi/consts.rbs +2 -0
  148. data/sig/generated/wardite.rbs +49 -12
  149. data/sig/vernier.rbs +2 -2
  150. data/spinel/README.md +30 -0
  151. data/spinel/bin/wardite.rb +6 -0
  152. data/spinel/spin.toml +7 -0
  153. metadata +126 -3
data/scripts/gen_alu.rb CHANGED
@@ -21,7 +21,8 @@ module GenAlu
21
21
  def self.generate_ops(prefix:, defined_ops:)
22
22
  result = StringIO.new("")
23
23
  defined_ops.each do |op|
24
- code = DEFS[op.to_sym].dup
24
+ key = ["i32", "i64"].include?(prefix) && op.to_sym == :mul ? :mul_integer : :"#{op}_#{prefix}"
25
+ code = (DEFS[key] || DEFS[op.to_sym]).dup
25
26
  if ! code
26
27
  raise "unsupported code specified! #{op.inspect}"
27
28
  end
@@ -278,6 +279,7 @@ module GenAlu
278
279
  const__f: <<~RUBY,
279
280
  when :${PREFIX}_const
280
281
  const = operand[0]
282
+ const = const.value if const.is_a?(FloatImmediate)
281
283
  if !const.is_a?(Float)
282
284
  raise EvalError, "invalid type of operand"
283
285
  end
@@ -462,7 +464,7 @@ module GenAlu
462
464
  finish = target.memsize
463
465
  count = 0
464
466
  while count < finish
465
- if (target.value & (1 << count)).zero?
467
+ if target.value[count].zero?
466
468
  count += 1
467
469
  else
468
470
  break
@@ -480,13 +482,22 @@ module GenAlu
480
482
  digits = target.memsize
481
483
  count = 0
482
484
  digits.times do |i|
483
- if (target.value & (1 << i)).nonzero?
485
+ if target.value[i].nonzero?
484
486
  count += 1
485
487
  end
486
488
  end
487
489
  runtime.stack.push(${CLASS}(count))
488
490
  RUBY
489
491
 
492
+ add_i64: <<~RUBY,
493
+ when :i64_add
494
+ right, left = runtime.stack.pop, runtime.stack.pop
495
+ if !right.is_a?(I64) || !left.is_a?(I64)
496
+ raise EvalError, "maybe empty or invalid stack"
497
+ end
498
+ runtime.stack.push(left.add(right))
499
+ RUBY
500
+
490
501
  add: <<~RUBY,
491
502
  when :${PREFIX}_add
492
503
  right, left = runtime.stack.pop, runtime.stack.pop
@@ -505,6 +516,15 @@ module GenAlu
505
516
  runtime.stack.push(${CLASS}(left.value - right.value))
506
517
  RUBY
507
518
 
519
+ mul_integer: <<~RUBY,
520
+ when :${PREFIX}_mul
521
+ right, left = runtime.stack.pop, runtime.stack.pop
522
+ if !right.is_a?(${CLASS}) || !left.is_a?(${CLASS})
523
+ raise EvalError, "maybe empty or invalid stack"
524
+ end
525
+ runtime.stack.push(left.multiply(right))
526
+ RUBY
527
+
508
528
  mul: <<~RUBY,
509
529
  when :${PREFIX}_mul
510
530
  right, left = runtime.stack.pop, runtime.stack.pop
@@ -520,12 +540,17 @@ module GenAlu
520
540
  if !right.is_a?(${CLASS}) || !left.is_a?(${CLASS})
521
541
  raise EvalError, "maybe empty or invalid stack"
522
542
  end
523
- result = left.value_s / right.value_s.to_f
524
- iresult = (result >= 0 ? result.floor : result.ceil).to_i
525
- if iresult >= (1 << (left.memsize - 1))
543
+ dividend = left.value_s
544
+ divisor = right.value_s
545
+ signed_min = -(1 << (left.memsize - 2)) * 2
546
+ if dividend == signed_min && divisor == -1
526
547
  raise IntegerOverflow, "integer overflow"
527
548
  end
528
-
549
+ iresult = dividend / divisor
550
+ # Ruby rounds integer division down; Wasm truncates toward zero.
551
+ if (dividend < 0) != (divisor < 0) && dividend % divisor != 0
552
+ iresult += 1
553
+ end
529
554
  runtime.stack.push(${CLASS}(iresult))
530
555
  RUBY
531
556
 
@@ -598,6 +623,15 @@ module GenAlu
598
623
  runtime.stack.push(${CLASS}(left.value ^ right.value))
599
624
  RUBY
600
625
 
626
+ shl_i64: <<~RUBY,
627
+ when :i64_shl
628
+ right, left = runtime.stack.pop, runtime.stack.pop
629
+ if !right.is_a?(I64) || !left.is_a?(I64)
630
+ raise EvalError, "maybe empty or invalid stack"
631
+ end
632
+ runtime.stack.push(left.shift_left(right.value % 64))
633
+ RUBY
634
+
601
635
  shl: <<~RUBY,
602
636
  when :${PREFIX}_shl
603
637
  right, left = runtime.stack.pop, runtime.stack.pop
@@ -630,6 +664,17 @@ module GenAlu
630
664
  runtime.stack.push(${CLASS}(value))
631
665
  RUBY
632
666
 
667
+ rotl_i64: <<~RUBY,
668
+ when :i64_rotl
669
+ right, left = runtime.stack.pop, runtime.stack.pop
670
+ if !right.is_a?(I64) || !left.is_a?(I64)
671
+ raise EvalError, "maybe empty or invalid stack"
672
+ end
673
+ k = right.value % 64
674
+ value = left.shift_left(k).value | (left.value >> (64 - k))
675
+ runtime.stack.push(I64(value))
676
+ RUBY
677
+
633
678
  rotl: <<~RUBY,
634
679
  when :${PREFIX}_rotl
635
680
  right, left = runtime.stack.pop, runtime.stack.pop
@@ -638,11 +683,22 @@ module GenAlu
638
683
  end
639
684
  k = (right.value % right.memsize)
640
685
  rotated = left.value << k
641
- rest = left.value & (${CLASS}::${CLASS}_MAX << (right.memsize - k))
642
- value = rotated | (rest >> (right.memsize - k))
686
+ rest = left.value >> (right.memsize - k)
687
+ value = rotated | rest
643
688
  runtime.stack.push(${CLASS}(value))
644
689
  RUBY
645
690
 
691
+ rotr_i64: <<~RUBY,
692
+ when :i64_rotr
693
+ right, left = runtime.stack.pop, runtime.stack.pop
694
+ if !right.is_a?(I64) || !left.is_a?(I64)
695
+ raise EvalError, "maybe empty or invalid stack"
696
+ end
697
+ k = right.value % 64
698
+ value = (left.value >> k) | left.shift_left((64 - k) % 64).value
699
+ runtime.stack.push(I64(value))
700
+ RUBY
701
+
646
702
  rotr: <<~RUBY,
647
703
  when :${PREFIX}_rotr
648
704
  right, left = runtime.stack.pop, runtime.stack.pop
@@ -761,4 +817,4 @@ module GenAlu
761
817
 
762
818
  # ...end generative ops
763
819
  }
764
- end
820
+ end
@@ -17,6 +17,14 @@ module Wardite
17
17
 
18
18
  attr_reader yjit: bool
19
19
 
20
+ attr_reader new_engine: bool
21
+
22
+ attr_reader disabled_optimizations: Array[Symbol]
23
+
24
+ attr_reader mir_dump: bool
25
+
26
+ attr_reader mir_profile: bool
27
+
20
28
  attr_reader profile_file_path: String?
21
29
 
22
30
  # @rbs args: Array[String]
@@ -24,8 +32,6 @@ module Wardite
24
32
  def initialize: (Array[String] args) -> void
25
33
 
26
34
  # @rbs return: Array[Integer | Float]
27
- # @rbs %a{pure}
28
- %a{pure}
29
35
  def args: () -> Array[Integer | Float]
30
36
 
31
37
  # @rbs return: ::Wardite::Instance
@@ -44,13 +50,9 @@ module Wardite
44
50
  def invoke_wasi: () -> void
45
51
 
46
52
  # @rbs return: String?
47
- # @rbs %a{pure}
48
- %a{pure}
49
53
  def mount_src: () -> String?
50
54
 
51
55
  # @rbs return: String?
52
- # @rbs %a{pure}
53
- %a{pure}
54
56
  def mount_dst: () -> String?
55
57
  end
56
58
  end
@@ -30,6 +30,8 @@ module Wardite
30
30
  SectionData: Integer
31
31
 
32
32
  SectionDataCount: Integer
33
+
34
+ SectionTag: Integer
33
35
  end
34
36
 
35
37
  include Const
@@ -0,0 +1,65 @@
1
+ # Generated from lib/wardite/efflorescence/float_arithmetic.rb with RBS::Inline
2
+
3
+ module Wardite
4
+ module Efflorescence
5
+ module FloatArithmetic
6
+ F32_SIGN: ::Integer
7
+
8
+ F32_INFINITY: ::Integer
9
+
10
+ F64_INFINITY: ::Integer
11
+
12
+ F32_NAN: ::Integer
13
+
14
+ F64_NAN: ::Integer
15
+
16
+ # @rbs opcode: Integer
17
+ # @rbs left: Integer
18
+ # @rbs right: Integer
19
+ # @rbs return: Integer
20
+ def self.calculate: (Integer opcode, Integer left, Integer right) -> Integer
21
+
22
+ # @rbs op: Integer
23
+ # @rbs value: Float
24
+ # @rbs return: Integer
25
+ def self.integral: (Integer op, Float value) -> Integer
26
+
27
+ # @rbs opcode: Integer
28
+ # @rbs bits: Integer
29
+ # @rbs return: Integer
30
+ def self.convert: (Integer opcode, Integer bits) -> Integer
31
+
32
+ # Round the unsigned magnitude directly to the target significand.
33
+ # @rbs target: Symbol
34
+ # @rbs value: Integer
35
+ # @rbs signed: bool
36
+ # @rbs return: Integer
37
+ def self.integer_to_float: (Symbol target, Integer value, bool signed) -> Integer
38
+
39
+ # Compare the truncated magnitude in integer space, including MIN and
40
+ # the upper half of unsigned i64, which both have the carrier sign set.
41
+ # @rbs target: Symbol
42
+ # @rbs source: Symbol
43
+ # @rbs bits: Integer
44
+ # @rbs signed: bool
45
+ # @rbs saturating: bool
46
+ # @rbs return: Integer
47
+ def self.truncate: (Symbol target, Symbol source, Integer bits, bool signed, bool saturating) -> Integer
48
+
49
+ # A normalized quotient of binary32 inputs is A/B scaled by a power of
50
+ # two. B < 2**24. Its distance from a binary32 midpoint, unless equal,
51
+ # exceeds 2**-48 in the quotient's binade scaled to [1, 2).
52
+ # @rbs left: Float
53
+ # @rbs right: Float
54
+ # @rbs return: Float
55
+ def self.divide: (Float left, Float right) -> Float
56
+
57
+ # Squaring a binary32 midpoint gives a dyadic with at most 48 fractional
58
+ # bits in that binade's scale. A distinct binary32 radicand differs by at
59
+ # least 2**-48, so its square root differs by more than 2**-50.
60
+ # @rbs value: Float
61
+ # @rbs return: Float
62
+ def self.sqrt: (Float value) -> Float
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,99 @@
1
+ # Generated from lib/wardite/efflorescence/i64_arithmetic.rb with RBS::Inline
2
+
3
+ module Wardite
4
+ module Efflorescence
5
+ module I64Arithmetic
6
+ MASK: ::Integer
7
+
8
+ MIN: Integer
9
+
10
+ # @rbs value: Integer
11
+ # @rbs return: Integer
12
+ def self.low: (Integer value) -> Integer
13
+
14
+ # @rbs value: Integer
15
+ # @rbs return: Integer
16
+ def self.high: (Integer value) -> Integer
17
+
18
+ # @rbs low: Integer
19
+ # @rbs high: Integer
20
+ # @rbs return: Integer
21
+ def self.join: (Integer low, Integer high) -> Integer
22
+
23
+ # @rbs value: Integer
24
+ # @rbs return: Integer
25
+ def self.normalize: (Integer value) -> Integer
26
+
27
+ # Sign extension for an integer field of at most 32 bits.
28
+ # @rbs value: Integer
29
+ # @rbs width: Integer
30
+ # @rbs return: Integer
31
+ def self.extend: (Integer value, Integer width) -> Integer
32
+
33
+ # @rbs left: Integer
34
+ # @rbs right: Integer
35
+ # @rbs return: bool
36
+ def self.unsigned_less?: (Integer left, Integer right) -> bool
37
+
38
+ # @rbs value: Integer
39
+ # @rbs count: Integer
40
+ # @rbs return: Integer
41
+ def self.shift_left: (Integer value, Integer count) -> Integer
42
+
43
+ # @rbs value: Integer
44
+ # @rbs count: Integer
45
+ # @rbs signed: bool
46
+ # @rbs return: Integer
47
+ def self.shift_right: (Integer value, Integer count, bool signed) -> Integer
48
+
49
+ # @rbs value: Integer
50
+ # @rbs return: Integer
51
+ def self.clz32: (Integer value) -> Integer
52
+
53
+ # @rbs value: Integer
54
+ # @rbs return: Integer
55
+ def self.ctz32: (Integer value) -> Integer
56
+
57
+ # @rbs value: Integer
58
+ # @rbs return: Integer
59
+ def self.popcnt32: (Integer value) -> Integer
60
+
61
+ # @rbs left: Integer
62
+ # @rbs right: Integer
63
+ # @rbs return: Integer
64
+ def self.add_i64: (Integer left, Integer right) -> Integer
65
+
66
+ # @rbs left: Integer
67
+ # @rbs right: Integer
68
+ # @rbs return: Integer
69
+ def self.subtract_i64: (Integer left, Integer right) -> Integer
70
+
71
+ # Only the four least significant base-2**16 digits contribute.
72
+ # @rbs left: Integer
73
+ # @rbs right: Integer
74
+ # @rbs return: Integer
75
+ def self.multiply_i64: (Integer left, Integer right) -> Integer
76
+
77
+ # The sign bit remains part of the unsigned magnitude, including MIN.
78
+ # @rbs opcode: Integer
79
+ # @rbs left: Integer
80
+ # @rbs right: Integer
81
+ # @rbs return: Integer
82
+ def self.divide: (Integer opcode, Integer left, Integer right) -> Integer
83
+
84
+ # Shift in one dividend bit per step. Preserve the extra remainder bit
85
+ # until comparison and subtraction have consumed it.
86
+ # @rbs dividend: Integer
87
+ # @rbs divisor: Integer
88
+ # @rbs remainder: bool
89
+ # @rbs return: Integer
90
+ def self.unsigned_divide: (Integer dividend, Integer divisor, bool remainder) -> Integer
91
+
92
+ # @rbs opcode: Integer
93
+ # @rbs left: Integer
94
+ # @rbs right: Integer
95
+ # @rbs return: Integer
96
+ def self.calculate: (Integer opcode, Integer left, Integer right) -> Integer
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,64 @@
1
+ # Generated from lib/wardite/efflorescence/inspection.rb with RBS::Inline
2
+
3
+ module Wardite
4
+ module Efflorescence
5
+ class Metrics
6
+ attr_reader opcode_counts: Array[Integer]
7
+
8
+ attr_reader register_reads: Integer
9
+
10
+ attr_reader register_writes: Integer
11
+
12
+ attr_accessor frames_created: Integer
13
+
14
+ attr_accessor host_calls: Integer
15
+
16
+ attr_accessor root_defined_entries: Integer
17
+
18
+ def initialize: () -> untyped
19
+
20
+ # @rbs opcode: Integer
21
+ # @rbs reads: Integer
22
+ # @rbs writes: Integer
23
+ # @rbs return: void
24
+ def record: (Integer opcode, Integer reads, Integer writes) -> void
25
+
26
+ # @rbs return: Integer
27
+ def dispatches: () -> Integer
28
+
29
+ # @rbs return: Integer
30
+ def copies: () -> Integer
31
+
32
+ # @rbs parameter_count: Integer
33
+ # @rbs return: void
34
+ def enter_indirect_defined: (Integer parameter_count) -> void
35
+
36
+ # @rbs return: Integer
37
+ def indirect_calls: () -> Integer
38
+
39
+ # @rbs return: Integer
40
+ def function_entries: () -> Integer
41
+
42
+ # @rbs return: String
43
+ def report: () -> String
44
+ end
45
+
46
+ # Profiling is compiled into a separate instrumented MIR. The ordinary
47
+ # dispatch loop never tests an enabled flag or updates per-instruction stats.
48
+ class Instrumentation
49
+ # @rbs ir: Wardite::Efflorescence::IR
50
+ # @rbs return: Wardite::Efflorescence::IR
51
+ def instrument: (Wardite::Efflorescence::IR ir) -> Wardite::Efflorescence::IR
52
+ end
53
+
54
+ class Inspection
55
+ # @rbs ir: Wardite::Efflorescence::IR
56
+ # @rbs return: String
57
+ def disassemble: (Wardite::Efflorescence::IR ir) -> String
58
+
59
+ # @rbs ir: Wardite::Efflorescence::IR
60
+ # @rbs return: String
61
+ def statistics: (Wardite::Efflorescence::IR ir) -> String
62
+ end
63
+ end
64
+ end