Conversation
…copy is not available and macports provides it with a g prefix
Owner
|
Thanks a lot! I'll boot OSX and look into this. |
Owner
|
Hi again, I played around a bit more on OSX and fixed many little problems. The biggest issue was that the "as" shipped with OSX seems to ignore labels that are not starting with the letter "L" and generates empty jmps (jmps to 0) without warning – or at least treats them as external symbols to be linked later. So I adopted the "L…" labeling convention and it works. I also tweaked the stack align code a bit (thanks for that hint), which is probably inefficient. To make this bullet-proof on OSX, stack frame allocation will have to be redesigned. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Presently it doesn't work, because it can't eval shell.l. A function
is called with a NULL pointer for the first argument. Not sure yet
what the function is though.
Here's the present run:
[compiler] creating global env hash table…
[compiler] init_allocator…
++ cell heap at 0x10a000000, 240000000 bytes reserved
[allocator] initialized.
[compiler] inserting symbols…
[compiler] arithmetic…
[compiler] compare…
[compiler] flow…
[compiler] lists…
[compiler] strings…
[compiler] write/eval…
sledge knows 47 symbols. enter (symbols) to see them.
[fs] mounted: /framebuffer
[fs] mounted: /keyboard
[fs] mounted: /sd
sledge>
JIT ---------------------
movq $0x10a001f80, %rdi
mov $0x10000c730, %rax
subq $8, %rsp
callq *%rax # fs_open
addq $8, %rsp
movq %rax, %rdi
mov $0x10000ce90, %rax
subq $8, %rsp
callq *%rax # stream_read
addq $8, %rsp
movq %rax, %rdi
mov $0x100009d40, %rax
subq $8, %rsp
callq *%rax # read_string_cell
addq $8, %rsp
movq %rax, %rdi
mov $0x1000071d0, %rax
subq $8, %rsp
callq *%rax # platform_eval
addq $8, %rsp
ret
<assembled bytes: 100 at: 0x1091fb000>
warning: nm: no name list
[open] found matching fs: /sd for path: /sd/os/shell.l
[open] open_fn: 0x10000d8e0
filename: os/shell.l
[posixfs] trying to read file of len 13594…
JIT ---------------------
push %rdi
jmp f1_0x10a026910
f0_0x10a026910:
movq $0xf00000010a026911, %rsi
push %rsi
movq %r12, %rax
movq (%rax), %rax
cmp $0, %rax
je else_1
movq %r13, %rax
movq (%rax), %rax
cmp $0, %rax
je else_2
movq $0x10a0022b0, %rax
jmp endif_3
else_2:
movq $0x10a0022e0, %rax
endif_3:
jmp endif_4
else_1:
movq $0x10a002328, %rax
endif_4:
addq $8, %rsp
ret
f1_0x10a026910:
movq $0x10a026910, %rax
movq %rax, %rsi
pop %rdi
movq $0x10a0020e8, %rdi
mov $0x100001640, %rax
subq $8, %rsp
callq *%rax # insert_global_symbol
addq $8, %rsp
ret
<assembled bytes: 139 at: 0x1091fd000>
Process 90261 stopped
frame #0: 0x00000001091fd014
-> 0x1091fd014: movq (%rax), %rax
0x1091fd017: cmpq $0x0, %rax
0x1091fd01b: je 0x1091fd021
0x1091fd021: movq %r13, %rax