Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

work in progress #4

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open

work in progress #4

wants to merge 10 commits into from

Conversation

andrewcmyers
Copy link

Here is what I've changed to try to get this working on the Mac on a more recent gcc, though I get the same problems on Linux. Note that I added an autoconf script.

@npe9
Copy link
Owner

npe9 commented Aug 3, 2022

My intuition is that there's a set of incompatible #defines that are leading to it hitting unreachable code. I'll give it a whirl.

@npe9
Copy link
Owner

npe9 commented Aug 3, 2022

I might be short a file. config.status: code/include/acconfig.h is unchanged Configuring garbage collector... ./configure: line 4439: configure: command not found

@andrewcmyers
Copy link
Author

Try again?

@npe9
Copy link
Owner

npe9 commented Aug 5, 2022

@andrewcmyers I had a chance to look at the bug on my flight. In this case, "failure: not possible" is coming from a precompiled clu module used for bootstrapping the compiler (_workdir.c). There's something going wrong in there, but since the output is an intermediate representation and not human readable, I need to go through the original source code (_workdir.clu) to see what's going on. I haven't dug too deeply, but it looks like it's trying to parse /etc/passwd and I'd speculate that's a likely point of failure.

@npe9
Copy link
Owner

npe9 commented Aug 5, 2022

It may be silly actually. pclu looks like it requires a "CLU" user. What's not possible here is the CLU user not existing. Let me try and see what happens.

@npe9
Copy link
Owner

npe9 commented Aug 5, 2022

Update, you don't need a CLU user, just $CLUHOME set. That gets it farther:

* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
  * frame #0: 0x000000010017ac20 pclu`_pclu_erstr
    frame #1: 0x000000010010d0b1 pclu`p_envOPscanline(e=CLUREF @ 0x00007ff7bfefdf10) at penv.c:3380:24
    frame #2: 0x000000010010ab15 pclu`p_envOPnext_token(e=CLUREF @ 0x00007ff7bfefdfd0, ret_1=0x00007ff7bfefe018) at penv.c:1764:15
    frame #3: 0x000000010010a2c1 pclu`p_envOPreset(e=CLUREF @ 0x00007ff7bfefe0d0, comp=CLUREF @ 0x00007ff7bfefe0c8, inst=CLUREF @ 0x00007ff7bfefe0c0, errst=CLUREF @ 0x00007ff7bfefe0b8) at penv.c:1376:11
    frame #4: 0x000000010013b0e9 pclu`reset_stuff(e=CLUREF @ 0x00007ff7bfefe2e0, fn=CLUREF @ 0x00007ff7bfefe2d8) at top2.c:1219:11
    frame #5: 0x000000010013a0c0 pclu`compile1(e=CLUREF @ 0x00007ff7bfefe4c0, fn=CLUREF @ 0x00007ff7bfefe4b8, ret_1=0x00007ff7bfefe4e8) at top2.c:611:11
    frame #6: 0x0000000100139879 pclu`compile_IB_1(iv_1=CLUREF @ 0x00007ff7bfefe500, locals=0x00007ff7bfefe968, iecode=0x00007ff7bfefe848) at top2.c:250:23
    frame #7: 0x00000001001374ef pclu`all_input_names_IB_1(iv_1=CLUREF @ 0x00007ff7bfefe530, locals=0x00007ff7bfefe830, iecode=0x00007ff7bfefe848) at top1.c:4021:19
    frame #8: 0x0000000100137e75 pclu`all_derived_names(fs=CLUREF @ 0x00007ff7bfefe7f0, suffix=CLUREF @ 0x00007ff7bfefe7e8, tyo=CLUREF @ 0x00007ff7bfefe7e0, proc=(pclu`all_input_names_IB_1 at top1.c:4015), user_locals=0x00007ff7bfefe830, iecode=0x00007ff7bfefe848) at top1.c:4297:22
    frame #9: 0x00000001001372ca pclu`all_input_names(args=CLUREF @ 0x00007ff7bfefe8b0, suffix=CLUREF @ 0x00007ff7bfefe8a8, tyo=CLUREF @ 0x00007ff7bfefe8a0, proc=(pclu`compile_IB_1 at top2.c:243), user_locals=0x00007ff7bfefe968, iecode=0x00007ff7bfefe970) at top1.c:3960:30
    frame #10: 0x00000001001393d0 pclu`compile(mode=CLUREF @ 0x00007ff7bfefea00, args=CLUREF @ 0x00007ff7bfefe9f8, outst=CLUREF @ 0x00007ff7bfefe9f0, ret_1=0x00007ff7bfefea68) at top2.c:86:22
    frame #11: 0x000000010012fc74 pclu`process_commands(line=CLUREF @ 0x00007ff7bfefebf0, tyo=CLUREF @ 0x00007ff7bfefebe8, from=CLUREF @ 0x00007ff7bfefebe0, ret_1=0x00007ff7bfefec38) at top1.c:695:27
    frame #12: 0x00000001000f3092 pclu`initialize_specs at init.c:353:11
    frame #13: 0x00000001000f2c9a pclu`initialize_compiler(ret_1=0x00007ff7bfefef58) at init.c:211:11
    frame #14: 0x000000010012ee3b pclu`start_up at top1.c:98:19
    frame #15: 0x000000010017a984 pclu`main_2 + 388
    frame #16: 0x000000010039151e dyld`start + 462

I believe it's trying to reset the environment and failing to parse. I'll confirm the hypothesis in a little bit.

@andrewcmyers
Copy link
Author

I noticed the CLUHOME issue but was not clear on what to set it to

@npe9
Copy link
Owner

npe9 commented Aug 5, 2022

Brief update, the cause of the failed scanline is a failure to recognize the tag (EOF in this case) in stream$getc. It's getting to the tagcase statement in https://github.com/npe9/pclu/blob/master/sys/clu/stream.clu#L373 (which was precompiled to https://github.com/npe9/pclu/blob/master/code/sysclu/Opt/stream.c#L2305).

@npe9
Copy link
Owner

npe9 commented Aug 7, 2022

@andrewcmyers adding that back in fixed it:

gives us

Creating DU specs from /Users/npe/src/pclu/lib/clu/_int_range.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/bigint.clu
time = 0.001
Creating DU specs from /Users/npe/src/pclu/lib/clu/dparse.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/heap.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/lex_scan.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/os.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/parse_line.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/quicksort.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/quick_sort.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/scase.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/split_line.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/string_lindexs.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/string_ops.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/strim.clu
time = 0.000
Creating DU specs from /Users/npe/src/pclu/lib/clu/xref.clu
time = 0.001
Creating DU specs from /Users/npe/src/pclu/lib/random.spc
time = 0.000
Dumped to /Users/npe/src/pclu/misc.lib

Lots of researchware code to fix for sure, but we at least have the compiler pretending to work.

@npe9
Copy link
Owner

npe9 commented Aug 7, 2022

@andrewcmyers next question, what are you looking to use clu for? LARCH?

Edit: Also, I made a mistake and put the previous comment in the non-autotools pull request. The next step (if we need it) is to bootstrap the compiler from itself.

Edit2: I completely forgot I had corralled the larch distro during my initial interest in LARCH/CLU https://github.com/npe9/larch

@andrewcmyers
Copy link
Author

Actually I am writing a chapter about CLU for a book and I want to make sure my example code is correct!

@npe9
Copy link
Owner

npe9 commented Aug 10, 2022

@andrewcmyers I'd love to see it when you're done! Thanks for getting me back and interested in CLU. We do a lot of specification work and it's nice to go back in time a bit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants