Commit Graph

2141 Commits

Author SHA1 Message Date
Joel Dice
a31ae24005 Merge branch 'wip' 2010-05-03 16:32:40 -06:00
Joel Dice
d236a3b78c Merge branch 'master' of oss.readytalk.com:/var/local/git/avian 2010-04-27 08:38:16 -06:00
Eric Scharff
9909c0cec3 Fix Mac OS X specific path bug
In Mac OS X, if a path contains a space, the path of the main executable
will contain a special URL-encoded character (%20 in this case).  This
probably happens when any non-ASCII character is provided.

The fix is to use CFURLCreateStringByReplacingPercentEscapes which
creates a path that the POSIX API likes better.
2010-04-26 10:24:53 -06:00
JET
3aac50555b fixed ARM interpreted-mode regression 2010-04-20 15:51:35 -06:00
JET
1ea2a3a6dc Merge branch 'wip' of oss.readytalk.com:/var/local/git/avian into wip 2010-04-20 10:04:47 -06:00
JET
c666ab58e3 Improved (should now be complete) Unicode support (UTF-8 for *nix and UTF-16 for Windows). 2010-04-20 10:03:07 -06:00
Joel Dice
e5fad03632 fix MSVC build rot 2010-04-15 11:11:10 -06:00
JET
b6936fb597 optimized InputStreamReader.read() 2010-04-14 09:43:56 -06:00
JET
34f51114a1 Merge branch 'master' into wip 2010-04-14 09:27:24 -06:00
JET
b2f5e71d22 ARM and UTF-8 work 2010-04-14 09:26:50 -06:00
Joel Dice
03ec9e6f19 Merge branch 'master' into wip 2010-04-14 09:22:42 -06:00
Joel Dice
a650f1affa provide more useful message when throwing exception from Field.set 2010-03-07 12:03:17 -07:00
Joel Dice
3e5b2cbc7b fix miscompilation of 64-bit volatile field reads and writes on x86_32
We were generating code which clobbered the data we were putting into
64-bit volatile fields (and potentially also clobbering the target or
source object in the case of non-static fields) due to misplaced
synchronization code.  Reordering this code ensures that both the data
and the target or source survive across calls to synchronization
helper functions.
2010-03-01 18:24:25 -07:00
Joel Dice
fdf9c5087b register socket with exceptfds when calling select on Windows
This allows us to get connection errors like WSAECONNREFUSED in
non-blocking mode.
2010-02-19 16:41:27 -07:00
Hudson Build Application account
48cc14f8ed fixed linux build because darwin fix broke it 2010-02-05 17:15:12 -07:00
Matt Klich
103717a3f2 Merge branch 'master' of ssh://oss.readytalk.com/var/local/git/avian 2010-02-05 16:43:02 -07:00
Matt Klich
d4cae8f15e Fixed darwin build. 2010-02-05 16:40:48 -07:00
Joel Dice
c2a9424f91 implement compileTimeMemoryBarrier in arch.h
This has the same implementation as programOrderMemoryBarrier in
x86.h, but makes it available on all architectures.
2010-02-04 18:30:13 -07:00
Joel Dice
99bb7924b0 fix stack frame mapping code for exception handlers
Previously, the stack frame mapping code (responsible for statically
calculating the map of GC roots for a method's stack frame during JIT
compilation) would assume that the map of GC roots on entry to an
exception handler is the same as on entry to the "try" block which the
handler is attached to.  Technically, this is true, but the algorithm
we use does not consider whether a local variable is still "live"
(i.e. will be read later) when calculating the map - only whether we
can expect to find a reference there via normal (non-exceptional)
control flow.  This can backfire if, within a "try" block, the stack
location which held an object reference on entry to the block gets
overwritten with a non-reference (i.e. a primitive).  If an exception
is later thrown from such a block, we might end up trying to treat
that non-reference as a reference during GC, which will crash the VM.

The ideal way to fix this is to calculate the true interval for which
each value is live and use that to produce the stack frame maps.  This
would provide the added benefit of ensuring that the garbage collector
does not visit references which, although still present on the stack,
will not be used again.

However, this commit uses the less invasive strategy of ANDing
together the root maps at each GC point within a "try" block and using
the result as the map on entry to the corresponding exception
handler(s).  This should give us safe, if not optimal, results.  Later
on, we can refine it as described above.
2010-02-04 18:03:32 -07:00
Joel Dice
c9b9db1621 reimplement Java object monitors (second try)
See commit 8120bee4dc for the original
problem description and solution.  That commit and a couple of related
ones had to be reverted when we found they had introduced GC-safety
regressions leading to crashes.

This commit restores the reverted code and fixes the regressions.
2010-02-04 17:56:21 -07:00
Matt Klich
9d5e0bb154 Updated to always specify bitness of target. cc and cxx will always have -m32 or -m64 appended based on the arch that is being built. 2010-02-04 11:15:16 -07:00
Joel Dice
48834be209 revert recent commits to reimplement Java object monitors
We're seeing race conditions which occasionally lead to assertion
failures and thus crashes, so I'm reverting these changes for now:

29309fb414
e92674cb73
8120bee4dc
2010-02-04 08:18:39 -07:00
Joel Dice
29309fb414 update Thread field offsets to reflect recent additions
Every time we add or remove fields to Thread, we need to update the
assembly code to reflect the new offsets.
2010-02-02 12:26:09 -07:00
Joel Dice
e92674cb73 fix race condition in monitorWait
We don't want to check Thread::waiting until we have re-acquired the
monitor, since another thread might notify us between releasing
Thread::lock and acquiring the monitor.
2010-02-02 12:24:05 -07:00
Joel Dice
3bc37d6e2a fix encoding of single byte register-to-memory moves on x86_64
We need to prefix instructions of the form "mov R,M" with a REX byte
when R is %spl, %bpl, %sil, or %dil.  Such moves are unencodable on
32-bit x86, and, because of the order in which we pick registers,
pretty rare on 64-bit systems, which is why this took so long to
notice.
2010-02-02 11:37:08 -07:00
Joel Dice
5d781a0584 declare Long.MAX_VALUE and Long.MIN_VALUE as longs, not Longs 2010-02-02 09:33:10 -07:00
Joel Dice
8120bee4dc reimplement Java object monitors to avoid running out of OS handles
Due to SWT's nasty habit of creating a new object monitor for every
task added to Display.asyncExec, we've found that, on Windows at
least, we tend to run out of OS handles due to the large number of
mutexes we create between garbage collections.

One way to address this might be to trigger a GC when either the
number of monitors created since the last GC exceeds a certain number
or when the total number of monitors in the VM reaches a certain
number.  Both of these risk hurting performance, especially if they
force major collections which would otherwise be infrequent.  Also,
it's hard to know what the values of such thresholds should be on a
given system.

Instead, we reimplement Java monitors using atomic compare-and-swap
(CAS) and thread-specific native locks for blocking in the case of
contention.  This way, we can create an arbitrary number of monitors
without creating any new native locks.  The total number of native
locks needed by the VM is bounded instead by the number of live
threads plus a small constant.

Note that if we ever add support for an architecture which does not
support CAS, we'll need to provide a fallback monitor implementation.
2010-02-01 18:40:47 -07:00
Joel Dice
45476eb591 fix handling of volatile longs and doubles on PowerPC
We were miscompiling methods which contained getfield, getstatic,
putfield, or putstatic instructions for volatile 64-bit primitives on
32-bit PowerPC due to not noticing that values in registers are clobbered
across function calls.

The solution is to create a separate Compiler::Operand instance for each
object monitor reference before and after the function call to avoid
confusing the compiler.  To avoid duplicate entries in the constant pool,
we add code look for and, if found, reuse any existing entry for the same
constant.
2010-01-27 17:46:04 -07:00
Joel Dice
2868413b51 preserve exception classes from obfuscation in vm.pro
We preserve from obfuscation by ProGuard any class of exception thrown
from either the VM or native class library code.
2010-01-27 13:44:02 -07:00
Joel Dice
bdeb61fc99 fix grammar in readme.txt 2010-01-15 08:25:06 -07:00
jet
b33219cc7d Merge branch 'wip' of oss.readytalk.com:/var/local/git/avian into wip 2010-01-11 10:39:37 -07:00
Joel Dice
2c4e229e6e convert forward slashes to back slashes in Windows paths 2010-01-11 08:31:01 -07:00
Joel Dice
b1a1391093 skip "." and ".." in File.list{Files} to match Sun 2010-01-09 19:18:39 -07:00
Joel Dice
585dba004b ignore redundant calls to File{In|Out}putStream.close
Previously, we threw an IOException, which did not match Sun's behavior.
2010-01-09 18:22:16 -07:00
Joel Dice
9a056da2f7 increase default buffer size in BufferedInputStream
The previous value of 32 bytes did not perform well.  This increases it to 4096 bytes, which matches BufferedOutputStream.
2010-01-09 18:20:15 -07:00
jet
ea4b4bfcbf Merge branch 'wip' of oss.readytalk.com:/var/local/git/avian into wip 2010-01-06 10:57:55 -07:00
Joel Dice
3686d2131d fix jsr/ret code generation bug
We were generating code to marshal values into place prior to a jump,
but placing it after the jump instruction, which made it useless.
2010-01-04 17:17:16 -07:00
Joel Dice
20f92bbd05 specify java.home system property in GNU Classpath build
Currently, we just set this to /tmp (or the equivalent) since Avian
doesn't really have a home.  This avoids a NullPointerException from
javax/xml/parsers/SAXParserFactory.
2010-01-04 17:14:00 -07:00
jet
8c8020811a Merge branch 'wip' of oss.readytalk.com:/var/local/git/avian into wip 2009-12-28 11:14:26 -07:00
Joel Dice
664cb3cd39 don't try to parse annotation tables more than once; use defining classloader when loading array classes during linking 2009-12-24 17:58:48 -07:00
Joel Dice
805d1d13d8 mark system classloader initialized when using GNU Classpath to avoid security exceptions; only look for field in interfaces after looking in class and superclasses 2009-12-24 17:57:07 -07:00
Joel Dice
40c65f66bf add (commented-out) debug logging to gnu.cpp 2009-12-24 17:54:02 -07:00
Joel Dice
7b2322e7f7 accept any source site in resolveTargetSites, whether it matches the next read or not 2009-12-24 17:47:58 -07:00
jet
77990b9489 Merge branch 'wip' of oss.readytalk.com:/var/local/git/avian into wip 2009-12-23 09:26:17 -07:00
Joel Dice
f588a62ae3 fix Classpath 0.98 compatibility issues 2009-12-22 21:34:04 -07:00
Joel Dice
30db38ebd6 replace calls to ExceptionOccurred with calls to ExceptionCheck
The latter is cheaper (avoids a state transition and possible memory
allocation) when we just want to know if an exception is thrown
without needing a handle to that exception.
2009-12-16 19:25:03 -07:00
Joel Dice
4c0ede8b9a reuse JNI references when possible
Before allocating a new reference in NewGlobalReference or when
creating a local reference, we look for a previously-allocated
reference pointing to the same object.  This is a linear search, but
usually the number of elements in the reference list is small, whereas
the memory, locking, and allocation overhead of creating duplicate
references can be large.
2009-12-16 19:16:51 -07:00
Joel Dice
70da0df46b add Class.getExceptionTypes method 2009-12-15 10:04:51 -07:00
Joel Dice
7cf25a0fc3 fix process=interpret build 2009-12-14 18:01:28 -07:00
Joel Dice
67cdac3a36 tweak MSVC compiler flags
We now use -O2 for the "fast" build and always pass -debug to the linker so we get a PDB file.
2009-12-14 08:43:07 -07:00