Skip to content

Commit

Permalink
Merge SVN 5189
Browse files Browse the repository at this point in the history
  • Loading branch information
ddeclerck committed Jan 29, 2025
1 parent cab82d4 commit df087dd
Show file tree
Hide file tree
Showing 12 changed files with 548 additions and 237 deletions.
12 changes: 9 additions & 3 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -116,11 +116,17 @@ Open Plans:
to stop compiliation at first error use -Wfatal-errors
** default value for -fmax-errors was changed from 128 to 20

* More notable changes

** execution times were significantly reduced for the following:
INSPECT CONVERTING (and "simple" INSPECT REPLACING), in general
and especially if both from and to are constants

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

GnuCOBOL 3.2 (20230728)
GnuCOBOL 3.2rc1 (20230118)
GnuCOBOL 3.2rc2 (20230210)
GnuCOBOL 3.2 (20230728)
GnuCOBOL 3.2rc1 (20230118)
GnuCOBOL 3.2rc2 (20230210)

* New GnuCOBOL features

Expand Down
21 changes: 21 additions & 0 deletions cobc/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@
* typeck.c (cb_emit, cb_emit_list): changed from defines to inline
functions, now returning the tree that was emitted

2023-09-12 Simon Sobisch <[email protected]>

* codegen.c (literal_list): removed self-reference as tree
* replace.c (ppecho_replace): now inline
* replace.c (cb_free_replace): removed setting child to zero before free
* replace.c: style adjustment

2023-09-07 Simon Sobisch <[email protected]>

* typeck.c (cb_build_converting): protoype (disabled) to pre-generate
conversion table and call new function cob_inspect_translating instead
of cob_inspect_converting if both operands are literals/alphabets

2023-09-06 Simon Sobisch <[email protected]>

* typeck.c (validate_inspect): check for identical operands,
check for invalid combination of operands
* typeck.c (cb_build_converting): shortcut when identical operands
are used
* tree.h: change alphabet_target and alphabet_type from defines to enums

2023-09-01 Simon Sobisch <[email protected]>

* pplex.l (ppopen_get_file): test for binary file and directly error out
Expand Down
29 changes: 14 additions & 15 deletions cobc/codegen.c
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ struct attr_list {
struct literal_list {
struct literal_list *next;
struct cb_literal *literal;
cb_tree x;
int id;
int make_decimal;
};
Expand Down Expand Up @@ -720,7 +719,12 @@ output_string (const unsigned char *s, const int size, const cob_u32_t llit)
} else
#endif
if (!isprint (c)) {
#if 1 /* octal */
output ("\\%03o", c);
#else /* hex (can be useful for a small amount of non-printable characters,
but gets really uggly if the string has a lot of those */
output ("\" \"\\x%X\" \"", c);
#endif
} else if (c == '\"') {
output ("\\%c", c);
} else if ((c == '\\' || c == '?') && !llit) {
Expand Down Expand Up @@ -825,18 +829,17 @@ chk_field_variable_address (struct cb_field *fld)
if (!cb_odoslide)
return 0;
if (!fld->flag_vaddr_done) {
/* Note: this is called _very_ often and takes 15-20% of parse + codegen time,
/* Note: this was called _very_ often and took 15-20% of parse + codegen time,
with about half the time in chk_field_variable_size; so try to not call
this function if not necessary (according to the testsuite: as long as
cb_odoslide is not set, but the caller's coverage is not that well...) */
struct cb_field *f = fld;
struct cb_field *p;
for (p = f->parent; p; f = f->parent, p = f->parent) {
for (p = p->children; p != f; p = p->sister) {
/* Skip PIC L fields as their representation
have constant length */
if (p->depending ||
(!p->flag_picture_l && chk_field_variable_size (p))) {
if (p->depending /* ODO leads to variable size */
|| (!p->flag_picture_l && chk_field_variable_size (p)) /* skipping PIC L fields */
) {
fld->flag_vaddr_done = 1;
fld->vaddr = 1;
return 1;
Expand Down Expand Up @@ -3177,7 +3180,7 @@ output_literals_figuratives_and_constants (void)
for (lit = literal_cache; lit; lit = lit->next) {
output ("static const cob_field %s%d\t= ",
CB_PREFIX_CONST, lit->id);
output_field (lit->x);
output_field (CB_TREE(lit->literal));
output (";");
output_newline ();
}
Expand Down Expand Up @@ -3379,7 +3382,6 @@ cb_lookup_literal (cb_tree x, int make_decimal)
l->id = cb_literal_id;
l->literal = literal;
l->make_decimal = make_decimal;
l->x = x;
l->next = literal_cache;
literal_cache = l;

Expand Down Expand Up @@ -13568,7 +13570,7 @@ output_internal_function (struct cb_program *prog, cb_tree parameter_list)
/* Check matching version */
#if !defined (HAVE_ATTRIBUTE_CONSTRUCTOR)
#ifdef _WIN32
if (prog->flag_main) /* otherwise we generate that in DllMain*/
if (prog->flag_main) /* otherwise we generate that in DllMain */
#else
if (!prog->nested_level)
#endif
Expand Down Expand Up @@ -13667,8 +13669,7 @@ output_internal_function (struct cb_program *prog, cb_tree parameter_list)

seen = 0;
for (m = literal_cache; m; m = m->next) {
if (CB_TREE_CLASS (m->x) == CB_CLASS_NUMERIC
&& m->make_decimal) {
if (m->make_decimal) {
if (!seen) {
seen = 1;
output_line ("/* Set Decimal Constant values */");
Expand Down Expand Up @@ -13887,8 +13888,7 @@ output_internal_function (struct cb_program *prog, cb_tree parameter_list)
output_line ("P_clear_decimal:");
seen = 0;
for (m = literal_cache; m; m = m->next) {
if (CB_TREE_CLASS (m->x) == CB_CLASS_NUMERIC
&& m->make_decimal) {
if (m->make_decimal) {
if (!seen) {
seen = 1;
output_line ("/* Clear Decimal Constant values */");
Expand Down Expand Up @@ -14972,8 +14972,7 @@ codegen_finalize (void)
struct literal_list* m;
int comment_gen = 0;
for (m = literal_cache; m; m = m->next) {
if (CB_TREE_CLASS (m->x) == CB_CLASS_NUMERIC
&& m->make_decimal) {
if (m->make_decimal) {
if (!comment_gen) {
comment_gen = 1;
output_storage ("\n/* Decimal constants */\n");
Expand Down
Loading

0 comments on commit df087dd

Please sign in to comment.