From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id aF0zFu9o72bQAQEAe85BDQ:P1 (envelope-from ) for ; Sun, 22 Sep 2024 02:46:39 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id aF0zFu9o72bQAQEAe85BDQ (envelope-from ) for ; Sun, 22 Sep 2024 02:46:39 +0200 X-Envelope-To: patches@johnnyrichard.com Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=cqimZ7BI; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=fAdndkKO; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1"); dmarc=pass (policy=none) header.from=maniero.me ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=johnnyrichard.com; s=key1; t=1726965999; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:list-id: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=GjC3XqEuYb7Bx5v5DvLXzIeJ0m257X38yavRIb5NgDQ=; b=3z1Yvamy78/yREtIk8x1/W4/bbx1JvzhsL1H6xAWM1V8JvO9YzUn1ni1viOlQ+skM8/WHg RRw6+/kfiMTx01JIch341PIdRjeS1zA8Cuyd7Cvd+aIeppbKgx5xSBPrRdYbQES94uWB1U XktNiykwuguDsM98aMIMLxN1XgINAtzkOdMDxphsNor+Jj8aTe+lTPDoQlW38Lki8KOgoc PEV4bMh6+XDaya0QARwG7GSrP+NOAlLcD5x+UyCavFrpjZcEbzDpjMGjXdjyk/EduiFBe/ 40gD/ZS+AHR/C9MalayjK2KGev6xOTnmNUAb6DUKdeoER7J+bp/TMH92OOyO4w== ARC-Seal: i=2; s=key1; d=johnnyrichard.com; t=1726965999; a=rsa-sha256; cv=pass; b=L8/1DDCnHt6Y3NB1CmpYnEC0bPgOpFmbTyNnSP7hzdLq0VkPVQh5TZSfK8EhQM1koSQBH7 A6FzaHgCsdwpfas+vOYZst2MTPTIbCBNzqxQrx8vw8qU/XwnM4jFiLs3mtM8L41z7bxfow T7qcr1s08LPDQAQXuomieHuJfedgUliZ8ach7UyYneXSOM19AWYLmYuCtef7+zYjim7tGP f1/c5PlZigSdhs+bxjRQe3dV5HI4fFiHRRMyk+VxtBLQM+3MyMVlnqnM2uQHAyH6enXu5v ZUX5ZG9Au8UiET4uY4xXLVnmjP8rek6RV8sAhbxZSOd9XB8KuJrowkDTe88YSA== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=lists.sr.ht header.s=20240113 header.b=cqimZ7BI; dkim=pass header.d=maniero.me header.s=hostingermail1 header.b=fAdndkKO; spf=pass (aspmx1.migadu.com: domain of lists@sr.ht designates 46.23.81.152 as permitted sender) smtp.mailfrom=lists@sr.ht; arc=pass ("mailchannels.net:s=arc-2022:i=1"); dmarc=pass (policy=none) header.from=maniero.me Received: from mail-a.sr.ht (mail-a.sr.ht [46.23.81.152]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id ECC2260640 for ; Sun, 22 Sep 2024 02:46:38 +0200 (CEST) DKIM-Signature: a=rsa-sha256; bh=iS5BxmGxaNp0alabJvCmSraRJCxwgLL0ksghbi7AlAM=; c=simple/simple; d=lists.sr.ht; h=From:To:Cc:Subject:Date:List-Unsubscribe:List-Subscribe:List-Archive:List-Post:List-ID; q=dns/txt; s=20240113; t=1726965998; v=1; b=cqimZ7BIJ4cko4T711v8Jlf4RXKWBWtDRn9HFaPCXzBmeJLJtDMrD5c7kjqvm0JIlFvZtrZy MkmduI00qW5ezfvKwv3Tl/ICzV1Bg6SY3rOWUSyNMmADX0oROAYO4VkAhcxzPSmKZpKgFMyZiTM i1xckpLXWXWFdZF4h/qUS8afYq4GYVvlggacIXBKuRKIjL6Kit49wnE5mQP53zZqocbzcrzrd1r CFjAZjZtImh8k/MFhA/Po0V+wqrG6Bqp10uSpOvrXzLTyi666CJELNhLCym25uVJeTroNfqBwwj eUJoowUcwy6mZ3C0Sfmx1lbqth2OVyUDLeZUE/Q+FDVvA== Received: from lists.sr.ht (unknown [46.23.81.154]) by mail-a.sr.ht (Postfix) with ESMTPSA id 4EB9C202D9 for ; Sun, 22 Sep 2024 00:46:38 +0000 (UTC) Received: from olivedrab.birch.relay.mailchannels.net (olivedrab.birch.relay.mailchannels.net [23.83.209.135]) by mail-a.sr.ht (Postfix) with ESMTPS id BB9CC202CB for <~johnnyrichard/olang-devel@lists.sr.ht>; Sun, 22 Sep 2024 00:46:36 +0000 (UTC) X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id CC5FD842EF8 for <~johnnyrichard/olang-devel@lists.sr.ht>; Sun, 22 Sep 2024 00:46:34 +0000 (UTC) Received: from uk-fast-smtpout10.hostinger.io (trex-14.trex.outbound.svc.cluster.local [100.99.68.57]) (Authenticated sender: hostingeremail) by relay.mailchannels.net (Postfix) with ESMTPA id 2CACB841A53 for <~johnnyrichard/olang-devel@lists.sr.ht>; Sun, 22 Sep 2024 00:46:34 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1726965994; a=rsa-sha256; cv=none; b=iTi6lCrOOG/Hduc6QlQFb7dWZOTkjc8sq2gYswuu5BTnKTnOp57Tn0kiPeO19HY7hBoH3i xlXDDyxZbNSkXjkOUmXjZchRcKSGVVRBBy2EekbeUReFzjGc+5+jmMMbbxkmDpab5FQiQk yz1e48dcKKCmOh+99JrROw+hxvfM4DZhVLBfp0PTtjMgy9uPzJmQSOxAjPB1cPGeoqqJtQ 0wjkjBDx4R6HL64FvExWQ1PFZQr6DBum+1UjjaNkJtBSm16upwhLJb38JaAYpBdizqxTM3 ha0rS5rWc86Fv/BiEG4cbtN65u+MWtHPr7ubqQSDqteA0BWxKHJUTjKAs8HEZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1726965994; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:dkim-signature; bh=GjC3XqEuYb7Bx5v5DvLXzIeJ0m257X38yavRIb5NgDQ=; b=Tfc4tG4WDOhxa7+QxJnzkuUvP9xXTuKDsJWEWoi626+7lzu5OF8l5DY5Bg8t96O7ohM7pj zkydwiwbB9WuNWCg2eAQbrwCF2M4K+r2iVdWfRRMFKoJZLocZEQwZqdXnnnf5l4bM9b912 xklz1DiiJ6mZqddk5BcONGhiyLLdhBCE+G0eq632xNNRFGvxZ7CuBD7zMgh/x2I8A+pNQV SFGktf8Hf5JwKV6QgLFqfD0vv+hSpPXGQZY9SWZO9xbBQi1KfSVMVZu09aJcQC2vkO2URv UN5BySXGyhxBnXQwfiDlZvdh0gaYNbpCbYkPHWNgShiQ1igQJMOB/N9IxSUvIQ== ARC-Authentication-Results: i=1; rspamd-5b46bcd97f-9vgxm; auth=pass smtp.auth=hostingeremail smtp.mailfrom=carlos@maniero.me X-Sender-Id: hostingeremail|x-authuser|carlos@maniero.me X-MC-Relay: Neutral X-MailChannels-SenderId: hostingeremail|x-authuser|carlos@maniero.me X-MailChannels-Auth-Id: hostingeremail X-Befitting-Desert: 7069d7cf01a3c447_1726965994666_3845071317 X-MC-Loop-Signature: 1726965994666:2242472587 X-MC-Ingress-Time: 1726965994666 Received: from uk-fast-smtpout10.hostinger.io (uk-fast-smtpout10.hostinger.io [145.14.155.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.99.68.57 (trex/7.0.2); Sun, 22 Sep 2024 00:46:34 +0000 From: Carlos Maniero DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=maniero.me; s=hostingermail1; t=1726965992; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=GjC3XqEuYb7Bx5v5DvLXzIeJ0m257X38yavRIb5NgDQ=; b=fAdndkKOIrJDcGTezYUvko6Pk0/TlstEGzgm8fLf9QugP1XMEZR63EmmGGYj8p/9+XiPEm 0DV6cK0s/ToaiTOO+Gq6/bM8vi2mO5pBcJVPr/72zd7xVHF7CjiugpJrbKGhpwr3kHg3dc EHmg1AqcwHzKCntKVKOre68ZbFhUyLG/lssk96Yf5pc2XXPCBrO9mQTlroREYyWGW/IvFe k6m2S+Zro/JCZEo/uUFnJ2JnBQgcqPZ3qDTNkbTjIN4z7HDtqVzfWtf5d+OwfWiP3MsPVn ReKuwPHrsVLb5QHtdEVuXJ3dJP2qWLQggDIIJHcAh9tTl9fSSJjMhN4h24w8Cg== To: ~johnnyrichard/olang-devel@lists.sr.ht Cc: Carlos Maniero Subject: [PATCH olang v2 0/4] extend unsined integers types (u8, u16, u64) Message-Id: <20240922004619.518310-1-carlos@maniero.me> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Date: Sun, 22 Sep 2024 00:46:32 +0000 (UTC) X-CM-Analysis: v=2.4 cv=TcnEtgQh c=1 sm=1 tr=0 ts=66ef68e8 a=WwxFCuf3mf1fs3oSi6/dng==:117 a=WwxFCuf3mf1fs3oSi6/dng==:17 a=MKtGQD3n3ToA:10 a=1oJP67jkp3AA:10 a=g9OvcReobLhmzRocctsA:9 a=BXDaF_L80NY05PYiAFlV:22 X-CM-Envelope: MS4xfJfyI8e8ncJHcHTJMC1NdWYiAGQ2PaYC+EkjlxSgSSaEzjO4YAM8Up3xkeAVIuqr0k9xXWFAB8WM4hgJ2z2rigrtbwMFX4XP7faCIbvaX3ZWT8XM0Jk4 LlclGYWoClYA6JiT9tGfIDl7Oo/bDnQ8JzW7kCMkjdA0vlvriuoLdUGVTIe0sw8iYLZaxilVXtfPzzUHmE6LEB8Blcd8WsPDDxFueGORdp/NPXQ9sxal1Kju X-AuthUser: carlos@maniero.me List-Unsubscribe: List-Subscribe: List-Archive: Archived-At: List-Post: List-ID: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel.lists.sr.ht> Sender: ~johnnyrichard/olang-devel <~johnnyrichard/olang-devel@lists.sr.ht> X-Migadu-Flow: FLOW_IN X-Migadu-Country: NL X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -5.80 X-Migadu-Queue-Id: ECC2260640 X-Spam-Score: -5.80 X-TUID: Azqg0JE+XvcW 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