public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
* [PATCH olang v2 0/4] extend unsined integers types (u8, u16, u64)
@ 2024-09-22  0:46 Carlos Maniero
  2024-09-22  0:46 ` [PATCH olang v2 1/4] parser: replace type enum to a string view Carlos Maniero
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Carlos Maniero @ 2024-09-22  0:46 UTC (permalink / raw)
  To: ~johnnyrichard/olang-devel; +Cc: Carlos Maniero

The olang was supporting only u32 yet there was an inconsistency because
we were always using 8 bytes to store information on stack when u32
actually requires only 4 bytes. We were also using rax for these
operations when 32bits operation should use eax.

This patch enables all unsigned types and use the proper
instruction/register.

--
v2:
- primitive type's size is now computed during the checker step.
- several typos on the commit message
- we no longer walk thought the AST twice during the checker
- rename the *bytes_to_rax* function
- merge the latest two commits once the first one was pretty unfinished
  and had to still use 8 bytes because we were using rax to operate it.

Carlos Maniero (4):
  parser: replace type enum to a string view
  checker: scope: populate symbol's type
  codegen: fix map symbol list type
  codegen: operate mov instructions based on the symbol's type

 src/ast.c                                     |  4 +-
 src/ast.h                                     | 14 ++--
 src/checker.c                                 |  3 +-
 src/codegen_linux_x86_64.c                    | 64 +++++++++++++++----
 src/parser.c                                  | 35 ++++------
 src/pretty_print_ast.c                        |  4 +-
 src/scope.c                                   |  3 +-
 src/scope.h                                   |  4 +-
 src/type.c                                    | 51 +++++++++++++++
 src/type.h                                    | 51 +++++++++++++++
 tests/integration/tests/0001_main_exit.ol     |  2 +-
 tests/integration/tests/0020_if_statement.ol  |  2 +-
 .../integration/tests/0023_else_statement.ol  |  2 +-
 .../integration/tests/0024_var_definition.ol  |  2 +-
 .../tests/0026_primitive_unsigneds.ol         | 27 ++++++++
 tests/unit/parser_test.c                      |  2 +-
 16 files changed, 217 insertions(+), 53 deletions(-)
 create mode 100644 src/type.c
 create mode 100644 src/type.h
 create mode 100644 tests/integration/tests/0026_primitive_unsigneds.ol


base-commit: 0d9ff9cbb463f044c7d482a4045d7668664e0d35
-- 
2.34.1


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-09-22 14:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-22  0:46 [PATCH olang v2 0/4] extend unsined integers types (u8, u16, u64) Carlos Maniero
2024-09-22  0:46 ` [PATCH olang v2 1/4] parser: replace type enum to a string view Carlos Maniero
2024-09-22  0:46 ` [PATCH olang v2 2/4] checker: scope: populate symbol's type Carlos Maniero
2024-09-22  0:46 ` [PATCH olang v2 3/4] codegen: fix map symbol list type Carlos Maniero
2024-09-22  0:46 ` [PATCH olang v2 4/4] codegen: operate mov instructions based on the symbol's type Carlos Maniero
2024-09-22  0:47   ` [olang/patches/.build.yml] build success builds.sr.ht
2024-09-22 14:15   ` [PATCH olang v2 4/4] codegen: operate mov instructions based on the symbol's type Johnny Richard
2024-09-22 14:19 ` [PATCH olang v2 0/4] extend unsined integers types (u8, u16, u64) Johnny Richard

Code repositories for project(s) associated with this public inbox

	https://git.johnnyrichard.com/olang.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox