aboutsummaryrefslogtreecommitdiff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2023-01-25 22:06:06 -0500
committerMarshall Lochbaum <mwlochbaum@gmail.com>2023-01-25 22:06:06 -0500
commit93dcd2ac02276f3f2aac51247923d2af64f2b500 (patch)
tree0638368ff1c9be671cd544c3d78a4c8c10430fbf /src/bootstrap
parent20a243ff42eab8e1bb4afe9d5cc54f5d32983b57 (diff)
Don't get variable last use in boot3
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/boot3.bqn6
-rw-r--r--src/bootstrap/verify.bqn3
2 files changed, 4 insertions, 5 deletions
diff --git a/src/bootstrap/boot3.bqn b/src/bootstrap/boot3.bqn
index ccbd2d28..5c400530 100644
--- a/src/bootstrap/boot3.bqn
+++ b/src/bootstrap/boot3.bqn
@@ -72,15 +72,13 @@
rev←⍋+`¯1↓(¯1∾gb)((⍋⊣)⊏((⍋⊢)⊏⊣)¬⊏˜)⍋(+`+⊢)1∾gb⊏r=¯1
# Lexical resolution, no nesting
- # The last-use indicator ⌽∊⌽ii has to be done in rev ordering which
- # prevents some improvements
rx←rev⊏𝕩
iv←/(rx≥⊑bI)∧rx<vi+nv # Variable indices
vv←(iv⊏rx)-vi # Variable name
ii←3↓⊐(¯3+↕3)∾vv # Slot within frame
va←iv⊏»rx⋄vb←(va≥⊑bG)∧va<+´bG # Variable assignment, if it's there
idor←∾3/⟨iv⟩ # Identifier bytecode ordering
- idoc←⟨32+vb+2×vb<⌽∊⌽ii,0¨ii,ii⟩ # Identifier bytecode: instruction, depth, slot
+ idoc←⟨32+vb,0¨ii,ii⟩ # Identifier bytecode: instruction, depth, slot
dn←⟨⟨⟩,(va=⊑bG)/vv⟩ # Identifier name ID, per-block
# Parsing
@@ -97,7 +95,7 @@
dy←fa⊏«(tr∧r≥0)∨op<r=0 # Dyadic
pr←𝕩⊏˜pi←/𝕩<sep⋄ob←pr⊏/¯1(⊢-»)u←⍷∧pr # Objects to be loaded
cn←pi∾lt←/𝕩≥cl←vi+nv⋄ob↩ob∾(cl-˜≠u)+lt⊏𝕩 # Constants
- bk←(𝕩=3+⊑bB)/⍋g # Block loads
+ bk←/𝕩=2+⊑bB # Block loads
lb←/𝕩=5+⊑bB # List starts
ll←(¬lo/1«ps)+(⊢-»)1↓(lo∾1)/+`ls∾0 # List Length
dr←/xs>ls⋄rt←/fo # Drop (block separator) and return
diff --git a/src/bootstrap/verify.bqn b/src/bootstrap/verify.bqn
index c833c2f2..bacec4fc 100644
--- a/src/bootstrap/verify.bqn
+++ b/src/bootstrap/verify.bqn
@@ -8,9 +8,10 @@ t ← (∾∾⟜(@+10)¨)¨ (¯5⊸↓∾gl˙)⌾⊑⌾⊑ •FLines¨ f # Compi
# Check that compiler 𝕩 compiles 𝕩-1 same as full compiler
Ver ← {
- norm ← {𝕎𝕏}˜´ (2⌊𝕩) ↑ ⟨
+ norm ← {𝕎𝕏}˜´ 𝕩 ↑ ⟨
4⊸↑ # Strip source info, always
⋈⁼∘∾⍟=¨⌾(2⊑¨2⊸⊑) # Turn only-dyadic functions to ambivalent, only ≥2
+ (⊢-2×34⊸=)⌾⊑ # VARU to VARO, could hit non-opcode numbers, oh well
! ≡○Norm´ (0‿𝕩⊏c) {𝕎𝕩}¨ (𝕩-1)⊏t
•Out ∾⟨"Boot -",'0'+𝕩," verified!"⟩