Re: [BLACKBOX] Limitation for code procedure size in BlackBox

From: Oleg N. Cher <"Oleg>
Date: Thu, 10 May 2012 22:09:40 +0300

----boundary-LibPST-iamunique-78408876_-_-
Content-type: text/plain

Dear Marc,

King regards to Beat Heeb for his great work! Please show him this post.

I propose, of course, to include a trap fix by luowy.
This much apropos to enlarge reliability of the compiler.

And to close the subject about code procedure size restriction.

This can be an useful improvement for next versions of BlackBox.

I propose to remove code procedure size restriction in simple way. I
thought several days on this problem and came to conclusion that no
reason to save code procedure size apart in 0'th element of array.

Was:

Array dimension = code procedure length N (1 byte) + all of the
procedure bytes {1..N}

    0 1 2 3 N
[sizeN] [byte1] [byte2] [byte3] ... [byteN]

Now:

object.conval.ext is a pointer. And if code procedure size = 0 it may be
NIL. And if the size > 0, object.conval.ext points to array of the size
length.

Array dimension = all of the procedure bytes {1..N}

    0 1 2 N
[byte1] [byte2] [byte3] ... [byteN]

Length is saved as metadata in array length, and it may be counted by
LEN(object.conval.ext^). If length = 0 then object.conval.ext = NIL

That proposition is shown in this commit.

https://github.com/Oleg-N-Cher/BB-XDev/commit/07e83a920cf5bdd26726df5788a3176c6089fd8a

And with this proposition maximal size of code procedures is practically
unlimited (was 254 bytes, now is MAX(INTEGER)-1 bytes). It is enough.

Am I sure 100% in correctness of this code? Of course, not. For
instance, I'm not sure that it is absolutely necessary to assign ext to NIL:

                IF n # 0 THEN NEW(ext, n); i := 0;
                        WHILE i < n DO ext[i] := s[i]; INC(i) END
                ELSE ext := NIL
                ^^^^^^^^^^^^^^^
                END;
                proc.conval.ext := ext;

So you can test it and propose other best code, or show me my potential
inexactnesses. This was miraculously. :)


Marc Frei wrote:
> Dear Oleg,
>
> Here the response to your question from last week from my colleaugue Beat Heeb who is maintaining the BlackBox compiler:
>
>> Limitation for code procedure size in BlackBox
>>
>> As you know, we can use this code procedures as:
>>
>> IMPORT SYSTEM;
>> PROCEDURE [code] Name*
>> 01H, 02H, 03H, 04H, 05H, 06H, 07H, 0FFH,

>> (* ... *)
>> 08H, 09H, 0AH, 0BH, 0CH, 0DH, 0EH, 0FFH;
>>
>> In experimental way I has found a limitation.
>> Maximal size of such procedures are 254 bytes.
>>
>> I would like to remove this limitation in my BlackBox
>> building (XDev). What can you say about the reason
>> of this limitation?
>
> It is a restriction of the compiler.
>
> 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.
>
> To change that you would have to change how this length is stored. Search for "CProc" in all compiler sources.
>
> Kind regards,
> Marc


--
Oleg N. Cher
http://zx.oberon2.ru/
----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-78408876_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIERlYXIgTWFyYyxccGFyDQpccGFyDQpLaW5nIHJl
Z2FyZHMgdG8gQmVhdCBIZWViIGZvciBoaXMgZ3JlYXQgd29yayEgUGxlYXNlIHNob3cgaGltIHRo
aXMgcG9zdC5ccGFyDQpccGFyDQpJIHByb3Bvc2UsIG9mIGNvdXJzZSwgdG8gaW5jbHVkZSBhIHRy
YXAgZml4IGJ5IGx1b3d5LlxwYXINClRoaXMgbXVjaCBhcHJvcG9zIHRvIGVubGFyZ2UgcmVsaWFi
aWx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0tXHBhcg0K
T2xlZyBOLiBDaGVyXHBhcg0KaHR0cDovL3p4Lm9iZXJvbjIucnUvXHBhcg0KXHBhcg0KXHBhcg0K
LS0tLVxwYXINClRvIHVuc3Vic2NyaWJlLCBzZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkgIlNJR05P
RkYgQkxBQ0tCT1giIHRvIExJU1RTRVJWQExJU1RTLk9CRVJPTi5DSFxwYXINCn0=
----boundary-LibPST-iamunique-78408876_-_---
Received on Thu May 10 2012 - 21:09:40 UTC

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