pawn-lang / compiler

Pawn compiler for SA-MP with bug fixes and new features - runs on Windows, Linux, macOS
Other
306 stars 72 forks source link

Backport string unification #404

Open Y-Less opened 5 years ago

Y-Less commented 5 years ago

Issue description:

The pawn 4 compiler now combines identical string literals. It would be nice (now we have const correctness) to backport that. Even better would be to match on suffixes, so we can combine strings that are only a part of other strings as well - simply start at an offset and always end on null.

Minimal complete verifiable example (MCVE):

printf("hi");
printf("hi");
printf("oh, hi");

Workspace Information:

Y-Less commented 5 years ago

For reference, we force this in fixes.inc by using global constants instead of inline literals - it compiles to the same assembly, but with less copies. Thus smaller assemblies, but at quite a complexity cost.

Y-Less commented 5 years ago

This will also probably break y_inline, but that's my problem since it is already an assembly level hack. I've already got an idea for a solution so this should never be a counter argument to implementation.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity.