[ nice-Bugs-888736 ] linking out of memory - enum value dispatch

"SourceForge.net" <[email protected]> Fri, 06 May 2005 05:39:27 -0700
Newsgroups gmane.comp.lang.nice.devel
Message-ID <[email protected]>
Bugs item #888736, was opened at 2004-02-02 00:50
Message generated for change (Comment added) made by artemgr
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=888736&group_id=12788

Category: None
Group: None
Status: Open
Resolution: Later
Priority: 2
Submitted By: Isaac Gouy (igouy)
Assigned to: Arjan Boeijink (arjanb)
Summary: linking out of memory - enum value dispatch

Initial Comment:
enum Val { One, Two, Three, Four, Five, Six, Seven, 
Eight, Nine }

void main(String[] args){ 
   disp(One, Two, Three, Four, Five, Six, Seven, Eight, 
Nine);
}

void disp(Val a, Val b, Val c, Val d, Val e, Val f, Val g, 
Val h, Val i){}

disp(One, Two, Three, Four, Five, Six, Seven, Eight, 
Nine){}


   \Nice\Test>nicec --sourcepath .. -a t.jar test
   nice.lang: parsing
   test: parsing
   test: typechecking
   test: generating code
   test: linking

An exception has occured in the compiler
Please fill-in a bug report at the following webpage:
http://sourceforge.net/tracker/?
func=add&group_id=12788&atid=112788

Stack trace:
Exception in thread "main" java.lang.OutOfMemoryError


Nice compiler version 0.9.6 prerelease (build 2004.01.31, 
17:05:23 UTC)

(Also report 888398)




----------------------------------------------------------------------

Comment By: Artem Gr Kozarezov (artemgr)
Date: 2005-05-06 16:39

Message:
Logged In: YES 
user_id=289741

I've checked the reported code. It doesn't throw an
OutOfMemoryError!

Nice compiler version 0.9.11 prerelease (build 2005.05.06,
08:56:43 UTC)
Compiled using JDK 1.4.2-p7

I doubt that the original OutOfMemoryError was caused by the
lack of memory, since i recently discovered an infinite loop
in mlsub.typing.lowlevel.Satisfier.enumerate (Satisfier.java:99)

But perhaps this particular bug can be closed, since it
isn't reproducable anymore.

----------------------------------------------------------------------

Comment By: Arjan Boeijink (arjanb)
Date: 2004-02-02 18:04

Message:
Logged In: YES 
user_id=688815

We know that the linking stage can be slow and memory 
greedy but I think that OutOfMemoryError won't occur in real 
world code. It can't be easily improved so I want to wait with 
optimizing this till the language has stabilized.

The coverage tests are different for enums so that no default 
implementation is required but it cost some more memory.

enum Color {red, blue, yellow}
void foo(Color c);
foo(red) {}
foo(blue) {}
foo(yellow) {}

This code won't pass the coverage test if you replace the 
enum with global constants.

I will keep this one open as a long priority bug.

----------------------------------------------------------------------

Comment By: Isaac Gouy (igouy)
Date: 2004-02-02 00:53

Message:
Logged In: YES 
user_id=536291

OTOH this works fine:

class Val {}
let Val One = new Val();
let Val Two = new Val();
let Val Three = new Val();
let Val Four = new Val();
let Val Five = new Val();
let Val Six = new Val();
let Val Seven = new Val();
let Val Eight = new Val();
let Val Nine = new Val();

void main(String[] args){ 
   disp(One, Two, Three, Four, Five, Six, Seven, Eight, Nine);
}

void disp(Val a, Val b, Val c, Val d, Val e, Val f, Val g, Val h, 
Val i){}

disp(One, Two, Three, Four, Five, Six, Seven, Eight, Nine){}

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=112788&aid=888736&group_id=12788


-------------------------------------------------------
This SF.Net email is sponsored by: NEC IT Guy Games.
Get your fingers limbered up and give it your best shot. 4 great events, 4
opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20