Commit Graph

584 Commits

Author SHA1 Message Date
Joshua Warner
0340be23ce make sure a busy-waiting loop can't block the GC (and hence the whole VM) 2013-12-13 10:39:36 -07:00
Joshua Warner
06432253ba consolidate many implicit list types into one 2013-12-11 10:54:50 -07:00
Geoff Nixon
69ea1f5721 Bugfixes for Mac OS X, etc. 2013-10-31 01:35:56 -07:00
Joel Dice
87b02eb949 update copyright years
Previously, I used a shell script to extract modification date ranges
from the Git history, but that was complicated and unreliable, so now
every file just gets the same year range in its copyright header.  If
someone needs to know when a specific file was modified and by whom,
they can look at the Git history themselves; no need to include it
redundantly in the header.
2013-07-02 20:52:38 -06:00
Joel Dice
84e23659f9 remove unecessary PROTECT statements
Since there's no possibility of garbage collection during the
lifetimes of these local variables, there's no need to protect the
references.
2013-05-14 14:33:37 -06:00
Simon Ochsenreither
e088fa07ae Make exception messages match the ones from OpenJDK/Android
This commit changes the exception message format of
ClassCastException and CloneNotSupportedException.
2013-05-14 15:04:34 +02:00
Joel Dice
fcfdd6be3a initialize the class if necessary when the "new" operator is invoked
This is one of the conditions specified in
http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4.1,
which I had forgotten about.
2013-05-13 13:12:58 -06:00
Joel Dice
bbc5d7fb50 only initialize class when necessary to avoid deadlock
Previously, we would attempt to initialize a class (e.g. call its
static initializer) whenever a method in that class was called, as
well as in any of the cases listed in
http://docs.oracle.com/javase/specs/jls/se7/html/jls-12.html#jls-12.4.

However, the above approach may lead to deadlock in an app which
relies on being able to call non-static methods in parallel with a
static initializer invocation in the same class.  Thus, this commit
ensures that we initialize classes only in the cases defined by the
standard.
2013-04-30 22:48:43 -06:00
Joel Dice
023787d121 fix special case of exception handler table translation
scalac may generate bytecode such that an exception is thrown within
the bounds of a handler for that exception such that the throw is the
last instruction in the method, which we weren't handling properly.
2013-04-22 21:25:15 -06:00
Joel Dice
49d8ccb1bd update Context::executableSize after allocating objectPool
This ensures that, if an exception is thrown later but before the
method has been fully compiled, we will know exactly how much memory
to free.  Previously, we would abort when trying to free the wrong
amount due to an assertion failure.
2013-04-09 18:43:46 -06:00
Joel Dice
b436bd460a fix NaN handling in floating point comparisons 2013-04-03 16:19:33 -06:00
Joel Dice
cc8d655762 use %x,%x format for listing start and end addresses
This matches the format expected by recent versions of GDB's
disassemble command.
2013-04-03 16:07:06 -06:00
Joel Dice
ca84dd26f1 fix System.loadLibrary for OpenJDK tails=true build 2013-03-05 15:43:49 -07:00
Joshua Warner
9327043bc5 Merge branch 'master' into wip
Conflicts:
	makefile
	src/codegen/arm/assembler.cpp
	src/codegen/powerpc/assembler.cpp
	src/codegen/x86/assembler.cpp
2013-02-27 19:27:07 -07:00
Joel Dice
5e2d00010b move headers from src to src/avian
This is necessary to avoid name conflicts on various platforms.  For
example, iOS has its own util.h, and Windows has a process.h.  By
including our version as e.g. "avian/util.h", we avoid confusion with
the system version.
2013-02-27 13:33:29 -07:00
Joshua Warner
4c8b593539 break Architecture out of Assembler 2013-02-23 23:03:01 -07:00
Joshua Warner
b9e281612b move runtime-array to include 2013-02-19 22:56:05 -07:00
Joshua Warner
987af120d8 move codegen headers to include/ 2013-02-19 22:21:22 -07:00
Joshua Warner
d7f088c9e7 adjust package structure in codegen (vm -> avian::codegen and avian::codegen::lir)
The eventual intent with the lir namespace is to formalize some of
the important bits of Assembler interface, to be tested, debug-printed,
and potentially, serialized.

Also, group arguments to apply(...) in OperandInfos
2013-02-12 17:47:57 -07:00
Joshua Warner
3589d5c205 Merge branch 'master' of git://github.com/ReadyTalk/avian
Conflicts:
	src/codegen/arm/assembler.cpp
	src/common.h
	src/machine.cpp
2013-02-12 17:37:19 -07:00
Joshua Warner
f7b49ddb06 allow codegen targets (Architectures and Assemblers) to co-exist
The primary motivation behind this is to allow all the different Assemblers
to be built at once, on a single machine. This should dramatically reduce
the time required to make sure that a particular change doesn't break
the build for one of the not-so-common architectures (arm, powerpc)

Simply pass "codegen-targets=all" to make to compile all
src/codegen/<arch>/assembler.cpp.

Note that while these architectures are built, they will not be fully-
functional.  Certain stuff is assumed to be the same across the entire
build (such as TargetBytesPerWord), but this isn't the case anymore.
2013-02-12 17:16:40 -07:00
Joshua Warner
68776e5d73 move all codegen source in to codegen/ dir 2013-02-10 18:55:38 -07:00
Joshua Warner
964d054117 move RUNTIME_ARRAY into it's own header 2013-02-10 18:07:11 -07:00
Joshua Warner
5dd770d7ea rename cast -> fieldAtOffset 2013-02-10 18:07:03 -07:00
Joshua Warner
d26d8fdb9f rename ceiling -> ceilingDivide 2013-02-10 18:06:15 -07:00
Alexey Pelykh
4228f69a0d Additional AOT_ONLY ifdef 2013-02-09 09:42:26 +02:00
Alexey Pelykh
4d03650544 Replaced TODO comments with messages ; More correct AVIAN_AOT_ONLY usage 2013-02-09 09:42:21 +02:00
Joel Dice
7b07b5b9a3 print more of the stack map when DebugFrameMaps is enabled 2012-12-12 16:04:26 -07:00
Joel Dice
663d8da975 fix stack mapping bug for try blocks containing jsr/ret instructions
In order to calculate the initial stack map of GC roots for an
exception handler, we do a logical "and" of maps across all the
instructions contained in the try block for that handler.  This is
complicated by the presence of jsr/ret instructions, though, because
instructions in a subroutine may have multiple maps associated with
them corresponding to all the paths from which execution might flow to
them.

The bug in this case was that we were using an uninitialized map in
our calculation, resulting in a map with no GC roots at all.  By the
time the map was initialized, the damage had already been done.  The
solution is to treat an uninitialized map as if it has roots at all
positions so that it has no effect on the calculation until it has
been initialized with real data.
2012-12-12 15:54:15 -07:00
Joel Dice
3665753d1f fix MSVC build regression 2012-10-13 13:09:24 -06:00
Joel Dice
8f308291b0 eliminate call stack recursion in compile method
Some OSes (notably, Windows CE) restrict the size of the call stack
such that recursive compilation of branch instructions can lead to
stack overflow in methods with large numbers of such instructions.  In
fact, a worst-case method could even lead to overflow when the stack
size limit is relatively generous.

The solution is to convert this recursion into iteration with an
explicit stack to maintain state about alternate paths through each
branch.
2012-10-13 09:46:12 -06:00
Joel Dice
bac4099acb fix crash in findFrameMapInSimpleTable due to bug in instanceof implementation
We weren't adding entries to the frame map for calls to the instanceof
thunk when compiling methods.  However, that thunk may trigger a GC,
in which case we'll need to unwind the stack, which will lead to a
crash if we don't have a frame map entry for that instruction.
2012-08-17 12:47:38 -06:00
Joel Dice
20a290b992 use signbit instead of isinf to determine floating point sign
glibc's use of isinf's return value to indicate sign is a non-standard
extension which can't be relied upon on other platforms.
2012-08-12 14:52:48 -06:00
Joel Dice
b98abe3f94 fix float to integer conversion
Java requires that NaNs be converted to zero and that numbers at or
beyond the limits of integer representation be clamped to the largest
or smallest value that can be represented, respectively.
2012-08-12 14:31:58 -06:00
Joel Dice
01be4b23bb implement JNI methods needed by AWT
These include PushLocalFrame, PopLocalFrame, NewDirectByteBuffer,
GetDirectBufferAddress, and GetDirectBufferCapacity.
2012-08-11 06:56:19 -06:00
Joel Dice
265ab63e19 fix crash when AOT compiling switch statement with only a default case
The existing code handled such odd switch statements correctly in the
JIT case, but did the wrong thing for the AOT case, leading to an
assertion failure later on.
2012-07-19 13:26:06 -06:00
Joel Dice
86be0c409c fix incorrect jvalue marshalling in compile.cpp
4512a9a introduced a new ArgumentList constructor which was handling
some types incorrectly (e.g. implicitly converting floats to
integers).  This commit fixes it.
2012-07-06 10:56:04 -06:00
Joel Dice
365f863080 disable constant offset check when cross-compiling for a different word size 2012-06-28 16:21:24 -06:00
Joshua Warner
fe1f069309 abort on startup if Thread field offset constants don't match the real runtime values 2012-06-20 13:16:08 -06:00
Joel Dice
886dd184aa fix incorrect stack unwinding for asynchronous stack traces
Our Thread.getStackTrace implementation is tricky because it might be
invoked on a thread executing arbitrary native or Java code, and there
are numerous edge cases to consider.  Unsurprisingly, there were a few
lingering, non-fatal bugs revealed by Valgrind recently, one involving
the brief interval just before and after returning from invokeNative,
and the other involving an off-by-one error in x86.cpp's nextFrame
implementation.  This commit fixes both.
2012-06-18 14:27:18 +00:00
Joel Dice
4512a9a38e implement NewObjectA, Get<type>MethodA, and GetStatic<type>MethodA 2012-06-15 17:41:40 -06:00
Joel Dice
c00f811a2f initialize count_ from starting point in MyStackWalker(MyStackWalker*)
When we're initializing a stack walker based on an existing instance,
we should initialize all the fields from that instance, including
count_.
2012-06-14 09:58:20 -06:00
Joel Dice
d61501453f add support for LZMA on Windows 2012-06-02 15:43:42 -06:00
Joel Dice
5d9f7b2bc3 add optional LZMA support for compressing embedded JARs, boot images, and shared objects 2012-06-02 09:06:22 -06:00
Joel Dice
879df617df add use-clang option for building with LLVM Clang instead of GCC
This also fixes several errors and warnings emitted by Clang.
2012-06-01 17:43:42 -06:00
Joel Dice
0addd8c814 update copyright years 2012-05-11 17:43:27 -06:00
Joel Dice
f0152f1d33 Merge branch 'jdk7' 2012-05-11 16:41:18 -06:00
Joel Dice
90fae940a7 throw IncompatibleClassChangeError on unexpected static status
If a class references a field or method as static and we find it's
actually non-static -- or vice-versa -- we ought to throw an error
rather than abort.
2012-05-11 13:19:55 -06:00
Joshua Warner
fa9814b86d remove lots of unnecessary sizeof computations with a convenient 'operator new' overload 2012-05-08 16:14:54 -06:00
Joshua Warner
64b9407420 Merge branch 'master' into jdk7 2012-05-07 15:05:56 -06:00