public inbox for ~johnnyrichard/olang-devel@lists.sr.ht
 help / color / mirror / code / Atom feed
From: Carlos Maniero <carlos@maniero.me>
To: ~johnnyrichard/olang-devel@lists.sr.ht
Cc: Carlos Maniero <carlos@maniero.me>
Subject: [PATCH olang v2 0/4] extend unsined integers types (u8, u16, u64)
Date: Sun, 22 Sep 2024 00:46:32 +0000 (UTC)	[thread overview]
Message-ID: <20240922004619.518310-1-carlos@maniero.me> (raw)

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


             reply	other threads:[~2024-09-22  0:46 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-22  0:46 Carlos Maniero [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240922004619.518310-1-carlos@maniero.me \
    --to=carlos@maniero.me \
    --cc=~johnnyrichard/olang-devel@lists.sr.ht \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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