O
Oliver Wong
jmcgill said:The compiler should know when it's writing an invalid classfile and should
abort with a fatal error.
The OP mentions that the compiler is throwing a "Code too large" error.
- Oliver
jmcgill said:The compiler should know when it's writing an invalid classfile and should
abort with a fatal error.
Oliver said:The OP mentions that the compiler is throwing a "Code too large" error.
Oliver Wong said:From my understanding, the OP has some compiler which takes source code
written into some language (call it language A), and produces code written
in another language (language B). It just so happens that language B is a
superset of Java. I.e., it is exactly like Java, but without various size
limitations.
Mike said:compiles successfully under javac 1.4.2_08. Make it 10923 copies of that
line, and it no longer compiles. Nothing in the language specification
will allow you to determine that 10922 is the magic number.
jmcgill said:But it's still not clear whether the problem is javac turning reasonable
java statements into invalid bytecode, or whether the problem is a code
translator that creates unreasonable (or invalid) java source.
EJP said:It's perfectly clear that it's a translator outputting lots of Java
source from a short sequence in the source language.
Javac and invalid
byte code have nothing to do with it except that javac reports 'method
too long'.
jmcgill said:I have a feeling that's a version of the Halting Problem or something
related. You can't know until you've actually gone through the
compilation process, and by then it's too late.
and I cannot separate the JVM spec from the language spec.
Mike said:That's a shame; you should. One describes a language, one describe an
implementation of that language. They are not the same thing.
jmcgill said:If you say so. I didn't find it all that clear.
There's not a clear, well-defined
limit for the length of a method, and I assume that's at least partly
because this boundary cannot be determined easily, if at all.
EJP said:I don't know why not.
Nobody else talked about the compiler producing
invalid byte code you made that up.
There is a clear well-defined limit for the length of a method of 65535
bytes specified in #4.10 of the Java Virtual Machine Specification.
The distinction between what the language permits and what the JVM
permits is meaningless.
Thomas said:Hi folks,
is there some way how to persuade the javac compiler to accept very long
methods? No, don't worry, I'm not writing this kind of mess. The code in
question is the result of a meta-compilation from another language, and
it turned out that this compiler generated a pretty long java code from
a seemingly simple source. Unfortunately, the compilation of the
generated java code then fails with the infamous "code too large" error.
Is there any kind of tweaking that can be done to make this code
acceptable (besides fixing the compiler that generated the java code
in first place, that is.)?
So long,
Thomas
jmcgill said:In my narrow corner of the real world, there is only Sun. I'm not
particularly proud of that![]()
Mike said:I'd go further than Sun vs. other JVMs, though. My claim is that Java is a
language with its own definition, and that JVM-related restrictions are not
part of that language definition per se.
Thought experiment: consider a Java environment that isn't JVM-based;
rather, it compiles Java to .class files, and allows you to link those files
into a native executable. If it can compile methods too large for javac,
would you consider this a violation of the language spec? Does is matter if
they can theoretically be presented in 65K of bytecode?
jmcgill said:I saw the OP's routine. It's in some vector-based language that I think I
haven't ever seen. [...]
I don't understand the physics or geometry behind the original problem
(Ising model/thermodynamic analysis; I got far enough in physics to have
heard of it, but not far enough to understand what it's useful for.)
I'm still really curious though, because it's rare that I see a
programming language I don't recognize.
What language is this?
topology = torus in {bounded,torus};
width = 512 in {64..4096}; #defines a default and a range.
height = 512 in {64..4096};
or this:
bonds = ([0,1] << 0) + ([0,-1] << 1) + ([1,0] << 2) + ([-1,0] << 3);
jmcgill said:Mike Schilling wrote:
Mike we're much closer to full agreement than you seem to think.
But I've got the mindset where, if something doesn't work in practice, you
miss the delivery of your iteration. All the theory in the world
won't put words in the email to your project manager that spins it like a
positive thing ;-)
Oliver said:It's not unusual to invent a new domain specific language to
facilitate implementing the solution to domain specific problem. Many
times, these languages are unnamed. We've got a few unnamed languages
here at my company.
jmcgill said:The classfile format is the only issue!
Dale King said:It is not necessarily the only issue. You have limitations on branch
statements as well being limited to 64k.
Mike said:Interestingly, I found a 1995 version of the JVM spec online at
http://sunsite.ee/java/vmspec/vmspec-1.html, and under limitations, it
says:
The amount of code per method is limited to 65535 bytes by the sizes
of the indices in the code in the exception table, the line number
table, and the local variable table. This may be fixed for 1.0beta2.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.