Commit Graph

17 Commits

Author SHA1 Message Date
Joel Dice
a7e86e6cd4 implement Unsafe.{get|put}*Volatile 2014-03-31 17:31:28 -06:00
Joel Dice
c0d178d5f1 implement ConcurrentHashMap and AtomicReferenceArray
This is the simplest possible ConcurrentHashMap I could come up with
that works and is actually concurrent in the way one would expect.
It's pretty unconventional, being based on a persistent red-black
tree, and not particularly memory-efficient or cache-friendly.  I
think this is a good place to start, though, and it should perform
reasonably well for most workloads.  Patches for a more efficient
implementation are welcome!

I also implemented AtomicReferenceArray, since I was using it in my
first, naive attempt to implement ConcurrentHashMap.

I had to do a bit of refactoring, including moving some non-standard
stuff from java.util.Collections to avian.Data so I could make it
available to code outside the java.util package, which is why I had to
modify several unrelated files.
2014-03-12 10:44:24 -06:00
Joel Dice
0a89683eff move Unsafe.get{Object|Int}Volatile from classpath-openjdk.cpp to builtin.cpp
This makes them available in all class libraries, not just the OpenJDK
library.  Note that I've also removed the unecessary idle statements,
per ab4adef.
2014-03-03 14:55:49 -07:00
Joel Dice
789c36a459 move Unsafe.putObjectVolatile and putOrderedObject implementations
This makes them available to all class libraries, not just OpenJDK.
2014-01-02 18:00:53 -07:00
Joel Dice
cc5b58725a implement Unsafe.putOrderedLong and putVolatileLong
The former just defers to the latter for now, since it provides
strictly weaker guarantees.  Thus it's correct to use full
volatile-style barriers, though not as efficient as it could be on
some architectures.
2014-01-02 17:49:56 -07:00
Joel Dice
15906ddb12 fix build regression on platforms with no native 64-bit CAS
Unsafe.compareAndSwapLong was moved from classpath-openjdk.cpp to
builtin.cpp, but the fieldForOffset helper function was not, which
only caused problems when I tried to build for ARM.  This commit moves
said helper function, along with Unsafe.getVolatileLong, which also
uses it.
2013-12-18 11:06:15 -07:00
Simon Ochsenreither
55e9923ee6 Move Unsafe.compareAndSwapLong from ...
... classpath-openjdk.cpp to builtin.cpp.
2013-12-18 05:19:45 +01:00
Joshua Warner
47a7732a81 add jdk-test target, and fix failures
The intent of this target is to run our test suite against the installed jre.
This should help prevent our VM from diverging in implementation from the jdk.

The remainder of this commit fixes the problems that this exposes.
2013-12-06 15:00:02 -07:00
Joshua Warner
8cda2446d5 implement sun.misc.Unsafe.throwException 2013-12-05 20:28:08 -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
4e12847858 code rearrangment to improve state of Android libcore tests
This mainly moves several sun.misc.Unsafe method implementations from
classpath-openjdk.cpp to builtin.cpp so that the Avian and Android
builds can use them.

It also replaces FinalizerReference.finalizeAllEnqueued with a no-op,
since the real implementations assumes too much about how the VM
handles (or delegates) finalization.
2013-04-23 13:47:15 -06:00
Joel Dice
d414fd4c7b more progress on Android class library port
Hello.java works.  Yay.
2013-02-20 10:22:40 -07: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
c4722fa843 update Unsafe.setMemory to reflect new OpenJDK 7 signature and semantics 2012-03-14 11:54:03 -06:00
Joel Dice
756f58210a add test for sun.misc.Unsafe functionality 2012-03-13 08:28:33 -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
d819a75f36 more work towards OpenJDK classpath support
The biggest change in this commit is to split the system classloader
into two: one for boot classes (e.g. java.lang.*) and another for
application classes.  This is necessary to make OpenJDK's security
checks happy.

The rest of the changes include bugfixes and additional JVM method
implementations in classpath-openjdk.cpp.
2010-09-14 10:49:41 -06:00