Commit Graph

575 Commits

Author SHA1 Message Date
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
Joshua Warner
fde7a3e7a1 give virtualThunks names based on index, to avoid conflicts 2012-05-07 15:05:40 -06:00
Joshua Warner
7c38ea75e4 give thunks symbol names in the bootimage build, use Heap::allocate instead of malloc 2012-05-07 10:00:59 -06:00
Joel Dice
189340954a fix build regression due to last merge 2012-05-04 18:59:15 -06:00
Joel Dice
5ef5158bc1 Merge remote branch 'oss/master' into jdk7 2012-05-04 18:54:31 -06:00
Joel Dice
ea4e0a2f5d fix a couple of subtle Thread.getStackTrace bugs
The first problem was that, on x86, we failed to properly keep track
of whether to expect the return address to be on the stack or not when
unwinding through a frame.  We were relying on a "stackLimit" pointer
to tell us whether we were looking at the most recently-called frame
by comparing it with the stack pointer for that frame.  That was
inaccurate in the case of a thread executing at the beginning of a
method before a new frame is allocated, in which case the most recent
two frames share a stack pointer, confusing the unwinder.  The
solution involves keeping track of how many frames we've looked at
while walking the stack.

The other problem was that compareIpToMethodBounds assumed every
method was followed by at least one byte of padding before the next
method started.  That assumption was usually valid because we were
storing the size following method code prior to the code itself.
However, the last method of an AOT-compiled code image is not followed
by any such method header and may instead be followed directly by
native code with no intervening padding.  In that case, we risk
interpreting that native code as part of the preceding method, with
potentially bizarre results.

The reason for the compareIpToMethodBounds assumption was that methods
which throw exceptions as their last instruction generate a
non-returning call, which nonetheless push a return address on the
stack which points past the end of the method, and the unwinder needs
to know that return address belongs to that method.  A better solution
is to add an extra trap instruction to the end of such methods, which
is what this patch does.
2012-05-04 18:51:58 -06:00
Joel Dice
19de383aae Merge branch 'master' into jdk7
Conflicts:
	makefile
2012-05-04 11:33:16 -06:00
Joshua Warner
a09736e749 write java symbols to bootimage 2012-05-03 10:13:56 -06:00
Joel Dice
8cb6446bec handle zero-length arrays in truncate functions 2012-03-17 12:57:59 -06:00
Joel Dice
d78247ab9a implement -Xss command line option 2012-03-14 12:36:42 -06:00