Commit Graph

2065 Commits

Author SHA1 Message Date
Joel Dice
222b357089 specify 4-byte alignment of functions defined in ARM assembly code
Apple's assembler, at least, won't automatically align these properly
for us, so we need to explicitly specify the required alignment.
2012-01-19 16:42:35 -07:00
JET
233725e232 All tests passing (again). 2012-01-18 12:41:51 -07:00
JET
9c58c7c936 compiling; all VFP emitters are now correct 2012-01-17 14:10:51 -07:00
JET
c989ea0529 Merge branch 'master' into armvfp 2012-01-16 11:26:03 -07:00
Joel Dice
d29513c653 fix Avian_sun_misc_Unsafe_compareAndSwapLong for platforms without atomicCompareAndSwap64
We never define atomicCompareAndSwap64 for ARM or PowerPC, and
apparently only very recent ARM chips support it, so we must fall back
to synchronization-based emulation.
2012-01-15 10:02:36 -07:00
Joel Dice
49d19456d0 fix infinite wait in Unsafe.park
There were a couple of problems with the Avian_sun_misc_Unsafe_park
implementation in classpath-openjdk.cpp.  First, the wait time should
be interpreted as milliseconds if absolute, but as nanoseconds
otherwise, whereas we were treating it as milliseconds in both cases.
Second, there was no mechanism to exit the while loop after the
specified time; the only way we could exit was via an unpark or
interrupt.
2012-01-14 20:27:40 -07:00
Joel Dice
929315e1f2 avoid crash when parsing certain abstract classes which declare no methods 2012-01-13 16:51:39 -07:00
Joel Dice
0aa5755187 call C library free directly instead of System::free where possible
There was a subtle race condition in the VM shutdown process such that
a System::Thread would be disposed after the System instance it was
created under has been disposed, in which case doing a virtual call to
System::free with that instance would potentially cause a crash.  The
solution is to just call the C library version of free directly, since
that's all System::free does.
2012-01-12 11:00:58 -07:00
JET
fab278f09d More emitters and such; probably not compiling. 2011-12-06 09:24:30 -07:00
Joel Dice
1c85ea8a6e fix GCC 4.6 LTO build
On Ubuntu 11.10, the optimized build was breaking, apparently because
it was eliminating most of the symbols defined in assembly code
(e.g. vmJump) as unreachable when linking libjvm.so, which left
avian-dynamic unlinkable due to an unresolved symbol.

The solution in this commit is to export makeSystem and makeFinder
from libjvm.so rather than build redundant versions of finder.cpp and
posix.cpp/windows.cpp into avian-dynamic like we've been doing.  This
avoids the whole problem of vmJump reachability and reduces the size
of avian-dynamic at the same time.

This commit also turns off LTO for the avian-dynamic link since we get
odd undefined symbol errors about libc-defined symbols otherwise.
This may merit future investigation, but avian-dynamic is so small and
simple that there's no need to optimize it anyway.
2011-11-19 19:26:25 -07:00
Joel Dice
e4c1f923b5 fix GC safety bug in resolveObjectArrayClass
The call to getClassRuntimeData may trigger a GC, so we must mark the
local variables to be visited.
2011-11-18 08:38:19 -07:00
Joel Dice
3e5a7d9a41 reset immortal fixed objects when heap is disposed
This should ensure that the bootimage is ready to reuse by another
instance of the VM later on.
2011-11-11 17:37:40 -07:00
Joel Dice
7d185dd27d revert heap.cpp part of last commit
That change seems to be causing crashes under certain circumstances,
so I'm reverting it for now while I debug.
2011-11-10 15:27:34 -07:00
Joel Dice
4d0b127989 support multiple sequential VM instances with bootimage build
Until now, the bootimage build hasn't supported using the Java
invocation API to create a VM, destroy it, and create another in the
same process.  Ideally, we would be able to create multiple VMs
simultaneously without any interference between them.  In fact, Avian
is designed to support this for the most part, but there are a few
places we use global, mutable state which prevent this from working.
Most notably, the bootimage is modified in-place at runtime, so the
best we can do without extensive changes is to clean up the bootimage
when the VM is destroyed so it's ready for later instances.  Hence
this commit.

Ultimately, we can move towards a fully reentrant VM by making the
bootimage immutable, but this will require some care to avoid
performance regressions.  Another challenge is our Posix signal
handlers, which currently rely on a global handle to the VM, since you
can't, to my knowledge, pass a context pointer when registering a
signal handler.  Thread local variables won't necessarily help, since
a thread might attatch to more than one VM at a time.
2011-11-10 13:33:36 -07:00
Joel Dice
6e86ac39db fix native call marshalling on Apple/ARM
When the fourth argument is a 64-bit value on the Apple ARM ABI, it is
passed half by register and half on the stack, unlike on Linux where
it is passed entirely on the stack.  The logic to handle this in arm.h
was flawed, and this commit fixes it.
2011-11-07 17:14:41 -07:00
Joel Dice
8501ce8711 avoid using runtime-generated thunks for bootimage native methods 2011-10-03 08:05:49 -06:00
Joel Dice
5c39819cf0 fix uninitialized value warnings in bootimage.cpp 2011-10-03 08:05:25 -06:00
Joel Dice
248ff26581 fix thinko in machine.cpp 2011-10-03 08:04:58 -06:00
Joel Dice
db9f9a300d Revert "remove distinction between thunks and bootThunks in compile.cpp"
This reverts commit 88d614eb25.

It turns out we still need separate sets of thunks for AOT-compiled
and JIT-compiled code to ensure we can always generate efficient jumps
and calls to thunks on architectures such as ARM and PowerPC, whose
relative jumps and calls have limited ranges.
2011-10-01 18:11:02 -06:00
Joel Dice
043e466921 change bool field types to uint8_t in Fixie class
The bool type is 32 bits on Darwin/PowerPC, unlike other platforms.
To make bootimage creation consistent, we now use an explicit 8-bit
type.
2011-09-30 18:46:54 -06:00
Joel Dice
ad22de6d73 fix uninitialized variable in bootimage.cpp 2011-09-30 18:46:53 -06:00
Joel Dice
ed6945dec7 fix offset calculations in arm.cpp and powerpc.cpp 2011-09-30 18:46:53 -06:00
Joel Dice
5f05110f33 fix type of TargetPointerMask 2011-09-30 17:00:45 -06:00
Joel Dice
b063f10ad5 fix Windows build 2011-09-30 14:44:25 -06:00
Joel Dice
88d614eb25 remove distinction between thunks and bootThunks in compile.cpp
Now that the AOT-compiled code image is position-independent, there is
no further need for this distinction.  In fact, it was harmful,
because we were still using runtime-generated thunks when we should
have been using the ones in the code image.  This resulted in
EXC_BAD_ACCESS errors on non-jailbroken iOS devices.
2011-09-30 13:17:28 -06:00
Joel Dice
296cb74847 add bare-bones ConcurrentLinkedQueue implementation 2011-09-29 18:26:50 -06:00
Joel Dice
61457dca70 add workaround for buffer overflow on iOS Simulator
It seems that the Apple iOS Simulator's stat implementation writes
beyond the end of the struct stat we pass it, which can clobber
unrelated parts of the stack.  Perhaps this is due to some kind of
header/library mismatch, but I've been unable to track it down so far.
The workaround is to give it 8 words more than it should need, where 8
is a number I just made up and seems to work.
2011-09-29 18:23:15 -06:00
JET
97bc388f57 ARM VFP multiplication testing. 2011-09-29 14:25:31 -06:00
JET
5cf21f49c7 Compiler error fix. 2011-09-28 15:38:27 -06:00
JET
253b2c264d Merge branch 'ios' into armvfp 2011-09-28 15:10:02 -06:00
JET
ce829b1c77 Added VFP emitters (have yet to compile). 2011-09-28 15:08:23 -06:00
Joel Dice
4e4d109787 fix regression in static field offset calculation
One of the changes in commit 5b4f179 broke this calculation.
2011-09-28 11:12:21 -06:00
Joel Dice
0372d999d3 use TargetBytesPerWord instead of BytesPerWord where appropriate 2011-09-23 23:25:52 -06:00
Joel Dice
3fa4a7001d fix x86->powerpc boot image cross build
This fixes the remaining cross-endian translation issues needed to
build powerpc boot images on x86.
2011-09-23 22:31:24 -06:00
Joel Dice
e6c780e4e8 whitespace tweak for usage message in bootimage.cpp 2011-09-23 22:31:24 -06:00
Joel Dice
21d1a6c883 add __attribute__ ((used)) to EXPORT macro definition
This ensures that exported functions are not stripped when using the
-dead_strip option to the Apple linker.
2011-09-22 16:57:44 -06:00
Joel Dice
559af69269 various ARM fixes 2011-09-20 19:50:38 -06:00
Joel Dice
c537dcfd34 generate read-only code image in bootimage build
This avoids the requirement of putting the code image in a
section/segment which is both writable and executable, which is good
for security and avoids trouble with systems like iOS which disallow
such things.

The implementation relies on relative addressing such that the offset
of the desired address is fixed as a compile-time constant relative to
the start of the memory area of interest (e.g. the code image, heap
image, or thunk table).  At runtime, the base pointer to the memory
area is retrieved from the thread structure and added to the offset to
compute the final address.  Using the thread pointer allows us to
generate read-only, position-independent code while avoiding the use
of IP-relative addressing, which is not available on all
architectures.
2011-09-20 16:30:30 -06:00
Joel Dice
349d381d95 progress towards cross-endian bootimage builds
This fixes a number of bugs concerning cross-architecture bootimage
builds involving diffent endianesses.  There will be more work to do
before it works.
2011-09-16 20:53:08 -06:00
Joel Dice
178dd7af34 Merge remote branch 'origin/master' into ios 2011-09-16 20:46:03 -06:00
Joel Dice
d342c9b8c5 fix 64-bit Windows openjdk-src build 2011-09-16 19:01:14 -06:00
Joel Dice
ab840c91db Merge branch 'oss-master' into ios 2011-09-12 20:27:59 -06:00
Joel Dice
be01e5b687 fix handling of 64-bit arguments to Method.invoke on 32-bit architectures
The previous code failed to account for alignment padding in the
Double and Long classes.
2011-09-12 20:26:32 -06:00
Joel Dice
8a30efc52f only generate crash dumps for access violations and divides-by-zero
Some apps and libraries may generate recoverable SEH exceptions on
Windows, in which cases we don't want to waste time and disk space
generating memory dumps.
2011-09-12 13:45:21 -06:00
Joel Dice
84a6daa400 fix unused parameter warning 2011-09-01 11:36:00 -06:00
Joel Dice
66bc326523 Merge branch 'cross-bootimage' into ios 2011-09-01 10:53:39 -06:00
Joel Dice
6949fc3d60 Merge remote-tracking branch 'origin/master' into ios 2011-09-01 10:53:20 -06:00
Joel Dice
e3fc8d3dd2 enable cross-architecture ARM bootimage builds 2011-09-01 10:51:56 -06:00
Joel Dice
e505cbe99d more progress towards cross-architecture bootimage builds
This commit fixes a lot of bugs.  All tests are now pass for Linux
x86_64 to Linux i386 cross builds.
2011-08-31 21:18:00 -06:00
Joel Dice
5d55d61c17 fix use of uninitalized memory in jnienv.cpp 2011-08-31 21:16:22 -06:00
Joel Dice
67300c229a change local variable name to avoid shadowing another variable 2011-08-31 21:15:41 -06:00
Joel Dice
5b4f17997f progress towards cross-architecture bootimage builds
This monster commit is the first step towards supporting
cross-architecture bootimage builds.  The challenge is to build a heap
and code image for the target platform where the word size and
endianess may differ from those of the build architecture.  That means
the memory layout of objects may differ due to alignment and size
differences, so we can't just copy objects into the heap image
unchanged; we must copy field by field, resizing values, reversing
endianess and shifting offsets as necessary.

This commit also removes POD (plain old data) type support from the
type generator because it added a lot of complication and little
value.
2011-08-29 19:00:17 -06:00
Joel Dice
f0cb26ec51 treat carriage returns as whitespace when parsing types.def
On Windows, some versions of Git automatically translate Unix line
endings to Windows line endings, which can break the build unless we
treat carriage returns as whitespace when parsing.
2011-08-29 14:31:30 -06:00
Joel Dice
4c47f4fae8 Merge remote-tracking branch 'origin/master' into ios 2011-08-23 16:40:01 -06:00
Joel Dice
b4661d2ccd Merge remote branch 'origin/master' into ios 2011-08-15 07:09:44 -06:00
Joel Dice
3df3892d34 throw AbstractMethodError when appropriate in prepareMethodForCall
Otherwise, we'll crash later when we try to compile an abstract
method.
2011-08-12 14:19:21 -06:00
Joel Dice
8d2ca7aaf5 fix Thread.interrupt deadlock
Previously, we returned immediately from Monitor.wait if we found we
had been interrupted, but this caused deadlock when waiting to enter
the exclusive state, since we never released Machine::stateLock to
allow active threads to transition into the idle state.  This commit
ensures that we at least briefly release the lock without actually
waiting in that case.
2011-08-11 07:35:03 -06:00
Joel Dice
44f7bd9fe0 fix argument alignment for Darwin/ARM 2011-08-10 21:33:56 -06:00
Joel Dice
39cffb8933 set minimum capacity to one if it's zero in Segment constructor
Allocating an empty Segment causes problems for later computations, so
we avoid it even if the caller would otherwise permit it.
2011-08-10 21:30:55 -06:00
Joel Dice
e5a8d5c824 add support for Apple iOS on ARM
Most tests are passing, but not all, so this still needs more work.
2011-08-10 19:21:48 -06:00
Joel Dice
4b9cb4f4e4 enable JMX support for openjdk-src build and implement GetInputArgumentArray 2011-08-05 18:06:29 -06:00
Joel Dice
801327752a accept (but currently ignore) -client and -server options for command-line compatibility with java 2011-07-18 14:17:22 -06:00
Joel Dice
c3824c6844 fix crash when encountering invokespecial call to abstract method
We must throw an AbstractMethodError when such a call is executed (not
when the call is compiled), so we compile this case as a call to a
thunk which throws such an error.
2011-07-17 19:54:55 -06:00
Joel Dice
08d4fddbb4 handle case of class with no methods in classInitializer 2011-07-17 19:51:48 -06:00
Joel Dice
753b90a811 request an object mask when allocating a singleton
Singletons may have embedded object references, and if they are
allocated at fixed memory locations (e.g. if they are larger than
64KB), they must have object masks so the garbage collector knows were
to find said references.
2011-07-17 19:48:28 -06:00
Joel Dice
adbe74efbe add debug logging to finder.cpp 2011-07-17 19:48:12 -06:00
Joel Dice
20091031da increase HeapCapacity to 256MB in bootimage.cpp
This is necessary to avoid running out of memory when building
bootimages of certain apps with OpenJDK using ProGuard'ed code.
2011-07-17 19:45:58 -06:00
Joel Dice
f6d489ff88 memoize padding calculations in x86.cpp
These calculations were appearing high on profiles of apps which force
a lot of methods to be compiled at startup.
2011-07-16 19:12:45 -06:00
Joel Dice
67cbc79613 fix crash in BranchEvent::compile for bootimage builds
We can't reduce a conditional branch to an unconditional jump unless
both arguments to the comparison are constants *and* those constants
have been resolved.  The latter may not be true in the case of a
bootimage build.
2011-07-16 19:10:05 -06:00
Joel Dice
a2933c1f9e update copyright years in compile.cpp 2011-07-16 19:08:39 -06:00
Joel Dice
3ec4ef9bd2 fix stack unwinding from native methods for tails=true build
We can't clear t->trace->targetMethod until after findUnwindTarget has
been called or we'll lose track of where we are on the stack.
2011-07-13 18:06:02 -06:00
Joel Dice
e3662f13a9 update copyright years and increment version number 2011-07-13 08:25:21 -06:00
Joel Dice
7a82ee6b38 add new System::Monitor::waitAndClearInterrupted method
We had be using System::Monitor::wait to block threads internally in
the VM as well as to implement Object.wait.  However, the interrupted
flag should only be cleared in the latter case, not the former.  This
commit adds a new method and changes the semantics of the old one in
order to acheive the desired behavior.
2011-07-12 18:01:17 -06:00
Joel Dice
c3fa08c430 fix Thread.interrupt and Thread.interrupted
These were both totally broken; the latter wasn't even implemented.
This commit fixes/implements them and adds a simple test to exercise
them.
2011-07-12 14:15:43 -06:00
Joel Dice
ab8e6cdc80 convert classpath paths to absolute paths
This is necessary because some apps expect CodeSource.getLocation() to
return URL containing an absolute path.
2011-07-11 10:56:53 -06:00
Joel Dice
19d5022456 fix GC safety bugs in getClassAddendum and makeArrayClass 2011-07-09 18:01:00 -06:00
Joel Dice
ec4568d806 handle strings of arbitrary size in makeByteArray 2011-07-09 18:00:19 -06:00
Joel Dice
b4169ede91 fix reversed arguments to maybeRex in sseMoveRR
This was causing 8-byte SSE-to-SSE moves involving registers
xmm8-xmm15 to be misencoded on x86_64, leading to incorrect code
generation in methods with lots of local variables of type double.
2011-07-06 11:09:06 -06:00
Joel Dice
6dc9c98604 fix Set[Static]DoubleField regression for 32-bit platforms
We were truncating 64-bit doubles to 32-bit values with zany results.
2011-06-20 14:24:11 -06:00
Joel Dice
9356ade4fd Revert "Updated powerpc build to disable stack overflow checks for now due to a problem we found with large enums."
This reverts commit 8e736327d4.
2011-06-03 17:36:47 -06:00
Joel Dice
50a699a08f Merge remote branch 'origin/B14038_Lion_appshare' into oss-master 2011-06-03 17:35:40 -06:00
Joel Dice
bcc72e8c9d Merge remote branch 'remotes/origin/B14038_Lion_appshare' into oss-master 2011-06-03 14:39:50 -06:00
Matt Klich
c7c0a45a61 Revert "OSX Lion build changes"
This commit introduced conditional includes which is not the preferred
method. Will do it in the makefile instead.

This reverts commit 7148556979.
2011-06-01 13:56:03 -06:00
Joel Dice
92adc83caf remove NPE debug logging 2011-05-29 11:16:52 -06:00
Joel Dice
05f26983d0 implement more sun.misc.Unsafe methods 2011-05-26 17:41:15 -06:00
Joel Dice
24f7b42d45 ensure class initialized in {Get|Set}Static*Field
All static field accesses must trigger class initialization if it
hasn't happened already, including JNI accesses.
2011-05-26 17:39:19 -06:00
Matt Klich
7148556979 OSX Lion build changes 2011-05-26 11:57:30 -06:00
Joel Dice
7bea2b6b7d fix putstatic/putfield for 64-bit volatiles
We must call acquireMonitorForObject before popping the
putstatic/pushfield operands off the stack to avoid clobbering said
operands.
2011-05-23 12:38:12 -06:00
Joel Dice
bfe6934183 support multiline Class-Path properties in JAR manifests 2011-05-16 10:34:10 -06:00
Joel Dice
2b229b4b6d add stub implementations of JVM_{Enable|Disable}Compiler 2011-05-16 10:33:46 -06:00
Joel Dice
fa7d46c322 handle methods ending with large blocks properly when generating constant pools
We can only omit the jump past a constant pool if it's placed at the
end of a method, which is only true if the pool belongs to the last
block of that method and that block is not so large that the pool must
be placed inside the block instead of after it.
2011-05-11 19:56:29 -06:00
Joel Dice
b76cbbfa56 fix instruction offset calculation in powerpc.cpp
The previous code did not take into account any padding embedded in a
basic block due to inline jump tables, which led to invalid code
generation in large methods
2011-05-11 19:50:45 -06:00
Mike Keesey
8e736327d4 Updated powerpc build to disable stack overflow checks for now due to a problem we found with large enums. 2011-04-22 20:22:47 -06:00
Joel Dice
0987255552 tolerate missing classes in interceptFileOperations
If we fail to resolve a given class (e.g. due to ProGuard obfuscating
or eliminating it), just move on to the next one rather than return
immediately.  Otherwise, we may miss intercepting methods of classes
we can resolve.
2011-04-10 17:01:38 -06:00
Joel Dice
7c30e44601 add appropriate memory barriers to double-checked locking code 2011-04-10 14:46:53 -06:00
Joel Dice
88c95615c7 fix cut-and-paste error in ACQUIRE_FIELD_FOR_WRITE definition 2011-04-10 14:42:46 -06:00
Joel Dice
8091803b59 set MaxNativeCallFootprint to 5 on 32-bit systems
Thunks such as divideLong now take a pointer and two int64_t
arguments, which amounts to 5 words of stack space on a 32-bit system.
2011-04-10 12:55:42 -06:00
Joel Dice
ed8a72af9e fix MSVC build 2011-04-10 12:55:12 -06:00
Joel Dice
3febd7cea7 load libfontmanager.so before trying to resolve FontManager.initIDs
sun.font.FontManager.initIDs is a native method defined in
libfontmanager.so, yet there seems to be no mechanism in OpenJDK's
class library to actually load that library, so we lazily load it
before trying to resolve the method.
2011-04-10 11:26:44 -06:00
Joel Dice
d5fb7f97b9 implement sun.misc.Unsafe.getFloat 2011-04-10 11:26:01 -06:00
Joel Dice
00b829b8e8 fix Class.getDeclaredMethods
Internally, the VM augments the method tables for abstract classes
with any inherited abstract methods to make code simpler elsewhere,
but that means we can't use that table to construct the result of
Class.getDeclaredMethods since it would include methods not actually
declared in the class.  This commit ensures that we preserve and use
the original, un-augmented table for that purpose.
2011-04-09 21:20:56 -06:00
Joel Dice
1476243662 implement sun.misc.Unsafe.putShort 2011-04-09 21:20:21 -06:00
Joel Dice
6707116dd4 implement sun.misc.Unsafe.addressSize 2011-04-09 21:19:49 -06:00
Joel Dice
e1d45cf7c8 add stub implementation of JVM_GetManagement
This is the minimum needed to get Apache Geronimo running.
2011-04-09 21:18:33 -06:00
Joel Dice
b3d65fab9b fix handling of interfaces in isAssignableFrom
The old version was both incorrect (in the case where both arguments
are interfaces) and inefficient.
2011-04-09 21:09:59 -06:00
Joel Dice
948a2523f1 use vm::run to implement IsAssignableFrom and IsInstanceOf
Under certain circumstances, the implementations of these functions
may throw errors, so we need to wrap them using vm::run so we don't
try to unwind past the JNI boundary.
2011-04-09 21:07:10 -06:00
Joel Dice
239fd98781 fix compilation of unusual exception handlers
As described in commit 36aa0d6, apps such as jython which generate
bytecode dynamically can produce patterns of bytecode for which the
VM's compiler could not handle properly.  However, that commit
introduced a regression and had to be partially reverted.

It turns out the real problem was the call to Compiler::restoreState
which we made before checking whether we were actually ready to
compile the exception handler (we delay compiling an exception handler
until and unless the try/catch block it serves has been compiled so we
can calculate the stack maps properly).  That confused the compiler in
rare cases, so we now only call restoreState once we're actually ready
to compile the handler.
2011-04-09 12:44:28 -06:00
Joel Dice
97aec1691e fix jsr/ret stack mapping regression
My last commit introduced a regression in JIT compilation of
subroutines.  This reverts the specific change which caused the
regression.  Further work will be needed to address the case which
that change was intended to fix (namely, exception handlers which
apply to multiple try/catch blocks).
2011-04-08 20:15:36 -06:00
Joel Dice
36aa0d6792 improve handling of unusual bytecode in JIT compiler
Bytecode generated by compilers other than javac or ecj (such as
jython's dynamically generated classes) can contain unreachable code
and exception handlers which apply to more than one try/catch scope.
Previously, the VM's JIT compiler did not handle either of these cases
well, hence this commit.
2011-04-08 18:50:22 -06:00
Joel Dice
60db8cc047 add some commented-out debug code to defineClass
When uncommented, this code will write each defined class to disk,
which allows one to examine e.g. dynamically-generated classes using
e.g. javap.
2011-04-08 18:46:43 -06:00
Joel Dice
d3581be38e don't abort when parsing malformed UTF8 strings
Previously, we would abort the process if we encountered a truncated
multibyte character in parseUtf8NonAscii (called by the JNI method
NewStringUTF).  Now we simply terminate the string at that point.
2011-04-07 14:39:27 -06:00
Joel Dice
af9288f4ee don't abort when parsing malformed UTF8 strings
Previously, we would abort the process if we encountered a truncated
multibyte character in parseUtf8NonAscii (called by the JNI method
NewStringUTF).  Now we simply terminate the string at that point.
2011-04-07 14:26:54 -06:00
Joel Dice
b0ae6343ad provide proper implementations of JVM_GetDeclaredClasses, JVM_GetDeclaringClass 2011-03-31 19:47:26 -06:00
Joel Dice
ef86530080 call static initializer of superclass before that of class itself
Also, assume any class which has an ancestor class which has a static
initializer needs initialization even if it doesn't have one itself,
per the Java Language Spec.
2011-03-31 19:43:49 -06:00
Joel Dice
1c7abe782d specify valid code source for system classes
This enables use of a class's protection domain to determine what JAR
or directory it came from.
2011-03-31 19:38:44 -06:00
Joel Dice
8d9412c1e8 remove redundant statement in parseUtf8
VM heap allocated memory is already zero'd out, so there's no need to
explicitly end strings with a null character.
2011-03-31 19:10:20 -06:00
Joel Dice
384682431a implement JVM_GetSystemPackages stub 2011-03-31 19:00:42 -06:00
Joel Dice
916e6787de set Thread.blocker during thread construction
This avoids an NPE in Thread.blockedOn.
2011-03-31 18:58:59 -06:00
Joel Dice
6506760dd9 implement Unsafe.putByte 2011-03-28 08:55:20 -06:00
Joel Dice
572f2d81eb handle case where value has acquired more than one resource in resetFrame 2011-03-28 08:54:37 -06:00
Joel Dice
3e92f18ab0 remove redundant conditional from resetFrame 2011-03-27 21:15:54 -06:00
Joel Dice
9fe41b2afc only return declared interfaces from Class.getInterfaces
The result of Class.getInterfaces should not include interfaces
declared to be implemented/extended by superclasses/superinterfaces,
only those declared by the class itself.  This is important because it
influences how java.io.ObjectStreamClass calculates serial version
IDs.
2011-03-27 20:29:31 -06:00
Joel Dice
56e832d3e8 fix JVM_GetArrayElement and JVM_SetArrayElement
The old versions only handled object arrays properly, but they need to
handle primitive arrays as well.
2011-03-27 20:25:47 -06:00
Joel Dice
62e10cf992 return only non-negative values from takeHash
Some broken code implicitly relies on System.identityHashCode always
returning a non-negative number (e.g. old versions of
com/sun/xml/bind/v2/util/CollisionCheckStack.hash).
2011-03-27 20:22:59 -06:00
Joel Dice
c75cf7ebb6 release all resources in resetFrame
Code including subroutines and conditionals can result in frame and
register resources being held by values which aren't in scope when
resetFrame is called, so we need to clean them up after cleaning the
in-scope values.
2011-03-27 14:15:05 -06:00
Joel Dice
8283e1da46 ignore instances of DelegatingClassLoader in JVM_LatestUserDefinedLoader 2011-03-27 14:13:36 -06:00
Joel Dice
d16bf57634 implement JVM_MaxObjectInspectionAge stub and Unsafe.getShort 2011-03-27 14:12:41 -06:00
Joel Dice
686cbc3637 implement JVM_ResolveClass
This just reuses code in avian.Classes which was formerly only used in
the Avian classpath build.
2011-03-26 23:24:48 -06:00
Joel Dice
ba028b86bf set java.vm.vendor system property during startup 2011-03-26 23:24:05 -06:00
Joel Dice
ad79bbcbd5 update class loader map when creating new array class
This ensures that we don't create redundant array classes later.
2011-03-26 23:21:37 -06:00
Joel Dice
d5ae053f11 handle invokevirtual calls to non-virtual methods
OpenJDK's sun.reflect.MethodAccessorGenerator can generate
invokevirtual calls to private methods (which we normally consider
non-virtual); we must compile them as non-virtual calls since they
aren't in the vtable.
2011-03-26 23:13:05 -06:00
Joel Dice
0f38673baa fix line number and exception handler scope regression
It turns out commit 31eb047 was too aggressive and led to incorrect
calculation of line numbers for machine addresses, as well as
potentially incorrect exception handler scope calculation.  This fixes
the regression.
2011-03-26 19:55:23 -06:00
Joel Dice
89947f4655 set default thread context classloader to app loader, not boot loader 2011-03-26 19:01:48 -06:00
Joel Dice
01b3f1cb93 fix GCC 4.6 unused variable warnings 2011-03-26 14:43:03 -06:00
Joel Dice
3fd6af152f fix Windows and GCC 3.4 builds 2011-03-26 11:45:33 -06:00
Joel Dice
ba0cc803a6 implement various JVM_* methods
This includes a proper implementation of JVM_ActiveProcessorCount, as
well as JVM_SetLength and JVM_NewMultiArray.  Also, we now accept up
to JNI_VERSION_1_6 in JVM_IsSupportedJNIVersion.
2011-03-26 11:15:52 -06:00
Joel Dice
3dd091c67a implement jar and file URL stream handlers 2011-03-25 19:14:21 -06:00
Joel Dice
31eb047391 handle redundant, unreachable gotos in JIT compiler
I recently encountered a Batik JAR with a method containing a
redundant goto which confused the JIT compiler because it was refered
to in the exception handler and line number tables despite being
unreachable.  I don't know how such code was generated, but this
commit ensures the compiler can handle it.
2011-03-25 19:13:10 -06:00
Joel Dice
639ef50079 handle null caller in JVM_GetCallerClass 2011-03-25 19:13:10 -06:00
Joel Dice
7b4b43e119 implement JVM_CompileClass and JVM_CompileClasses stubs
These don't currently do anything but return false.
2011-03-25 19:13:10 -06:00
Joel Dice
838cf9fdd1 avoid calling doCollect recursively
We must not allocate heap objects from doCollect, since it might
trigger a GC while one is already in progress, which can cause trouble
when we're still queuing up objects to finalize, among other things.
To avoid this, I've added extra fields to the finalizer and cleaner
types which we can use to link instances up during GC without
allocating new memory.
2011-03-25 19:11:38 -06:00
Joel Dice
b9f8188544 don't try to release monitor if we get OOME when trying to acquire it
We can't blindly try release the monitors for all synchronized methods
when unwinding the stack since we may not have finished acquiring the
most recent one when the exception was thrown.
2011-03-25 18:40:51 -06:00
Joel Dice
3e93d5d337 fix Value::home integer overflow
A method with a large number of local variable slots may imply offsets
larger than a int8_t can represent, so we now use an int16_t instead.
2011-03-25 18:27:02 -06:00
Joel Dice
960bd28296 preallocate monitor node in monitorWait
If we don't preallocate the memory we need to reacquire the lock after
we finish waiting, we risk an OOME which may unwind the stack into
code which assumes we still have acquire the lock successfully.
2011-03-25 18:21:15 -06:00
Joel Dice
d928d695ff try harder in low memory situations in Zone::allocate
Instead of giving up when the backing allocator's tryAllocate method
returns null, we switch to the allocate method to show we mean
business.  This makes use of zones more robust under low memory
situations since it allows us to exceed the soft memory ceiling when
the only alternative is to abort.
2011-03-25 18:14:34 -06:00
Joel Dice
61552b6b8a check for and handle instances of sun.misc.Cleaner during GC
OpenJDK uses an alternative to Object.finalize for resource cleanup in
the form of sun.misc.Cleaner.  Normally, OpenJDK's
java.lang.ref.Reference.ReferenceHandler thread handles this, calling
Cleaner.clean on any instances it finds in its "pending" queue.
However, Avian handles reference queuing internally, so it never
actually adds anything to that queue, so the VM must call
Cleaner.clean itself.
2011-03-19 15:10:52 -06:00
Joel Dice
7004c0ddf3 various fixes and additions to increase app compatiblity
The main changes here are:

  * fixes for runtime annotation support

  * proper support for runtime generic type introspection

  * throw NoClassDefFoundErrors instead of ClassNotFoundExceptions
    where appropriate
2011-03-17 21:42:15 -06:00
Joel Dice
8a28578ef5 don't defer to previous handler in signal handler
It isn't necessarily safe or desireable to call the previous handler
even if it's non-null, so we ignore it entirely except to reinstate it
when unregistering our own handler.
2011-03-17 21:32:37 -06:00
Joel Dice
86733a25f4 increase executable area size to 30MB
Big applications can exceed the 16MB limit we previously used.
Increasing this above 30MB (if/when desired) will require changes to
the ARM and PowerPC JIT code to work around immediate branch encoding
limits on those platforms,
2011-03-17 21:24:35 -06:00
Joel Dice
023e1d93d5 return null for non-array classes in JVM_GetComponentType 2011-03-17 09:41:52 -06:00
Joel Dice
0922dd3429 swap NativeLine and UnknownLine values to match Sun's convention 2011-03-17 09:41:23 -06:00
Joel Dice
366dfc009c fix mode=stress thinko and GC safety issue in machine.cpp 2011-03-17 08:49:41 -06:00
Joel Dice
3f87129cbc use correct names for primitive classes in type generator 2011-03-17 08:48:47 -06:00
Joel Dice
110e2e1d52 fix putstatic code order regression in compile.cpp
Also, ensure that class is initialized before getting or setting
static fields in lazy loading code.
2011-03-17 08:46:46 -06:00
Joel Dice
44020482e5 fix GC safety bugs in classpath-openjdk.cpp 2011-03-17 08:43:01 -06:00
Joel Dice
7152c3fdb3 handle volatile fields properly in JNI Get/Set methods
This commit ensures that we use the proper memory barriers or locking
necessary to preserve volatile semantics for such fields when accessed
or updated via JNI.
2011-03-15 19:34:00 -06:00
Joel Dice
453ceb42ab implement lazy class/field/method resolution in JIT compiler
Unlike the interpreter, the JIT compiler tries to resolve all the
symbols referenced by a method when compiling that method.  However,
this can backfire if a symbol cannot be resolved: we end up throwing
an e.g. NoClassDefFoundError for code which may never be executed.
This is particularly troublesome for code which supports multiple
APIs, choosing one at runtime.

The solution is to defer to stub code for symbols which can't be
resolved at JIT compile time.  Such a stub will try again at runtime
to resolve the needed symbol and throw an appropriate error if it
still can't be found.
2011-03-15 18:07:13 -06:00
Joel Dice
a3a7a7a2de use getcwd instead of getenv("PWD") to get working directory
PWD is not always set, whereas getcwd is more reliable.
2011-03-15 17:33:09 -06:00
Joel Dice
e5ecb5b549 add optional avian.error.log system property
This property may be used to specify a file name to use for printing
stack traces for unhandled exceptions.  The default is stderr.
2011-03-15 17:27:17 -06:00
Joel Dice
51c8d7511a fix OS X PowerPC parameter passing
We were not always placing parameters in the correct stack positions
in the PowerPC implementations of dynamicCall and vmNativeCall.  In
particular, the first stack slot used to hold a parameter depends on
the sizes and types of the preceding parameters which are passed in
registers.
2011-03-15 17:20:44 -06:00
Joel Dice
93b3d3d8a6 fix IpPromise::resolved
This method was returning true when it shouldn't have, and this led to
an assertion failure when we actually tried to get the promise's
value.
2011-03-15 17:17:26 -06:00
Joel Dice
78790a0f68 fix OpenJDK JCE support
This primarily required additions to classpath-openjdk.cpp to
intercept ZipFile, ZipEntry, and JarFile native methods to consult
embedded encryption policy jars when required.
2011-03-04 16:55:31 -07:00
Joel Dice
874890e317 assert exception parameter is not null in throw_ 2011-03-04 16:01:50 -07:00
Joel Dice
8fb9523de5 don't try to print null exception trace in printTrace
It is possible to create an Exception with no stack trace by
overriding Throwable.fillInStackTrace, so we can't assume any given
instance will have one.
2011-03-04 15:58:10 -07:00
Joel Dice
4db79b9be6 implement various sun.misc.Unsafe and JVM_* methods 2011-03-02 08:35:45 -07:00
Joel Dice
fc45cf767b implement JNIEnv::GetSuperclass; use vm::run in JNIEnv::GetObjectClass 2011-03-02 08:29:44 -07:00
Joel Dice
6d3975adb7 fix OS X PowerPC continuations=true build regression 2011-03-01 12:06:35 -07:00
Joel Dice
bb4be4de7e fix Linux/PowerPC continuations=true build 2011-03-01 11:24:44 -07:00
Joel Dice
30feba8b56 fix PowerPC tails=true stack undwinding 2011-03-01 11:01:13 -07:00
Joel Dice
8f519531d4 UseFramePointer should always be true on PowerPC
The Apple and SYSV ABIs specify that the stack/frame pointer is always
saved at the tip of the stack.
2011-03-01 10:59:00 -07:00
Joel Dice
7ad59731c0 reserve register 2 for system use on Linux/PowerPC
The SYSV ABI specifies that it be reserved.  In practice, it is used
for thread-local storage.
2011-02-28 16:48:58 -07:00
Joel Dice
25f1a9f1e8 fix Thread::exit/Thread::dispose race condition
There was a race between these two functions such that one thread A
would run dispose on thread B just before thread B finishes exit, with
the result that Thread::lock and/or Thread::systemThread would be
disposed twice, resulting in a crash.
2011-02-28 10:14:01 -07:00
Joel Dice
255fc9f9d3 handle long conditional immediate branches properly on PowerPC
Due to encoding limitations, the immediate operand of conditional
branches can be no more than 32KB forward or backward.  Since the
JIT-compiled form of some methods can be larger than 32KB, and we also
do conditional jumps to code outside the current method in some cases,
we must work around this limitation.

The strategy of this commit is to provide inline, intermediate jump
tables where necessary.  A given conditional branch whose target is
too far for a direct jump will instead point to an unconditional
branch in the nearest jump table which points to the actual target.

Unconditional immediate branches are also limited on PowerPC, but this
limit is 32MB, which is not an impediment in practice.  If it does
become a problem, we'll need to encode such branches using multiple
instructions.
2011-02-27 23:03:13 -07:00
Joel Dice
5f50226ae0 enable Linux/PowerPC cross build 2011-02-27 22:54:59 -07:00
Joel Dice
039916b519 fix incorrect offset in compile-powerpc.S 2011-02-26 17:08:08 -07:00
Joel Dice
9e1ee7e974 enable Linux PowerPC build 2011-02-26 12:45:22 -07:00
Joel Dice
a4c4d54cdd restore MyThread::ip in MyThread::CallTrace destructor
This is necessary to ensure we can unwind the stack properly on ARM
after returning from a recursive invocation of vmInvoke.
2011-02-25 11:04:23 -07:00
Joel Dice
42fd021acf various fixes for running Tomcat on the OpenJDK build 2011-02-25 08:17:15 -07:00
Joel Dice
f1255c8fd8 use pthread_sigmask instead of sigprocmask to unblock signals
Apparently, the behavior of the latter is undefined in multithreaded
processes.
2011-02-25 08:13:25 -07:00
Joel Dice
cd3d1800c4 fix return of double values from Java to native code on ARM 2011-02-22 19:46:15 -07:00
Joel Dice
6025ba736e fix return of double values from Java to native code on PowerPC 2011-02-22 19:16:54 -07:00
Joel Dice
8b9cdc13ba fix return of double values from Java to native code on x86_32 2011-02-22 19:13:38 -07:00
Joel Dice
783c6092af remove dead break statement from translateInvokeResult 2011-02-22 19:12:41 -07:00
Joel Dice
45674efcea implement JVM_SetSockOpt and Unsafe.getLongVolatile 2011-02-22 18:37:42 -07:00
Joel Dice
bead78d982 wrap primitive return values using correct types in Method.invoke
The VM uses Integer and Long instances internally to wrap the results
of dynamic method invocations, but Method.invoke should use the
correct, specific type for the primitive (e.g. Character for char).
2011-02-22 17:54:56 -07:00
Joel Dice
d520514a87 add support for Class-Path manifest attribute
This attribute, found in some JAR manifests, indicates additional JARs
and/or directories to append to the classpath.  Tomcat in particular
uses it.
2011-02-21 16:05:28 -07:00
Joel Dice
addaf09aa3 use run function to call boot in JNI_CreateJavaVM
boot may throw an exception, which we can't allow to propagate beyond
the JNI_CreateJavaVM call.
2011-02-21 16:00:20 -07:00
Joel Dice
e20daca297 use link register to determine return address when appropriate in getStackTrace
On PowerPC and ARM, we can't rely on the return address having already
been saved on the stack on entry to a thunk, so we must look for it in
the link register instead.
2011-02-21 15:25:52 -07:00
Joel Dice
20f4510122 fix ARM stack unwinding (part 2)
My previous attempt at this was incomplete; it did not address
Java->native->Java->native call sequences, nor did it address
continuations.  This commit takes care of both.
2011-02-20 13:49:40 -07:00
Joel Dice
98e74f66e9 fix compile-arm.S's vmJumpAndInvoke 2011-02-20 20:30:56 +00:00
Joel Dice
ab3929d411 fix PowerPC and ARM bootimage builds
This requires reducing HeapCapacity and CodeCapacity back to 128MB and
30MB respectively.  I had set them to larger values to test
non-ProGuard'ed OpenJDK bootimage builds, which naturally needed a lot
more space.  However, such builds aren't really useful in the real
world, and the compiler currently can't handle jumps or calls spanning
more than the maximum size of an immediate branch offset on ARM or
PowerPC, so I'm lowering them back down to more realistic values.
2011-02-20 05:59:36 +00:00
Joel Dice
45a2469672 abort if allocation fails in heap.cpp's allocate 2011-02-20 05:59:13 +00:00
Joel Dice
8a88c6ee3c fix ARM stack unwinding
We can't rely on the C++ compiler to save the return address in a
known location on entry to each function we might call from Java
(although GCC 4.5 seems to do so consistently, which is why I hadn't
realized the unwinding code was relying on that assumption), so we
must store it explicitly in MyThread::ip in each thunk.  For PowerPC
and x86, we continue saving it on the stack as always, since the
calling convention guarantees its location relative to the stack
pointer.
2011-02-19 20:52:14 -07:00
Joel Dice
b2268143f5 preserve statck alignment in arm.S's vmRun 2011-02-20 02:48:56 +00:00
Joel Dice
5524b9a5a3 fix OS X 10.4 build
pthread_mach_thread_np is not declared in pthread.h on OS X unless
_XOPEN_SOURCE and _POSIX_C_SOURCE are undefined.
2011-02-19 14:36:48 -07:00
Joel Dice
00307b9b30 fix Mac OS MySystem::visit and MySystem::Thread::interrupt implementations
On Mac OS, signals sent using pthread_kill are never delivered if the
target thread is blocked (e.g. acquiring a lock or waiting on a
condition), so we can't rely on it and must use the Mach-specific
thread execution API instead to implement Thread.getStackTrace.

For Thread.interrupt, we must not only use pthread_kill but also
pthread_cond_signal to ensure the thread is woken up.
2011-02-19 14:20:02 -07:00
Joel Dice
2ce549d3f8 fix GC safety bug in jvmGetClassInterfaces 2011-02-19 14:07:45 -07:00
Joel Dice
59183c7821 fix subroutine stack mapping bug leading to crashes during GC
The stack mapping code was broken for cases of stack slots being
reused to hold primitives or addresses within subroutines after
previously being used to hold object references.  We now bitwise "and"
the stack map upon return from the subroutine with the map as it
existed prior to calling the subroutine, which has the effect of
clearing map locations previously marked as GC roots where
appropriate.
2011-02-16 14:29:57 -07:00
Joel Dice
0bbd11e9be return false if javaThread is null in Thread::Runnable::interrupted
This field may be null if the thread is in the process of being
attached to the VM.
2011-02-15 21:44:27 -07:00
Joel Dice
86c48f3ff6 handle null p->javaThread in addThread and removeThread
These functions may be called when p->javaThread is null, in which
case we must not try to set the threadPeer field.
2011-02-15 08:47:48 -07:00
Joel Dice
6461e0a1af fix SetEvent assert
SetEvent returns nonzero on success, so the assert was backwards.
2011-02-14 18:57:47 -07:00
Joel Dice
6e19f4dcca use vmRun to execute implementations of JVM_MonitorWait/Notify/NotifyAll
These methods can all throw exceptions, so they must be run using
vmRun to avoid unwinding past the JVM entry points.
2011-02-14 18:55:11 -07:00
Joel Dice
468edb97d2 work around GCC name mangling bug
It seems that older versions of GCC (4.0 and older, at least) generate
assembly files with duplicate symbols for function templates which
differ only by the attributes of the templated types.  Newer versions
have no such problem, but we need to support both, hence the
workaround in this commit of using a dedicated, non-template "alias"
function where we previously used "cast<alias_t>".
2011-02-14 11:47:59 -07:00
Joel Dice
2e0770b0f3 fix MSVC build
MSVC doesn't support __attribute__((__packed__)), but both it and GCC
support pack pragmas, so that's what we'll use.
2011-02-14 08:48:44 -07:00
Joel Dice
8d50d0fd76 fix aliasing bug in util.cpp
We use a template function called "cast" to get raw access to fields
in in the VM.  In particular, we use this function in util.cpp to
treat reference fields as intptr_t fields so we can use the least
significant bit as the red/black flag in red/black tree nodes.
Unfortunately, this runs afoul of the type aliasing rules in C/C++,
and the compiler is permitted to optimize in a way that assumes such
aliasing cannot occur.  Such optimization caused all the nodes in the
tree to be black, leading to extremely unbalanced trees and thus slow
performance.

The fix in this case is to use the __may_alias__ attribute to tell the
compiler we're doing something devious.  I've also used this technique
to avoid other potential aliasing problems.  There may be others
lurking, so a complete audit of the VM might be a good idea.
2011-02-11 21:57:27 -07:00
Joel Dice
cb7dc1aeef fix various regressions due to 0.5 work 2011-02-11 21:13:11 -07:00
Joel Dice
eae79fdb34 clean up MINIDUMP_EXCEPTION_INFORMATION mess in windows.cpp
The last two commits were meant to work around a supposed bug in
mingw-w64's dbghelp.h, but closer inspection reminded me that we're
not using dbghelp.h at all; legacy mingw doesn't have it, so we had to
declare the structures we needed ourselves based on the MSDN
documentation.  What that documentation doesn't mention is that
MINIDUMP_EXCEPTION_INFORMATION is subject to a special, packed layout,
which we must represent using the __packed__ attribute.
2011-02-11 17:18:53 -07:00
Joel Dice
5c88f77412 fix aliasing warning introduced in last commit 2011-02-10 13:33:21 -07:00
Joel Dice
8e57639ff5 use packed version of MINIDUMP_EXCEPTION_INFORMATION
dbghelp.dll expects that MINIDUMP_EXCEPTION_INFORMATION has a packed
layout and will crash if it doesn't (at least on 64-bit systems), but
as of this writing mingw-w64's version is not declared to be so.
Hence this workaround.
2011-02-10 11:54:00 -07:00
Joel Dice
b72473f651 ensure stack alignment in powerpc.S's vmRun 2011-02-07 19:44:59 -07:00
Joel Dice
a63909b818 update VA_LIST definition for various platforms
Apparently, 64-bit Linux and OS X are the only ones where we must
define VA_LIST(x) as (x) instead of (&x).
2011-02-07 16:28:17 -07:00
Joel Dice
6e79e98d18 increase default stack size to 128KB
64KB was too small for many apps.  SWT in particular can use a lot of
stack space, especially on 64-bit systems.
2011-02-07 11:45:39 -07:00
Joel Dice
12ab935597 fix 32-bit vmRun stack alignment 2011-02-02 16:06:09 -07:00
Joel Dice
85bd36c75a fix 64-bit Windows implementation of vmRun 2011-02-02 15:34:18 -07:00
Joel Dice
cdb75ef6d7 define VA_LIST(x) (&x) on Windows
Each platform and architecture defines the va_list type differently;
on some we can treat it as a pointer and on others we must treat it as
a non-pointer.  Turns out Windows is one of the latter.
2011-02-02 15:11:34 -07:00
Joel Dice
51a1081adc remove unused Heap::Client::outOfMemory method
The heap-dump-on-OOM feature has been moved to the collect function.
2011-02-02 08:46:20 -07:00
Joel Dice
4d5aeb5ab2 disable debug logging in compile.cpp 2011-02-02 08:32:40 -07:00
Joel Dice
cce89c8ddd fix MSVC build 2011-02-02 08:15:25 -07:00
Joel Dice
ac49eb8c9a return empty array instead of null from interpret.cpp's getStackTrace
This avoids a crash elsewhere when we try to use the result.
2011-02-01 19:51:00 -07:00
Joel Dice
79247a9885 ensure native method frame always popped in interpret.cpp's invokeNative
If a native method using the fast calling convention throws an
exception, we need to make sure the frame for that method is popped
before handling the exception.
2011-02-01 19:23:25 -07:00
Joel Dice
aa9c887fb4 implement Thread.yield 2011-02-01 18:14:32 -07:00
Joel Dice
9ef9d9619d avoid deadlock due to entering active state before running destroyJavaVM
We risked deadlock when waiting for other non-daemon threads to exit
since they could not exit without entering exclusive state, which
required waiting for all other threads to go idle.
2011-02-01 17:45:43 -07:00
Joel Dice
132f188ff0 fix cut-and-paste error in jnienv.cpp
release0 should call release, not acquire.
2011-02-01 14:23:53 -07:00
Joel Dice
78a80534e6 ensure stack remains aligned in compile-x86.S
If AVIAN_USE_FRAME_POINTER is not defined, the caller of vmInvoke will
calculate a frame size which assumes vmInvoke does not push rbp on the
stack before allocating the frame.  However, vmInvoke pushes rbp
reguardless, so we need to adjust the frame size to ensure the stack
remains aligned.
2011-02-01 11:01:28 -07:00
Joel Dice
8ed2bb9dbb remove FrameEvent code from x86.cpp
That code was unused and will be unecessary until we add proper
support for unwinding through tail calls in nextFrame, at which point
it may be reinstated in some form.
2011-02-01 08:38:59 -07:00
Joel Dice
635f5ba7e6 avoid garbage collection from e.g. divideLong thunk
It is dangerous to initiate a GC from a thunk like divideLong (which
was possible when allocating a new ArithmeticException to signal
divide-by-zero) since we don't currently generate a GC root frame map
for the return address of the thunk call.  Instead, we use the backup
heap area if there is room, or else throw a pre-allocated exception
instead.
2011-01-31 21:18:55 -07:00
Joel Dice
2a5e556e09 Merge branch 'master' into r0.5 2011-01-31 15:54:46 -07:00
Joel Dice
9ed1ffff35 implement syncInstructionCache for ARM
Like, PowerPC, ARM has an instruction cache which must be manually
flushed if/when we compile a new method.  This commit updates
syncInstructionCache to use GCC's builtin __clear_cache routine.
2011-01-31 15:39:59 -07:00
Joel Dice
69501a05b8 remove UNUSED modifier from parameter which is now used 2011-01-30 19:29:53 -07:00
Joel Dice
309c1cac6d fix PowerPC tails and continuations builds 2011-01-30 19:11:23 -07:00
Joel Dice
8a46ee92b4 use thunks for integer division on PowerPC
PowerPC doesn't generate traps for divides-by-zero, so we defer to
thunks which do explicit checks.
2011-01-30 14:28:02 -07:00
Joel Dice
fff51bad06 more progress on PowerPC build
Also, hide frame mapping for stack unwinding (which is still
incomplete) in x86.cpp, since no other platform needs it.
2011-01-30 14:14:57 -07:00
Joel Dice
1187613ad0 partial fix for PowerPC build 2011-01-29 20:04:29 -07:00
Joel Dice
8064b702c0 use parentheses around VA_LIST value in x86.h 2011-01-29 20:03:28 -07:00
Joel Dice
6296350d76 fix ARM tails=true and continuations=true builds 2011-01-29 18:09:47 -07:00
Joel Dice
03f18ea00c change reinterpret_casts to static_casts in x86.cpp where appropriate 2011-01-29 18:07:52 -07:00
Joel Dice
1186413be2 debug logging tweaks in compile.cpp 2011-01-29 11:11:27 -07:00
Joel Dice
fb5c0bfebd fix ARM stack unwinding 2011-01-29 11:10:54 -07:00
Joel Dice
17449eaf1b progress towards fixing the ARM build 2011-01-28 17:16:08 -07:00
Joel Dice
cac232a84e add comments to x86.cpp 2011-01-28 17:15:57 -07:00
Joel Dice
35ae3dc391 fix mode=debug build 2011-01-28 08:43:11 -07:00
Joel Dice
740fa7ad9d fix unused parameter warnings 2011-01-27 21:10:06 -07:00
Joel Dice
f980ceb13e enable use-frame-pointer=true build
Also, include Continuations, Coroutines, and DynamicWind tests in test
suite for continuations=true build.
2011-01-27 21:06:01 -07:00
Joel Dice
b47dfdf5bd remove debug logging 2011-01-27 21:05:22 -07:00
Joel Dice
e4e0015005 fix GC safety issue in bootimage.cpp 2011-01-27 21:03:39 -07:00
Joel Dice
b7157c802a fix continuations=true build 2011-01-27 11:54:41 -07:00
Joel Dice
5cedcf7833 remove unnecessary exception checks from bootimage.cpp 2011-01-27 11:53:53 -07:00
Joel Dice
e16d5f83af Merge remote branch 'origin/master' into r0.5 2011-01-25 17:30:21 -07:00
Joel Dice
c1a0d8b6fc more work on frame-pointer-less unwinding
This fixes the tails=true build (at least for x86_64) and eliminates
the need for a frame table in the tails=false build.  In the
tails=true build, we still need a frame table on x86(_64) to help
determine whether we've caught a thread executing code to do a tail
call or pop arguments off the stack.  However, I've not yet written
the code to actually use this table, and it is only needed to handle
asynchronous unwinds via Thread.getStackTrace.
2011-01-25 17:22:43 -07:00
Joel Dice
220f7760b7 fix MSVC build regressions 2011-01-21 16:14:21 -07:00