Branch: Tag:

2023-09-07

2023-09-07 13:59:45 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Remove some unused local variables.

2023-03-27

2023-03-27 13:30:30 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Adjust naming of local variable nodes.

2023-03-03

2023-03-03 12:36:24 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Add format attribute to yywarning() and my_yyerror().

2023-03-01

2023-03-01 14:59:53 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Changed API for index_node().

index_node() now uses the name of the indexed node to describe
the node and to detect indexing of predef::.

Also adds a few calls of set_node_name().

2023-02-26

2023-02-26 14:41:49 by Marcus Comstedt <marcus@mc.pp.se>

{safe_,}pike_fprintf: Add format attribute

2023-02-26 14:31:28 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [ADT]: Fix typo.

2023-02-26 13:54:46 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [AST]: Fix NULL-deref.

2023-02-26 12:55:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [AST]: Set the name of nodes in some common cases.

Preparation for changing the index_node() API.

2023-02-25

2023-02-25 12:57:50 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [AST]: Add set_node_name().

This function sets the (previously unused) name field for a
node, and is intended to be a description of the parsetree
rooted in the node useable for compiler diagnostics.

Eg: The name for an F_CONSTANT node could be set to
the symbol used to lookup the constant.

This is in preparation for some further grammar adjustments.

2022-12-20

2022-12-20 11:09:26 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Update handling of scoped variables for generator functions.

For generator functions all local variables need to be scoped.

Also: mklocalnode(V, -1) now causes the variable to be marked as scoped.

Fixes testsuite failures for the generator function tests.

2022-12-19

2022-12-19 18:16:59 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Clean up handling of shared local variables.

The compiler_frame now keeps track of the shared local variables
explicitly. This makes the code much simpler; emit_save_locals()
is now almost trivial.

2022-12-16

2022-12-16 18:26:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Clean up copy_node().

Now that the node hash is no more, there's no reason to perform
actual copying of F_LOCAL and F_TRAMPOLINE nodes. Note also that
the copying of F_LOCAL_INDIRECT nodes was a bad idea, since then
the copy would not get bound to the same F_LOCAL as the original.

Fixes "Indexing the NULL value" when eg using the dynamic dot
operator on an unbound local variable.

Fixes multiple testsuite failures.

2022-12-16 15:55:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Fix support for F_LOCAL_INDIRECT nodes in F_CLEAR_LOCAL.

Fixes lots of erroneous compilation errors like eg "Argument 1 to
foreach() does not match loop variable type.".

Needed for #10098.

2022-12-16 12:56:48 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Allocate local variables in two stages.

Enables use of F_LOCAL_INDIRECT nodes.

Needed for #10098.

2022-12-07

2022-12-07 11:11:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Add parse-tree node F_VOLATILE_RETURN.

This avoids the need (for now) to track the types for the active
local variables during docode().

Fixes testsuite failure.

2022-12-05

2022-12-05 11:34:33 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Remove redundat fields from struct local_name.

Removes the fields `type`, `file` and `line` as the information
that was held in them is all available via the `def` node.

2022-12-03

2022-12-03 08:41:09 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Restore clearing of local variables when they go out of scope.

Fixes issue caused by #10098.

Fixes testsuite failure.

2022-12-02

2022-12-02 11:51:38 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Local variables now also have a def node.

{,low_}add_local_name() now sets an F_LOCAL node as the def
for local variables. This simplifies finding all the local
variable nodes when we move allocation of the stack frame
to docode().

Needed for #10098.

2022-12-02 11:51:36 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Optimizer]: Do not optimize away RETURN_IF_TRUE statements...

2022-12-01

2022-12-01 09:54:21 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Fix reference counting bug in copy_node().

The number of references for the new node was copied from
the originating node, resulting in leaks if the originating
node had more than one reference.

2022-12-01 09:46:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Move marking of local lexical scopes to mklocalnode().

2022-11-28

2022-11-28 14:39:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Rename struct local_variable to struct local_name.

Also rename the corresponding field in struct compiler_frame
from variable to local_names.

This is to make it clearer that the struct is also used for
stuff (like eg local functions) other than local variables.

2022-11-26

2022-11-26 09:35:22 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Remove some dead code.

F_SET_LOCAL_TYPE and F_SET_LOCAL_FLAGS nodes are no more.

2022-11-21

2022-11-21 10:53:16 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Resolve local bindings in mklocalnode().

mklocalnode() now returns the definition node directly (if any),
rather than returning a F_LOCAL which got converted later by
lexical_islocal() et al.

NB: F_CLEAR_LOCAL is only valid for F_LOCAL-nodes.

Preparation for implementing deferred binding of local variables
as required by #10098.

2022-11-20

2022-11-20 12:43:50 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Work in progress: Sakura master

2022-11-16

2022-11-16 09:38:30 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Disabled strict types warning for operator assignment.

Disabled due to there not being any syntax to cast
the originating value type. Consider:

int(2bit) i = 1;
i--; // Warning that int(-1..2) can't be assigned to i.

See also #10033.

2022-11-15

2022-11-15 11:26:28 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Check that ++ and -- operations are valid.

To simplify implementation, F_INC, F_DEC, F_POST_INC and
F_POST_DEC nodes now have an int node with a 1 in CDR.

Update treeopt.in rules accordingly.

Fixes #10033.

2022-11-10

2022-11-10 13:24:45 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Use F_CLEAR_LOCAL to mark local variables for clearing.

This removes the need for mklocalnode(var, -1).

Preparation for having late binding of local variables
to stack frame offsets.

2022-11-05

2022-11-05 15:53:54 by Tobias S. Josefowitz <tobij@tobij.de>

Compiler: Retain flags for local vars used in scope

We require the LOCAL_VAR_USED_IN_SCOPE flag during optimization.
Previously, during optimization, we checked uninitialized memory when
decoding dumped modules to decide if certain optimizations apply. Now we
initialize the local variable information to zero and dump the flags to
local variables when required, so that they can be re-applied when
decoding.

2022-08-16

2022-08-16 09:51:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix optimizer breaking type check.

The optimizer converted code like:

object(Foo) foo = base_obj;
foo++;

into

object(Foo) foo = base_obj + 1;

This caused the type checker to (erroneously) complain about
assigning 1 to foo if base_obj was typed as an object that
did not have an lfun::`+().

Now it is instead converted into:

object(Foo) foo = ([object(Foo)] base_obj) + 1;

Also removes the warning about no-op soft casts.

2022-07-12

2022-07-12 16:40:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Use fun_name from call_state.

2022-07-12 15:07:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Add function name field to call_state.

2022-07-09

2022-07-09 09:49:04 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Update some more calls of new_get_return_type().

2022-07-05

2022-07-05 12:56:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix leak of the type zero.

2022-07-02

2022-07-02 08:57:52 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Optimizer]: Set OPT_ASSIGNMENT on F_CLEAR_LOCAL nodes.

Fixes the optimizer removing clearing of locals at end of block.

Fixes testsuite failure.

2022-06-19

2022-06-19 08:38:03 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Update missed call of check_splice_call().

2022-06-14

2022-06-14 13:21:30 by Henrik Grubbström (Grubba) <grubba@grubba.org>

EFUNs: Added Pike 8.0 compat variant of sscanf and array_sscanf().

2022-06-10

2022-06-10 18:29:54 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Add struct call_state.

This struct is intended to contain state that is to be propagated
between arguments during typechecking of function calls.

2022-05-30

2022-05-30 11:14:39 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix multi-reporting of bad assignments mk II.

2022-05-30 09:29:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Complain about bad assignments only in the last pass.

Fixes double reporting of "Bad type in assignment.".

2022-05-10

2022-05-10 08:28:30 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Use the correct flags in check_node_type().

2022-05-07

2022-05-07 15:03:19 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Improved #pragma compiler_trace.

2022-04-12

2022-04-12 12:27:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Never complain about return 0.

Do not complain about return 0 that the compiler may have
added implicitly.

2022-03-18

2022-03-18 13:05:26 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix type for deep automap expressions.

Fixes the type for expressions like

({ ({ 1, 2 }), ({ 3,4 }) })[*][*] + 10;

Also updated las.cmod::is_automap_arg_list() to return the automap depth.

Fixes some testsuite failures.

2022-03-14

2022-03-14 13:51:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix NULL-deref.

2022-03-13

2022-03-13 11:55:29 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Changed type for F_PUSH_ARRAY nodes.

This is in preparation of having check_splice_call() account
for any array length restrictions.

2022-01-28

2022-01-28 14:05:50 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved checking of assignments.

2022-01-18

2022-01-18 09:52:04 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Document some special cases.

2022-01-17

2022-01-17 14:19:04 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Support F_CLEAR_LOCAL in the parse tree.

This node is equivalent to F_ASSIGN with 0, but only valid for F_LOCAL
variables, and only when the variable will NOT be used afterwards.

The intent is to simplify avoiding of errors from the type system for
the case where the variable has a type that does not include zero.

2022-01-16

2022-01-16 13:29:16 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved checking of splice operator some more.

2022-01-15

2022-01-15 11:34:49 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved type check for the splice operator.

2021-11-30

2021-11-30 09:26:29 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved type checking of foreach().

Also swaps the expected and got types in some related diagnostics
to be more intuitive.

2021-11-22

2021-11-22 14:43:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved checking of foreach.

2021-11-16

2021-11-16 12:34:46 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved zero handling in check_node_type().

Fixes several issues where nullable types match only for zero.

2021-10-15

2021-10-15 10:24:32 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Make print_tree() available also --without-debug.

2021-10-13

2021-10-13 18:12:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Some cosmetic fixes.

2021-10-04

2021-10-04 12:44:41 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Move cumulative_parse_error to struct compilation.

Fixes spurious erroneous warnings --with-debug about leaked
nodes. This appears to have been due to the destruct order
and the use of a global variable getting out of phase.

2021-09-30

2021-09-30 11:04:49 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Register nodes --with-dmalloc.

2021-06-02

2021-06-02 09:21:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Reduce strict type warnings somewhat.

2021-04-02

2021-04-02 12:44:46 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fixed NULL-deref on specific syntax error.

Fixes [LysLysKOM 24260957].

2021-03-23

2021-03-23 16:39:36 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved typechecking of assignments.

The checker is now informed that void values are converted into
UNDEFINED/zero on assignment.

Fixes several warnings.

2021-03-22

2021-03-22 14:12:22 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Added flags to pike_types_le().

2021-03-01

2021-03-01 14:42:34 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Second go at fixing some warnings.

las.cmod:fix_type_field() is called by optimize() from the leaves
going up. This means that the expression in eg `?` has typically
already been typechecked when it is received by fix_type_field().
Move the special case to mknode().

CAVEAT EMPTOR:
Calling fix_type_field() from mknode() in early compiler passes
may cause strange and unexpected failures. The special case type
adjustment is therefore only performed in the last compiler pass.

Fixes warnings from eg Getopt.

2021-02-28

2021-02-28 13:49:56 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Reduce number of warnings.

Do not warn about the type not containing zero in the special case

if (string foo = expr) { xxx }

as foo will never be zero even though expr may very well be zero.

2021-02-27

2021-02-27 16:32:23 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Added F_INITIALIZER node type.

This node type behaves identically to F_ASSIGN, but is only used
in the case where it is the initializer assignment in a local
variable declaration.

2021-02-26

2021-02-26 16:58:43 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Swap CAR and CDR for F_DO nodes.

This change causes the conditional be in CAR, analogous to
'?' and F_FOR nodes, reducing the number of special cases
in some upcoming code.

2021-02-19

2021-02-19 14:49:51 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved result type for logical or.

Fixes some warnings.

2021-02-18

2021-02-18 15:54:13 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix some warning messages.

2021-02-15

2021-02-15 09:52:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Reduce strictness a bit more.

2021-02-08

2021-02-08 14:20:35 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix lots of warnings about assigning zero.

2021-02-07

2021-02-07 16:32:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Use weaker typecheck when casting result from eval_low().

Fixes issue with attempts to (soft) cast zero to eg string.

2021-02-07 13:15:40 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Use type_binop() in check_node_type().

2021-02-06

2021-02-06 12:43:10 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Fix checking of foreach().

2020-07-07

2020-07-07 16:54:55 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Survive --without-rtl-debug again.

low_get_f_name() is only present --with-debug...

2020-07-07 11:39:37 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Added type checking for operator-assignment.

Fixes most of bug #10033.

2020-07-06

2020-07-06 11:10:45 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Don't attempt to constant-fold automap markers.

Attempting to get a constant from an expression like

({ "abc", "cde" })[*]

is not possible and generates the compilation error
"[*] not supported here", so don't attempt to.

Fixes #10039.

2020-03-12

2020-03-12 13:08:14 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Reduce the number of soft cast warnings.

Fixes some of #10006.

2020-02-04

2020-02-04 11:33:05 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Added DWIM kludge.

2020-01-23

2020-01-23 15:32:18 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [Typechecker]: Improved type checking.

Fixed issue where constant expressions after evaluation sometimes
got a partially weaker type. Eg: The expression

({ 0, 1, 2, 3 })

gets the type array(int(4bit)) from evaluating the type, but
the type array(4: int) from generating a type from the value.
The code generator now adds a soft-cast to the original type,
causing the resulting type to be array(4: int(4bit)).

Fixes testsuite failures for undumped pikes from eg SSL.Context.

2020-01-17

2020-01-17 12:02:43 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Adjusted type checking for foreach.

2020-01-02

2020-01-02 13:38:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Added push_unlimited_array_type().

This is in preparation for adding support for
length-limited array types.

2019-11-23

2019-11-23 13:39:08 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: print_tree() now knows about continue return and yield.

2019-11-14

2019-11-14 12:15:53 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: count_memory_in_node_ss() now survives Pike_compiler_base.

Pike_compiler_base has no active compiler.

Also adds some PIKE_DEBUG checks.

2019-11-14 09:46:57 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Move node_allocator to struct compilation.

Allocated nodes may need to live during an entire translation unit.

This moves the allocator from struct Pike_compiler (ie compilation.h)
to struct compilation (aka CompilationEnvironment.PikeCompiler).

Fixes use of already freed nodes after certain syntax errors.

2019-10-26

2019-10-26 21:14:40 by Marcus Comstedt <marcus@mc.pp.se>

Compiler [generators]: Fix compiler crash

F_GENERATOR does not use CDR, so don't try to access it as a node.

2019-10-18

2019-10-18 12:31:25 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Merge branch 'patches/pike221'

* patches/pike221:
Compiler: object->program_id only exists --with-debug.

2019-10-18 09:11:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Merge branch 'patches/pike221'

* patches/pike221:
Compiler: Make get_name_of_function() survive destructed functions.
Compiler: Improved robustness of placeholder activation.

2019-09-12

2019-09-12 10:03:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler [generators]: Added yield().

2019-08-26

2019-08-26 12:51:20 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Fixed bug in mkgeneratornode().

2019-08-24

2019-08-24 15:58:29 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Added mkgeneratornode().