Constant folding

27 views
Skip to first unread message

Adriano dos Santos Fernandes

unread,
May 26, 2026, 8:06:45 PM (8 days ago) May 26
to firebir...@googlegroups.com
Hi!

For `constant c1 integer = 1 + 2;`

Why is this BLR used, instead of optimize and compute the final value?

blr_version5,
blr_cast, blr_long, 0,
blr_add,
blr_literal, blr_long, 0, 1,0,0,0,
blr_literal, blr_long, 0, 2,0,0,0,
blr_eoc


Adriano

Artyom Abakumov

unread,
May 27, 2026, 4:14:58 AM (7 days ago) May 27
to firebird-devel
Initially, I was generating the final value. But then I discovered that without the original blr, it was impossible to track dependencies.

среда, 27 мая 2026 г. в 03:06:45 UTC+3, Adriano dos Santos Fernandes:

Dimitry Sibiryakov

unread,
May 27, 2026, 4:17:56 AM (7 days ago) May 27
to firebir...@googlegroups.com
Artyom Abakumov wrote 27.05.2026 10:14:
> But then I discovered that without the original blr, it was impossible to track
> dependencies.

Aren't they tracked by table RDB$DEPENDENCIES?

--
WBR, SD.

Artyom Abakumov

unread,
May 27, 2026, 4:24:17 AM (7 days ago) May 27
to firebird-devel
I am not sure it is enouth since the csb_get_dependencies flag is present duing the BLR Parsing stage

Dimitry Sibiryakov

unread,
May 27, 2026, 4:26:44 AM (7 days ago) May 27
to firebir...@googlegroups.com
Artyom Abakumov wrote 27.05.2026 10:24:
> I am not sure it is enouth since the csb_get_dependencies flag is present duing
> the BLR Parsing stage

IMHO it is an artifact from the times when BLR could be updated directly.

--
WBR, SD.

Alex Peshkoff

unread,
May 27, 2026, 6:41:20 AM (7 days ago) May 27
to firebir...@googlegroups.com
No, it's set when parser should collect dependencies during parse. See collectingDependencies() function.


Dimitry Sibiryakov

unread,
May 27, 2026, 6:53:53 AM (7 days ago) May 27
to firebir...@googlegroups.com
'Alex Peshkoff' via firebird-devel wrote 27.05.2026 12:41:
>>   IMHO it is an artifact from the times when BLR could be updated directly.
>
> No, it's set when parser should collect dependencies during parse. See
> collectingDependencies() function.

Do you mean BLR parser or SQL parser?

AFAIU, first one is redundant for SQL and is kept to support
IRequest::compile() only, so the flag csb_get_dependencies should be reset
during BLR parse if the dependencies are already collected by SQL parser or
received from RDB$DEPENDENCIES table (for stored objects).

--
WBR, SD.

Alex Peshkoff

unread,
May 27, 2026, 7:25:00 AM (7 days ago) May 27
to firebir...@googlegroups.com
Not sure redundant or not - but it controls collecting information into RDB$DEPENDENCIES table.


Reply all
Reply to author
Forward
0 new messages