Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import module collisions #235

Open
wants to merge 74 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 73 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
e1ec3aa
collision example
0xtimmy Oct 25, 2023
4e81af3
repeatable module import collisions
0xtimmy Oct 27, 2023
a2deafb
declaration renaming works
0xtimmy Nov 6, 2023
7ff377a
module rename can modify function callsites and function decalrations…
0xtimmy Nov 8, 2023
1b2cfaf
finished basic module import resolution
0xtimmy Nov 10, 2023
f05cbdd
parses modules in defs and main as well
0xtimmy Nov 11, 2023
2776226
added a pass to resolve imports in desugarModule
0xtimmy Nov 21, 2023
3d80c84
minor cleanup of README and gibbon-compiler/gibbon.cabal
ulysses4ever Nov 22, 2023
6145e02
aliases work
0xtimmy Nov 22, 2023
434712c
qualified imports
0xtimmy Nov 22, 2023
34e6618
spec imports
0xtimmy Nov 23, 2023
c8bb2d1
finished test cases
0xtimmy Nov 30, 2023
eca7cdd
Merge pull request #233 from ulysses4ever/ap-minor-cleanup
rrnewton Dec 6, 2023
97b9c39
fix? handling local identifier
0xtimmy Dec 7, 2023
2659da7
some testing
0xtimmy Dec 7, 2023
c3e9aca
fixed interp
0xtimmy Dec 10, 2023
22cc526
fixing a test (did not specify the sum function)
0xtimmy Dec 10, 2023
ddbae71
added ext parsing
0xtimmy Dec 11, 2023
cd2ec79
fixed an issue with LetE
0xtimmy Dec 11, 2023
b114741
some oddness
0xtimmy Dec 11, 2023
2f4992c
more bug fixing
0xtimmy Jan 11, 2024
19d4a65
add fixed linear ext handling
0xtimmy Jan 11, 2024
9bc6837
let _default contructors pass through
0xtimmy Jan 11, 2024
09c85cb
collision example
0xtimmy Oct 25, 2023
6020508
repeatable module import collisions
0xtimmy Oct 27, 2023
33f7d48
declaration renaming works
0xtimmy Nov 6, 2023
2a2c42a
module rename can modify function callsites and function decalrations…
0xtimmy Nov 8, 2023
c5f48c6
finished basic module import resolution
0xtimmy Nov 10, 2023
826eb0c
parses modules in defs and main as well
0xtimmy Nov 11, 2023
5acadd1
added a pass to resolve imports in desugarModule
0xtimmy Nov 21, 2023
27269e6
aliases work
0xtimmy Nov 22, 2023
7d61d81
qualified imports
0xtimmy Nov 22, 2023
0aa6bb3
spec imports
0xtimmy Nov 23, 2023
d42d258
finished test cases
0xtimmy Nov 30, 2023
a430af3
fix? handling local identifier
0xtimmy Dec 7, 2023
375baae
some testing
0xtimmy Dec 7, 2023
6847ca9
fixed interp
0xtimmy Dec 10, 2023
0350baf
fixing a test (did not specify the sum function)
0xtimmy Dec 10, 2023
da753a5
added ext parsing
0xtimmy Dec 11, 2023
f886311
fixed an issue with LetE
0xtimmy Dec 11, 2023
fc54de8
some oddness
0xtimmy Dec 11, 2023
fbeca95
more bug fixing
0xtimmy Jan 11, 2024
c3232d4
add fixed linear ext handling
0xtimmy Jan 11, 2024
8ce0e24
let _default contructors pass through
0xtimmy Jan 11, 2024
f20862f
notes from artem
0xtimmy Jan 31, 2024
ecc51cd
built bundler & added bundle flow to the parser and compiler
0xtimmy Jan 31, 2024
2e2e322
passes some tests
0xtimmy Feb 14, 2024
d5cf3f2
Merge branch 'import-module-collisions' into module-bundler
0xtimmy Feb 14, 2024
c3e1d6d
Merge pull request #255 from iu-parfunc/module-bundler
0xtimmy Feb 14, 2024
0df2511
fixing merge issue
0xtimmy Feb 14, 2024
9824c51
removed qualification from unique name (gets rid of the ugly {package…
0xtimmy Feb 14, 2024
ba66015
fixed .gib extension
0xtimmy Feb 15, 2024
237b0e5
fixed verbodity issue
0xtimmy Feb 17, 2024
e10b206
adding the fix to the interpreter
0xtimmy Feb 17, 2024
9662f04
PR cleanup
0xtimmy Feb 20, 2024
f66afdc
cleaning up build file
0xtimmy Feb 20, 2024
41d3b82
reverting common.hs
0xtimmy Feb 20, 2024
1349a7c
some more test fixes
0xtimmy Feb 21, 2024
86c50d6
some more test changes
0xtimmy Feb 21, 2024
6062341
alternatives for showing internal type names
0xtimmy Feb 21, 2024
d1ff39b
Merge branch 'main' of github.com:iu-parfunc/gibbon
0xtimmy Feb 21, 2024
c6b38d2
changed layout benches to print the blogs in a way that's independent…
0xtimmy Feb 21, 2024
24b33ba
removing interp changes
0xtimmy Feb 21, 2024
55373d2
handling _default in freshBundle CaseE
0xtimmy Feb 21, 2024
1387304
fixed more test cases
0xtimmy Feb 21, 2024
1d9fed9
fixing manyFuncs
0xtimmy Feb 21, 2024
4330552
solve layout constrs error
0xtimmy Feb 21, 2024
0d17d3a
test cases pass
0xtimmy Feb 21, 2024
65ab88c
Merge pull request #256 from iu-parfunc/test-case-changes
0xtimmy Feb 21, 2024
bbaa2d7
removed some tests missing from main
0xtimmy Feb 21, 2024
97eff1d
adressed comments and added more robust descriptions to all new modules
0xtimmy Feb 28, 2024
a335c8f
added a pass to resolve imports in desugarModule
0xtimmy Mar 8, 2024
ecac589
merged in main
0xtimmy Mar 8, 2024
6756e1d
removing extra files from diff
0xtimmy Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,308 changes: 2,308 additions & 0 deletions IR.log

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions benchmarks/AddImport.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
/* Gibbon program. */

#include "gibbon_rts.h"

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <alloca.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <errno.h>
#include <uthash.h>

#ifdef _WIN64
#include <windows.h>
#endif

#ifdef _GIBBON_POINTER
#include <gc.h>
#endif

#ifdef _GIBBON_PARALLEL
#include <cilk/cilk.h>
#include <cilk/cilk_api.h>
#endif

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Program starts here
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

typedef struct GibIntProd_struct {
GibInt field0;
} GibIntProd;
GibInt add1(GibInt x_1_10_13);
typedef enum {
GibInt_T,
GibFloat_T,
GibSym_T,
GibBool_T,
GibVector_T,
GibList_T,
GibCursor_T,
} GibDatatype;
void info_table_initialize(void)
{
int error = gib_info_table_initialize(7);

if (error < 0) {
fprintf(stderr, "Couldn't initialize info table, errorno=%d", error);
exit(1);
}

GibDatatype field_tys[0];

gib_info_table_finalize();
}
void symbol_table_initialize(void)
{ }
GibInt add1(GibInt x_1_10_13)
{
GibInt flt_15 = x_1_10_13 + 1;

return flt_15;
}
int main(int argc, char **argv)
{
int init_0 = gib_init(argc, argv);

info_table_initialize();
symbol_table_initialize();

GibInt fltAppE_11_12 = add1(0);
GibInt tmp_app_14 = add1(fltAppE_11_12);

printf("%ld", tmp_app_14);
printf("\n");
return 0;

int exit_1 = gib_exit();

return exit_1;
}
76 changes: 76 additions & 0 deletions benchmarks/Addone.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* Gibbon program. */

#include "gibbon_rts.h"

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <alloca.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <errno.h>
#include <uthash.h>

#ifdef _WIN64
#include <windows.h>
#endif

#ifdef _GIBBON_POINTER
#include <gc.h>
#endif

#ifdef _GIBBON_PARALLEL
#include <cilk/cilk.h>
#include <cilk/cilk_api.h>
#endif

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Program starts here
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

typedef enum {
GibInt_T,
GibFloat_T,
GibSym_T,
GibBool_T,
GibVector_T,
GibList_T,
GibCursor_T,
} GibDatatype;
void info_table_initialize(void)
{
int error = gib_info_table_initialize(7);

if (error < 0) {
fprintf(stderr, "Couldn't initialize info table, errorno=%d", error);
exit(1);
}

GibDatatype field_tys[0];

gib_info_table_finalize();
}
void symbol_table_initialize(void)
{ }
int main(int argc, char **argv)
{
int init_0 = gib_init(argc, argv);

info_table_initialize();
symbol_table_initialize();

int exit_1 = gib_exit();

return exit_1;
}
76 changes: 76 additions & 0 deletions benchmarks/Addtwo.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/* Gibbon program. */

#include "gibbon_rts.h"

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <string.h>
#include <time.h>
#include <alloca.h>
#include <sys/mman.h>
#include <sys/resource.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdarg.h>
#include <errno.h>
#include <uthash.h>

#ifdef _WIN64
#include <windows.h>
#endif

#ifdef _GIBBON_POINTER
#include <gc.h>
#endif

#ifdef _GIBBON_PARALLEL
#include <cilk/cilk.h>
#include <cilk/cilk_api.h>
#endif

/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Program starts here
* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/

typedef enum {
GibInt_T,
GibFloat_T,
GibSym_T,
GibBool_T,
GibVector_T,
GibList_T,
GibCursor_T,
} GibDatatype;
void info_table_initialize(void)
{
int error = gib_info_table_initialize(7);

if (error < 0) {
fprintf(stderr, "Couldn't initialize info table, errorno=%d", error);
exit(1);
}

GibDatatype field_tys[0];

gib_info_table_finalize();
}
void symbol_table_initialize(void)
{ }
int main(int argc, char **argv)
{
int init_0 = gib_init(argc, argv);

info_table_initialize();
symbol_table_initialize();

int exit_1 = gib_exit();

return exit_1;
}
1 change: 1 addition & 0 deletions gibbon-compiler/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ demo/*.c
demo/*.exe
gibbon-compiler/examples/parallel/data/*.txt
*.log.hs
*.log
8 changes: 8 additions & 0 deletions gibbon-compiler/build.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Build profile: -w ghc-9.2.8 -O1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The *.log files don't belong in the repo.

In order, the following will be built (use -v for more details):
- gibbon-0.3 (lib) (file src/Gibbon/Language/Syntax.hs changed)
- gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt)
- gibbon-0.3 (exe:gibbon) (dependency rebuilt)
Preprocessing library for gibbon-0.3..
Building library for gibbon-0.3..
[16 of 61] Compiling Gibbon.NewL2.Syntax ( src/Gibbon/NewL2/Syntax.hs, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.o, /home/timmy/git/gibbon/dist-newstyle/build/x86_64-linux/ghc-9.2.8/gibbon-0.3/build/Gibbon/NewL2/Syntax.dyn_o ) [Gibbon.Language.Syntax changed]
7 changes: 7 additions & 0 deletions gibbon-compiler/compile.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Build profile: -w ghc-9.2.8 -O1
In order, the following will be built (use -v for more details):
- gibbon-0.3 (lib) (file src/Gibbon/HaskellFrontend.hs changed)
- gibbon-0.3 (exe:test-gibbon-examples) (dependency rebuilt)
- gibbon-0.3 (exe:gibbon) (dependency rebuilt)
Preprocessing library for gibbon-0.3..
Building library for gibbon-0.3..
7 changes: 4 additions & 3 deletions gibbon-compiler/examples/add1.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module Add where
data Tree = Leaf Int | Node Tree Tree

add1 :: Tree -> Tree
add1 t = case t of
Leaf x -> Leaf (x + 1)
Node x1 x2 -> Node (add1 x1) (add1 x2)
Node x1 x2 -> Node (Add.add1 x1) (Add.add1 x2)

main :: Tree
main = add1 (Node (Leaf 1) (Leaf 2))
gibbon_main :: Tree
gibbon_main = Add.add1 (Node (Leaf 1) (Leaf 2))
Comment on lines -8 to +10
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was annoyed that this example doesn't compile too. But does this change fix it? I seem to remember that gibbon_main can only return scalar types, I think (Int, etc.). Maybe adding a summation over the resulting tree could make it work?

8 changes: 8 additions & 0 deletions gibbon-compiler/examples/imports/AddTree.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module AddTree where
data Tree = Node Tree Tree | Leaf Int

sum :: Tree -> Int
sum t =
case t of
Leaf v -> v
Node l r -> (sum l) + (sum r)
15 changes: 15 additions & 0 deletions gibbon-compiler/examples/imports/Addone.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Addone where
import AddTree

add :: Tree -> Tree
add t = case t of
Leaf x -> Leaf (x + 1)
Node x1 x2 -> Node (add x1) (add x2)

sub :: Tree -> Tree
sub t = case t of
Leaf x -> Leaf (x - 1)
Node x1 x2 -> Node (sub x1) (sub x2)

gibbon_main :: Tree
gibbon_main = add (Node (Leaf 1) (Leaf 2))
15 changes: 15 additions & 0 deletions gibbon-compiler/examples/imports/Addtwo.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module Addtwo where
import AddTree

add :: Tree -> Tree
add t = case t of
Leaf x -> Leaf (x + 2)
Node x1 x2 -> Node (add x1) (add x2)

sub :: Tree -> Tree
sub t = case t of
Leaf x -> Leaf (x - 2)
Node x1 x2 -> Node (sub x1) (sub x2)

gibbon_main :: Tree
gibbon_main = add (Node (Leaf 1) (Leaf 2))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module AllThreeImportModifications where
import qualified Addtwo as T (add)
import qualified Addone as O (add)
import AddTree as Tree (sum, Node, Leaf)

gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2))))
1 change: 1 addition & 0 deletions gibbon-compiler/examples/imports/ImportAliased.ans
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
6 changes: 6 additions & 0 deletions gibbon-compiler/examples/imports/ImportAliased.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module ImportAliased where
import qualified Addtwo as T
import qualified Addone as O
import AddTree as Tree

gibbon_main = sum (T.add (O.add (Tree.Node (Tree.Leaf 1) (Tree.Leaf 2))))
1 change: 1 addition & 0 deletions gibbon-compiler/examples/imports/ImportQualified.ans
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
9
6 changes: 6 additions & 0 deletions gibbon-compiler/examples/imports/ImportQualified.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module ImportQualified where
import qualified Addtwo
import qualified Addone
import AddTree

gibbon_main = sum (Addtwo.add (Addone.add (Node (Leaf 1) (Leaf 2))))
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module ImportQualifiedAndSpecified where
import qualified Addtwo (add)
import qualified Addone (sub)
import AddTree

gibbon_main = sum (Addtwo.add (Addone.sub (Node (Leaf 1) (Leaf 2))))
1 change: 1 addition & 0 deletions gibbon-compiler/examples/imports/ImportSpecified.ans
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
6 changes: 6 additions & 0 deletions gibbon-compiler/examples/imports/ImportSpecified.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module ImportSpecified where
import Addtwo (add)
import Addone (sub)
import AddTree

gibbon_main = sum (add (sub (Node (Leaf 1) (Leaf 2))))
Loading
Loading