[BLACKBOX] 回复: [BLACKBOX] Trap while compiling SYSTE M.GET

From: [at]} <luowy{>
Date: Thu, 10 May 2012 17:11:15 +0800

nu.&I8m:
z{mʗ{V
z{S}ĝxjǺOleg N. Cher:

>>has found a trap


the compiler trap is triggered by the illegal use ADR funtion:

...SYSTEM.ADR(Rsrc1);...

>>Is there a good way to work with address of code procedure?
 
we know the code procedure is inline bytes only ,no ADR at all,
so we should prevent it:

  DevCPB.MOp
  
  FROM
   ....
   | adr:
     IF z.class = Nproc THEN
   ....
    
   TO:
   ...
   | adr:
     IF (z.class = Nproc)&( z.obj.mode#CProc) THEN

   ....
 



luowy
 
----- ?? -----
???: Oleg N. Cher
? ?: [BLACKBOX] Trap while compiling SYSTEM.GET
? ?: 2012?5?10? 2:27:02

Dear Marc,

thank you for quick and circumstantial answer.

I'm experimenting with removing the restrictions on code procedure size
and has found a trap, which falls out when compiling of such code. I
think, this will you interesting, but can even useful.



MODULE DevTestCodeSizeProc;
IMPORT SYSTEM, StdLog;

CONST
        Rsrc1_size = 1;

PROCEDURE [code] Rsrc1 0C3H;

PROCEDURE Do* ;
VAR i, x: INTEGER;
BEGIN
        FOR i := 0 TO Rsrc1_size - 1 DO SYSTEM.GET(SYSTEM.ADR(Rsrc1) + i, x);
StdLog.Int(x) END
END Do;

END DevTestCodeSizeProc.



Is there a good way to work with address of code procedure?


What is practical reason of using of code procedures with zero size?
For example, such procedure is used in modules

(System)Kernel - PROCEDURE [code] ALLOC

(System)Math - PROCEDURE [code] FLD (x: REAL);
        PROCEDURE [code] TOP (): REAL;

etc.


Thanks.



Marc Frei wrote:

&gt; Dear Oleg,
&gt;
&gt; Here the response to your question from last week from my colleaugue Beat Heeb who is maintaining the BlackBox compiler:
&gt;
&gt; It is a restriction of the compiler.
&gt;
&gt; The code of a code procedure is stored in object.conval.ext. This is byte array of arbitrary size but the number of bytes used is stored in the first byte (ext^[0]) and thus restricted to 0..255.
&gt;
&gt; To change that you would have to change how this length is stored. Search for "CProc" in all compiler sources.
&gt;
&gt; Kind regards,
&gt; Marc

--
Oleg N. Cher
http://zx.oberon2.ru/
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})LISTS.OBERON.CH
nu.&I8m:
z{mʗbqb
z{m}ޝxjǺ
z{Ch+bv!~)^{\rtf1\ansi\ansicpg1252\fromtext \deff0{\fonttbl
{\f0\fswiss\fcharset0 Arial;}
{\f1\fmodern Courier New;}
{\f2\fnil\fcharset2 Symbol;}
{\f3\fmodern\fcharset0 Courier New;}
{\f4\fswiss\fcharset128 MS Mincho;}
{\f5\fswiss\fcharset134 SimSun;}}
{\colortbl\red0\green0\blue0;\red0\green0\blue255;}
\uc1\pard\plain\deftab360 \f0\fs20 Oleg N. Cher:\par
\par
>>has found a trap\par
\par
\par
the compiler trap is triggered by the illegal use ADR funtion:\par
\par
...SYSTEM.ADR(Rsrc1);...\par
\par
>>Is there a good way to work with address of code procedure?\par
 \par
we know the code procedure is inline bytes only ,no ADR at all,\par
so we should prevent it:\par
\par
  DevCPB.MOp\par
  \par
  FROM\par
   ....\par
   | adr: \par
     IF z.class = Nproc THEN\par
   ....\par
    \par
   TO:\par
   ...\par
   | adr:\par
     IF (z.class = Nproc)&( z.obj.mode#CProc) THEN\par
\par
   ....\par
 \par
\par
\par
\par
luowy\par
 \par
\htmlrtf{\f4\fs20\htmlrtf0 ----- \'8c\'b4\'95\'b6 ----- \htmlrtf\f0}\htmlrtf0 \par
\htmlrtf{\f5\fs20\htmlrtf0 \'b7\'a2\'bc\'fe\'c8\'cb: Oleg N. Cher \htmlrtf\f0}\htmlrtf0 \par
\htmlrtf{\f5\fs20\htmlrtf0 \'d6\'f7\'a1\'a1\'cc\'e2: [BLACKBOX] Trap while compiling SYSTEM.GET\htmlrtf\f0}\htmlrtf0 \par
\htmlrtf{\f5\fs20\htmlrtf0 \'ca\'b1\'a1\'a1\'bc\'e4: 2012\'c4\'ea5\'d4\'c210\'c8\'d5  2:27:02\htmlrtf\f0}\htmlrtf0 \par
\par
Dear Marc,\par
\par
thank you for quick and circumstantial answer.\par
\par
I'm experimenting with removing the restrictions on code procedure size \par
and has found a trap, which falls out when compiling of such code. I \par
think, this will you interesting, but can even useful.\par
\par
\par
\par
MODULE DevTestCodeSizeProc;\par
IMPORT SYSTEM, StdLog;\par
\par
CONST\par
\tab Rsrc1_size = 1;\par
\par
PROCEDURE [code] Rsrc1 0C3H;\par
\par
PROCEDURE Do* ;\par
VAR i, x: INTEGER;\par
BEGIN\par
\tab FOR i := 0 TO Rsrc1_size - 1 DO SYSTEM.GET(SYSTEM.ADR(Rsrc1) + i, x); \par
StdLog.Int(x) END\par
END Do;\par
\par
END DevTestCodeSizeProc.\par
\par
\par
\par
Is there a good way to work with address of code procedure?\par
\par
\par
What is practical reason of using of code procedures with zero size?\par
For example, such procedure is used in modules\par
\par
(System)Kernel - PROCEDURE [code] ALLOC\par
\par
(System)Math - \tab PROCEDURE [code] FLD (x: REAL);\par
\tab PROCEDURE [code] TOP (): REAL;\par
\par
etc.\par
\par
\par
Thanks.\par
\par
\par
\par
Marc Frei wrote:\par
\par
&gt; Dear Oleg,\par
&gt; \par
&gt; Here the response to your question from last week from my colleaugue Beat Heeb who is maintaining the BlackBox compiler:\par
&gt; \par
&gt; It is a restriction of the compiler.\par
&gt; \par
&gt; The code of a code procedure is stored in object.conval.ext. This is byte array of arbitrary size but the number of bytes used is stored in the first byte (ext^[0]) and thus restricted to 0..255.\par
&gt; \par
&gt; To change that you would have to change how this length is stored. Search for "CProc" in all compiler sources.\par
&gt; \par
&gt; Kind regards,\par
&gt; Marc\par
\par
--\par
Oleg N. Cher\par
http://zx.oberon2.ru/\par
\par
\par
----\par
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})LISTS.OBERON.CH}}nu.&I8m:
Received on Thu May 10 2012 - 11:11:15 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:30:03 UTC