[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    Re: [Pcc] Taking too long to compile Lua with optimization
From:       Tim Kelly <gtkelly () dialectronics ! com>
Date:       2022-11-21 19:59:13
Message-ID: 637BD891.4010108 () dialectronics ! com
[Download RAW message or body]

Also, it is the combination of -xtemps and -xssa that trips up pcc. 
Without the two together compilation proceeds.

Tim Kelly wrote:
> If I can describe the problem in more detail:
> 
> In src/lmv.c:luaV_execute()
> 
> 
> #define vmdispatch(o)    switch(o)
> #define vmcase(l)    case l:
> #define vmbreak        break
> ...
> #if LUA_USE_JUMPTABLE
> #include "ljumptab.h"
> #endif
> ...
> /* main loop of interpreter */
>   for (;;) {
>     Instruction i;  /* instruction being executed */
>     StkId ra;  /* instruction's A register */
>     vmfetch();
>     #if 0
>       /* low-level line tracing for debugging Lua */
>       printf("line: %d\n", luaG_getfuncline(cl->p, pcRel(pc, cl->p)));
>     #endif
>     lua_assert(base == ci->func + 1);
>     lua_assert(base <= L->top && L->top < L->stack_last);
>     /* invalidate top for instructions not expecting it */
>     lua_assert(isIT(i) || (cast_void(L->top = base), 1));
>     vmdispatch (GET_OPCODE(i)) {
>       vmcase(OP_MOVE) {
>         setobjs2s(L, ra, RB(i));
>         vmbreak;
>       }
>       vmcase(OP_LOADI) {
>         lua_Integer b = GETARG_sBx(i);
>         setivalue(s2v(ra), b);
>         vmbreak;
>       }
> ...
> (long list of opcodes)
> ...
> 
> 
> LUA_USE_JUMPTABLE=1 invokes src/ljumptab.h which contains
> 
> 
> #define vmdispatch(x)     goto *disptab[x];
> 
> #define vmcase(l)     L_##l:
> 
> #define vmbreak         vmfetch(); vmdispatch(GET_OPCODE(i));
> 
> 
> static const void *const disptab[NUM_OPCODES] = {
> 
> #if 0
> ** you can update the following list with this command:
> **
> **  sed -n '/^OP_/\!d; s/OP_/\&\&L_OP_/ ; s/,.*/,/ ; s/\/.*// ; p' 
> lopcodes.h
> **
> #endif
> 
> &&L_OP_MOVE,
> &&L_OP_LOADI,
> &&L_OP_LOADF,
> &&L_OP_LOADK,
> &&L_OP_LOADKX,
> &&L_OP_LOADFALSE,
> ...
> (long list of opcodes)
> ...
> &&L_OP_VARARG,
> &&L_OP_VARARGPREP,
> &&L_OP_EXTRAARG
> 
> };
> 
> 
> Hope this helps isolate what might be breaking.
> 
> tim
> 
> 
> 
> Anders Magnusson wrote:
>> Den 2022-11-21 kl. 19:32, skrev Tim Kelly:
>>> Great!  I was just about to start seeing if I could reproduce the 
>>> problem at my end, so this saves me a bit of work.  Thanks for the 
>>> tip on -DLUA_USE_JUMPTABLE=0, as I suspect it would bite me, too.
>>>
>>> Domingo Alvarez Duarte wrote:
>>>
>>>> Does "pcc" support "computed gotos" ?
>>>
>>> I'll leave that to Ragge to answer.  I do not know.
>> Good evening my gentlemen,
>>
>> you two have been quite hard-working in debugging - thanks!
>>
>> About computed goto - yes, pcc should support it (both in c and 
>> fortran).  (otherwise you should have gotten a compile error...)
>> But note that I added it many years ago, and it may be that it breaks 
>> the flow analysis in some way.  It is not heavily tested.
>> It might be an idea to revisit its implementation.
>>
>> -- Ragge
> 

-- 
Rand Paul regularly explains why his neighbor felt it necessary
to beat him up.
_______________________________________________
Pcc mailing list
Pcc@lists.ludd.ltu.se
https://lists.ludd.ltu.se/cgi-bin/mailman/listinfo/pcc
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic