freenode/#sicl - IRC Chatlog
Search
4:17:23
beach
alandipert: I was with my (admittedly small) family last night when you asked your questions.
4:19:06
beach
I'll also read your paper, but it might be after you submit it though. It is usually possible to upload a modified version.
4:19:26
beach
And you definitely have the opportunity to include changes as a result of the referee reports.
4:21:39
alandipert
beach maybe it's such an obvious thing so as to not require a special term. but an example in my case would be the generic structure of the javascript i generate for TAGBODY, for example
4:22:14
alandipert
2 particular javascript variables with gensymed names, followed by a try/catch with a switch in it, etc. and most of this is static but particular elements are generated at the "site"
4:23:20
beach
I am not aware of a name for that. In Cleavir, that's just a method on a generic function.
4:26:12
beach
In other words, we have no explicit representation for the template. It is just encoded in the method that turns the code into an AST.
4:27:19
beach
A Cleavir AST is very close to the source code, but the compile-time environment is no longer needed, so macros have been expanded, etc.
4:29:33
alandipert
hm, i think i'm either confused or not describing what i'm thinking clearly enough
4:31:40
beach
Maybe you are talking about the JavaScript code which is mostly constant, but only a few things to fill in?
4:31:43
alandipert
a simpler example that comes to mind is the way, generally, "if" statements compile to jumps in assembly- there is a consisent, abstract shape to the generated code: conditional jump, followed by a branch, label, other branch
4:32:18
alandipert
err, usually an unconditional jump past the second branch in that case. so: test, branch, jump, label, branch
4:34:03
beach
Such a thing would be useful only in a very simple compiler, though. Normally, you would first translate the IF into a graph representation. Then you would have a large number of transformations and optimizations before you generate assembly code. By the time you do that, the connection between the original IF and any tests and conditional jumps would be gone.
4:35:51
alandipert
that's fair, but there's still ultimately a specific mapping between an IR node a human designed and the target code, yes? i suppose that's more specifically what i'm talking about
4:37:30
alandipert
i guess it really is a continuum and that last link in the chain isn't special, provided enough transformations
4:38:17
beach
Sure, but in a typical compiler that mapping would be fairly trivial. The IR node would be something like ADD with two successors, one for not-overflow and another for overflow. Whether one branch or the other is the target of a conditional branch would not be encoded in the IR.
4:40:11
beach
For example, in SICL, I have a pass to turn the final LIR (Low-level IR) into a sequence. Code generation then checks whether the next instruction in the sequence is a graph successor and if not, generates a jump.
4:42:24
beach
HIR is a graph that manipulates only Common Lisp objects, which is good for certain transformations.
4:42:55
beach
MIR exposes address calculations, and with that, addresses that are not Common Lisp objects. That level lends itself to another bag of transformations.
4:43:01
alandipert
i think my strange perspective is definitely becuase i'm basically going from AST to AST
4:44:41
alandipert
but there is some art in mapping constructs from CL to JS optimally, which i find myself enjoying
4:49:50
beach
Hmm, now that I think about it, MIR would be the place to stop in order to generate code in a low-level language like C, and HIR would be the place in order to generate code in a high-level language like JS. In fact, I already turn HIR into Common Lisp for the purpose of executing it in the host.
4:53:15
alandipert
like a year ago i read an old post from jonathan rees on CMU CL AI mailing list and he pointed out that most GOs can compile to local jumps, which stewed in my brain for awhile until it occurred to me that could work in JS thanks to some obscure goto-like JS features
4:56:50
alandipert
on that list there was some related discussion about compiling tagbody with catch and throw, which was highly relevant to me, since those have JS analogues
4:57:40
alandipert
the catch/throw way is the simplest and most general, but incurs the most runtime overhead. turned out this is how JSCL (previous JS lisp) does it always
4:58:10
alandipert
anyway cutting to the chase, i'm wondering if it's true to say that one can statically determine whether or not every GO is "local", for a given TAGBODY
4:58:45
alandipert
i say as much in my paper, but i haven't done it myself yet, and appreciate confirmation :-)
4:59:32
alandipert
i second guessed myself recently when i was messing with SBCL and it appeared to not explode when i captured GO tags in LAMBDAs from one TAGBODY and then invoked the lambda in the dynamic extent of another TAGBODY with a tag of the same name
4:59:36
beach
You would use some kind of context when you compile, and that context would reflect whether you are in the same dynamic environment in the TAGBODY and the GO.
5:01:14
alandipert
is it correct to think about tags like locals? ie they don't exist at runtime, effectively
5:01:57
alandipert
a lexical variable reference... that its name is immaterial, only its identity with respect to its environment is important
5:03:22
beach
So if the GO is in the same dynamic environment as the TAGBODY, which you can determine statically, then a jump is all you need.
5:04:29
alandipert
great. i have a plan for the local case that performs very well, but the ability to determine statically that a TAGBODY has no dynamic GOs allows me to emit less code
5:04:48
alandipert
i'm generally not interested in code size optimization except that which google closure compiler wouldn't know how to eliminate
5:35:35
beach
alandipert: But the thing is that a non-local GO can be turned into a local one after optimization...
5:36:38
beach
But escape analysis may reveal that the static environment inside the LET can not be captured, so you can inline the function call.
6:00:02
alandipert
i remember you saying something to the effect that you didn't understand why lisps other than CL needed to exist, forgive me if i misremember
6:02:14
beach
In fact, since there is no consensus of what "Lisp" means, I don't even know what languages could be in that category.
6:02:15
alandipert
but i no longer feel a need to use a lisp other than CL, is perhaps more accurate
6:03:29
beach
I no longer feel a need to use ANY language other than Common Lisp, so no matter what the definition of "Lisp" might be, I don't feel the need to use any Lisp other than Common Lisp.
6:20:57
alandipert
on the hunt for something to read, and also to cite/substantiate a section of my paper
6:29:01
beach
Actually, the more important information is in Code/Cleavir2/AST-to-HIR/compile-general-purpose-asts.lisp
6:33:18
beach
The TAGBODY is basically turned into a CATCH-INSTRUCTION. This instruction creates a block/tagbody entry on the dynamic environment and executes the statements of the tagbody in the augmented dynamic environment.
6:34:39
beach
When a GO is encountered, we check whether the transfer is local, in which case, we just generate a control arc to the target tag. If not, we generate an UNWIND-INSTRUCTION which will do the unwinding of the control stack.
6:35:16
beach
I think the important thing for you is to decide how the dynamic environment is to be represented.
6:44:17
alandipert
my tentative strategy for identifying local GOs is to walk up the AST from the GO to its TAGBODY, and if it makes it all the way without encountering a LAMBDA, call it a local GO
6:45:13
beach
I see. We do that by compiling in a "context" and the context is altered when a lambda is encountered, so that the body is compiled in a different context.
8:46:50
no-defun-allowed
(with-mild-nostalgia "My router has the same amount of primary memory as my aunt's desktop from 1999; and both had probably a few times more than the last Lisp machines, so yes.")
8:48:41
jackdaniel
the thing is, that in practice it is cheaper to bolt something built around arm chip into the coffee machine than to hand-craft something operated by avr
8:51:13
jackdaniel
developemnt time on limited-resource hardware is longer, you have no access to state of the art libraries, hence cost of creating a "product" is much bigger (I've worked in the outsourcing company as an embedded systems engineer a few years back)
9:33:11
no-defun-allowed
Now I wonder if my router can outpace that old desktop. It probably could get close, but I can't run code on the damned thing.
9:37:28
no-defun-allowed
(One of my older projects was to port a subset of metasploit to Common Lisp and throw in lots of generic functions, because it had way too much boilerplate. Just about every shell target wrote its own testing function that would generate a random string and tell the target to echo it, for example.) Of course, but the only public tool I found for my router had its tricks patched out.
9:37:34
ebrasca
What about distributed compiling in lisp OS? ( Like some big machine compiling for slow ones )
10:09:12
no-defun-allowed
Well, that desktop had 64MiB of primary memory. I think my router has 128MiB or so now.
10:09:51
beach
That should be plenty, at least for a simple version. Also, it depends on whether the compiler needs to be included. I would think not in a router.
10:11:01
no-defun-allowed
I can't find the memory size on my ISP's specification page for the router sadly.
10:11:40
beach
ebrasca: Anything that does not give the illusion of shared memory is going to be hard for any Common Lisp system. But then, there are systems that can create such an illusion I think.
10:13:52
beach
Anyway, my favorite coauthor is coming over for lunch today, so I must go cook for her... despite her going solo this year.
10:15:57
no-defun-allowed
I think it is quite sad that you can't find "real" manuals for machines like those routers, but I guess they aren't supposed to be meddled with.
10:17:36
no-defun-allowed
It is interesting to see a `function checkShellInjectionChar(str)` in the scripts for one of the pages in my router's server, though, but I'll have to prod around harder to see what the manufacturer tried to secure with that.
10:18:20
no-defun-allowed
Anyways....yes, probably a lot of memory. Though they don't have much in terms of non-volatile storage, but why would a router need that?
10:21:10
no-defun-allowed
With the fiber-to-the-house^Wkerb system, the ISP gave us a second box where some coaxial cable and an Ethernet cable plug in, so this has less responsibility than the last router, which also handled modem things.
10:23:57
no-defun-allowed
For non-volatile storage, you could connect some external storage over USB, but that probably would be inconvenient for using as an extension of the router's address space.
10:28:03
no-defun-allowed
The other problem is that the address space might be too small to effectively utilize a disk like that; the forementioned desktop had a (roughly) 2^33 byte hard drive.
10:31:30
no-defun-allowed
(And, well, a 32-bit machine can only access 2^32 bytes without hacks like Physical Address Extensions on x86.) Mapping disks into the address space of the processor is paramount to the operating system design beach writes about, so it would be a pity if almost all of it was unusable.
10:37:49
no-defun-allowed
I don't have a list of missing things on me, but I guess that the things that are closest to being "complete CL" would be the compiler, object system and sequence functions at least.
10:42:47
beach
There are some minor things missing like streams, time functions, etc. The compiler is very close to being operational, but many optimizations are still missing. CLOS is pretty much complete, yes. LOOP is complete. FORMAT is almost complete. The main thing is that bootstrapping has to work correctly, and all the pieces need to operate together.
12:24:51
froggey
I have a potentially interesting idea. it might be possible to run native-code SICL under mezzano, with a few extensions
12:25:08
froggey
it'd require support for secondary address spaces, along with support for threads running in these address spaces & some kind of communication channel, but I think all that is doable without a huge amount of effort
12:25:36
froggey
while this wouldn't be the same as running directly on the hardware, it should be a bit closer than running as a linux process
12:27:12
heisig
And it sounds easier than launching SICL by overwriting an SBCL image (which was discussed on SBCL20).
12:30:21
froggey
I might try putting together a prototype this weekend, not to run SICL but just some arbitrary code
13:46:57
beach
heisig: I had no idea that anything like this was discussed at SBCL20. Who at SBCL20 would be interested in doing anything like that?
13:59:31
heisig
beach: I think Vsevolod Dyomkin and flip214 were involved in the discussion, maybe also Douglas Katzman and Xach ... I cannot recall every detail.