Replies: 3 comments 14 replies
-
Thanks for raising this discussion. The issue described here is listed in issue #29 |
Beta Was this translation helpful? Give feedback.
-
In the past, the original E compiler had an ABI breaking "feature" in the library mode. The library static/heap variables are required to be stored at the positive offsets of the library base and referenced from A6. Instead, EC recycled some application startup code and allocated a separate heap using A4 as the base pointer. I'm quite sure this was fixed in ECX but does E-VO have the fix? |
Beta Was this translation helpful? Give feedback.
-
All of the code generation is spread out through the whole code and sometimes instructions are built by constructing opcodes from scratch and in many other places instructions are just copied to the output from instructions assembled into the compiler code.
To be honest it's pretty amazing how wouter built the E compiler from scratch in 68000 but the code is definitely not elegant. It's clearly grown into a bit of a sprawling mess over time.
Still it gives me something to tinker with 😊
Darren
Sent from Yahoo Mail on Android
On Fri, 5 May 2023 at 13:00, Samuel ***@***.***> wrote:
My guess is that there isn't an EQUR (equate register) directive in the assembler so that reassigning the heap accesses to A6 instead of A4 gets tricky.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
While investigating the issue relating to constant lists I thought I had found some issues in consistency between E-VO and EEC.
In the end it turned out it was my lack of understanding. I did not know there was a difference between
a:=NEW [1,2,3,4,5]
and
a:=NEW [1,2,3,4,5]:LONG
Which upon examining the inner workings I have realised do not both do the same thing.
The first creates a list and the second creates an array. So in fact everywhere in my code where I was using something like
a:=NEW [1,2,3,4,5]
END a[5]
it was actually incorrect and leaking memory. I should have been adding the :LONG postfix or using FastDisposeList to destroy them.
I initially thought there was a discrepancy between how EEC/ECX and E/E-VO handled these. It turns out there isn't but there is an issue in EEC which means that
create:
c:=NEW [11,21,31,41,51,61,71]:INT
destroy:
END c[7]
fin:
generates this code in E-VO
create:
pea $E.w (allocate 14 bytes)
bsr FastNew
move.l d0,(a7)
movea.l d0,a6
moveq #$B,d0
move.w d0,(a6)
moveq #$15,d0
move.w d0,2(a6)
moveq #$1F,d0
move.w d0,4(a6)
moveq #$29,d0
move.w d0,6(a6)
moveq #$33,d0
move.w d0,8(a6)
moveq #$3D,d0
move.w d0,$A(a6)
moveq #$47,d0
move.w d0,$C(a6)
move.l (a7)+,d0
move.l d0,-8(a5)
destroy:
move.l -8(a5),d0
beq.s fin
move.l d0,-(a7)
moveq #7,d0 (number of elements)
lsl.l #1,d0 (*2 for size) = 14
move.l d0,-(a7)
bsr FastDispose
addq.l #8,a7
clr.l -8(a5)
fin:
but generates this in EEC
create:
move.l #$10,d3 (allocate 16 bytes)
move.l d3,-(a7)
bsr.l FastNew
addq.l #4,a7
movea.l d0,a1
move.l #$B,d0
move.w d0,0(a1)
move.l #$15,d1
move.w d1,2(a1)
move.l #$1F,d2
move.w d2,4(a1)
move.l #$29,d0
move.w d0,6(a1)
move.l #$33,d1
move.w d1,8(a1)
move.l #$3D,d2
move.w d2,$A(a1)
move.l #$47,d0
move.w d0,$C(a1)
move.l a1,-4(a5)
destroy:
movea.l -4(a5),a1
moveq #7,d1 (number of elements)
lsl.l #1,d1 (*2 = 14)
move.l d1,-(a7)
move.l a1,-(a7)
move.l a1,d3
move.l d3,-(a7)
move.l d1,-(a7)
bsr.l FastDispose
addq.l #8,a7
movea.l (a7)+,a1
move.l (a7)+,d1
moveq #0,d2
move.l d2,-4(a5)
fin:
i'll raise this as a defect but i thought i'd also post here as the starting point for any discussions around inconsistency between E-VO and EEC so we can agree how to proceed with any such issues - even though this turned out to actually be a defect not an inconsistency.
Beta Was this translation helpful? Give feedback.
All reactions