1

I tried to create an AST from my big project (approximately 300k LOC). I did that in the following way:

for( file <- files(project)){

        map[Statement,map[str, list[int]]] duplicate = codeDuplicateMap(createAstFromFile(file, true)); 
        for(dup <- duplicate) {

            if(dup in dups) {
                dups[dup] = dups[dup] + duplicate[dup];
            } else {
                dups[dup] = duplicate[dup];
            }

        }

    }

Where project is an M3 project model, but I keep getting |plugin://rascal/src/org/rascalmpl/library/lang/java/m3/AST.rsc|(7496,375,<201,0>,<208,99>): Java("StackOverflowError","")

I also tried to did it with createAstFromEclipseProject('project://project-location'), but that resulted in the same error.

How can I prevent this?

EDIT: Sorry, but both your suggestions don't seem to help. It still throws a Stackoverflow Error.

|plugin://rascal/src/org/rascalmpl/library/lang/java/m3/AST.rsc|(7496,375,<201,0>,<208,99>): Java("StackOverflowError","") at java.util.HashMap.hash(|unknown:///HashMap.java|(0,0,<338,0>,<338,0>)) at java.util.HashMap.get(|unknown:///HashMap.java|(0,0,<556,0>,<556,0>)) at org.rascalmpl.value.type.TypeStore.lookupConstructor(|unknown:///TypeStore.java|(0,0,<485,0>,<485,0>)) at org.rascalmpl.value.type.TypeStore.lookupConstructor(|unknown:///TypeStore.java|(0,0,<547,0>,<547,0>))

I also increased my stack to 128m without any result either.

Jack Sierkstra
  • 1,414
  • 2
  • 20
  • 42
  • https://github.com/cwi-swat/rascal/issues/735 is the bug that is associated with this which was resolved this morning thanks also to your message. You can update your Rascal installation by changing `stable` to `unstable` in the URL of the Rascal update site and you can work like that. Alternatively you could call `createAstFromFile(file, false)` (false instead of true) to work around the problem but than you get less information. – Jurgen Vinju Nov 10 '15 at 18:58
  • I tested the `false` argument and that really circumvents the issue for me. – Jurgen Vinju Nov 10 '15 at 18:59
  • Hi Jurgen, I had a strange problem with Eclipse where my changes weren't being saved to disk. Therefore I ran my initial code each time. I will test it again tonight and report my findings. Thanks for your reaction. – Jack Sierkstra Nov 11 '15 at 07:21
  • 1
    Ok, I confirmed it works now. Thanks for the help. – Jack Sierkstra Nov 11 '15 at 16:12

1 Answers1

2

After running into the same problem (which in my case was not solved by increasing the stack size), I found that setting the collectBindings argument to false prevents the stack overflow at the cost of some information in the resulting AST.

Detailed info (from Jurgen) on what collectBindings does can be found here

Community
  • 1
  • 1
Bouke
  • 104
  • 8