Commit Graph

2741 Commits

Author SHA1 Message Date
Joel Dice
1127cb6452 fix unsigned->size_t build regression 2015-05-04 09:59:49 -06:00
Joel Dice
3b9089e265 Merge pull request #431 from joshuawarner32/all-heapdump
Always include heapdump code
2015-05-04 08:01:03 -06:00
joshuawarner32@gmail.com
1f6e7be3b0 fix openjdk build after finder size_t change
I'm not sure how we didn't catch this when merging #425, but there you are.
2015-05-03 13:25:22 -06:00
joshuawarner32@gmail.com
6be30bdaf6 always include heapdump code, to eliminate one dimension of the build matrix 2015-05-01 20:11:11 -06:00
Joshua Warner
fa63bce14d don't use x18 on arm64, where it's a reserved 'platform' register 2015-05-01 13:44:44 -06:00
Joshua Warner
1290fda6a8 fix new clang warnings (from upgrading clang) 2015-05-01 13:44:21 -06:00
Joshua Warner
1fcc097344 use size_t instead of unsigned in a bunch of appropriate places
This would theoretically break compatibility with apps using embedded
classpaths, on big-endian architectures - because of the size type
extension.  However, we don't currently support any big-endian
architectures, so it shouldn't be a problem.
2015-03-16 16:28:20 -06:00
Joel Dice
cbde34620c update copyright years 2015-03-13 12:52:59 -06:00
Joel Dice
dc7e68708f add JVM_GetResourceLookupCacheURLs
This improves support for building with openjdk=$jdk8.  Note, however,
that the Processes test does not pass, since JDK 8's
java.lang.UNIXProcess uses invokedynamic, which Avian does not yet
support.
2015-03-12 10:52:17 -06:00
Joel Dice
6c7ff9874e handle arbitrary class sizes in type-generator/main.cpp
OpenJDK 8 includes a core class (java.lang.Thread) which so many
fields that it exceeds the class size limit in type-generator dictated
by the logic responsible for calculating each class's GC object mask,
at least on 32-bit systems.  There was no fundamental need for this
limit -- it just made the code simpler.

This commit removes the above limit at the cost of slightly more
complicated code.  The original motivation for this change is that the
platform=macosx arch=i386 openjdk=$jdk8 build was failing.  However,
there doesn't seem to be a prebuild JDK 8 for 32-bit OS X anywhere on
the Internet, nor is there any obvious way to build one on a modern
Mac, so it's safe to say we won't be supporting this combination
anyway.  The problem also occurs on Linux and Windows, though,
so it needs to be fixed.
2015-03-12 10:50:03 -06:00
Joel Dice
02cfe06850 fix OpenJDK 8 class library build 2015-02-27 13:59:06 -07:00
Joel Dice
7a4cae0dde load bootstrap classes in findInterfaceMethod
In afbd4ff, I made a low-risk, but very specific fix for a more
general problem: "bootstrap" classes (i.e. classes which the VM has
built-in knowledge of) need to be loaded from the classpath before any
of their methods are called.  Based on recent testing, I found there were
more cases than I previously thought where the VM tries to call methods on
"unloaded" bootstrap classes, so we needed a more general solution to
the problem.

This commit addresses it by closing the last (known) loophole by which
methods might be called on bootstrap classes: invokeinterface, and its
helper method findInterfaceMethod.  The fix is to check for bootstrap
classes in findInterfaceMethod and load the full versions if
necessary.  This process may lead to garbage collection and/or thrown
exceptions, which made me nervous about cases of direct or indirect
calls to findInterfaceMethod not expecting those events, which is why
I hadn't used that approach earlier.  However, it turns out there were
only a few places that made non-GC-safe calls to findInterfaceMethod,
and a bit of code rearrangement fixed that.
2015-02-06 13:51:32 -07:00
Joel Dice
c2a0210c7b fix ARM64 iOS JNI crashes
As documented at
https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html,
the ARM64 iOS ABI differs from the generic ABI in a few important
ways.  Specifically, arguments passed via the stack are aligned
according to their natural alignment instead of 8 bytes.  The VM's
dynamic call code was aligning each argument to 8 bytes, so native JNI
code couldn't find them in their expected places.

Also, we weren't setting the "os.arch" system property on ARM64, so I
fixed that too.
2015-02-05 17:20:53 -07:00
Joel Dice
afbd4ff303 fix crash when calling Class.getDeclaredMethods using the OpenJDK class library
This method ends up defering to JVM_GetClassDeclaredMethods, which
creates an array of java.lang.reflect.Method instances and then
calling getName on each one through the java.lang.reflect.Member
interface.  However, Method is a "bootstrap" class, meaning the VM has
built-in knowledge of it and includes a tentative version built-in but
must load the real version from the classpath at runtime before
invoking methods on it.  Normally this happens naturally when Method
instances are created in Java code, but here we're creating them in
the VM instead, which doesn't automatically cause the real class to be
loaded.  So we must do so explicitly.
2015-01-22 12:02:28 -07:00
Joel Dice
bbd4c58f91 align stack size for vmNativeCall to 16 on ARM
The ARM64 ABI(s) require this, and it doesn't hurt to do it on 32-bit
ARM as well.
2015-01-21 14:10:25 -07:00
Joel Dice
df0085ada5 use unconditional branch to stack overflow thunk on ARM64
On ARM64, conditional branches to immediate offsets can span no more
than 2^19 instructions.  In the case of the stack overflow check,
which wants to do a conditional branch from every non-leaf method to a
handler, this can be a problem, especially when compiled code grows
large as with a bootimage=true build against the OpenJDK class
library.  Therefore, we use an unconditional branch to reach the
handler on this platform.
2015-01-20 16:54:29 -07:00
Joel Dice
8ee7e8124a fix broken interpreter build due to out-of-order class initialization
When we initialize the vtables for bootstrap Java classes such as
java.lang.NullPointerException (i.e. classes which the VM has built-in
knowledge of), we assign the superclass's vtable to any class which
has no declared virtual methods of its own.  However, that vtable will
be null if we haven't initialized the superclass yet.  Therefore, we
must order this process such that no class is initialized until after
all its superclasses.
2015-01-15 17:13:46 -07:00
Joel Dice
4509e29abb fix method interception bug
When we intercept a method (i.e. when the VM wants to run its own code
instead of whatever the classpath provides for that method), we make a
clone of the original method so we can later call it from the
intercepting code if appropriate.  We also set the ACC_NATIVE flag on
the original method to ensure that our intercepting code is always
used in preference to the classpath version.  However, we need to set
that flag *after* we make the clone, or else the clone will also have
the ACC_NATIVE flag set, which is not what we want.

We never noticed this before because classpath versions of all the
methods we intercept as of Java 7 are either native or are never
called from their VM-specified replacements.  However, some of those
native methods are non-native in later versions of Java, so the bug
has become apparent.
2015-01-12 09:54:11 -07:00
Joshua Warner
f6e7a29f09 Merge pull request #392 from lostdj/patch-10
classpath-openjdk: Fix freeZipFileEntry()
2015-01-11 13:05:32 -07:00
Timofey Lagutin
da01d20c19 classpath-openjdk: Fix freeZipFileEntry()
Those ZipFile::Entries are part of ZipFile instance itself and will fail to free(). See :1504 and :1520 in openZipFile().
2015-01-11 22:49:15 +03:00
Timofey Lagutin
97734af72d classpath-openjdk: Fix getZipFileEntry()
'addSlash' argument was incorrectly understood: it is supposed to add slash only on retry (see ZIP_GetEntry2() zip_util.c in OpenJDK).
2015-01-11 21:44:41 +03:00
Joel Dice
80ce92a999 fix iOS ARM64 build 2014-12-30 17:03:58 -07:00
Joel Dice
c9026a6053 add continuations support for ARM64
Also, replace some preprocessor conditionals with C++ conditionals and
add some todo comments and sample code for future work towards better
ABI compatibility in the JIT compiled code.
2014-12-30 15:31:52 -07:00
Joel Dice
e3ea60fc31 fix ARM64 tails=true build 2014-12-30 09:37:26 -07:00
Joel Dice
76bfcaa8c0 fix ARM64 bootimage=true build
This fixes a problem with atomically updating JIT-compiled static
calls to AOT-compiled code.  It turns out there was also a problem
with the 32-bit ARM code as well, but we never hit it because it is
extremely unlikely that a code address can be loaded with a single
immediate load instruction on 32-bit ARM since it can only handle
numbers with 8 significant bits.  I've fixed that as well.
2014-12-29 18:17:24 -07:00
Joel Dice
8c277e2af8 conditionally compile ARM operations based on TARGET_BYTES_PER_WORD
This fixes the codegen-targets=all build regression.
2014-12-29 14:47:31 -07:00
Joel Dice
d8b32f2c67 update CMakeLists.txt to fix CMake build 2014-12-29 12:25:56 -07:00
Joel Dice
ea0a108cd2 add todo comment regarding integer division 2014-12-29 12:16:55 -07:00
Joel Dice
cdcf173601 format recent changes using clang-format 2014-12-29 12:09:53 -07:00
Joel Dice
e3f50e6d67 fix ARM64 OffsetPromise::value
I must have done a search-and-replace from 4 to TargetBytesPerWord
earlier, but in this case it should have been the instruction size
(4), not the word size.
2014-12-29 11:07:26 -07:00
Joel Dice
98a1fefefc fix offset encoding for strhi instruction 2014-12-29 10:02:30 -07:00
Joel Dice
3e2545e5a7 more ARM64 bugfixes 2014-12-29 08:02:37 -07:00
Joel Dice
67f5461d82 more ARM64 bugfixes 2014-12-24 10:05:20 -07:00
Joel Dice
85fcbb82b3 more ARM64 bugfixes 2014-12-24 08:12:36 -07:00
Joel Dice
78735b35a8 more ARM64 bugfixes, more passing tests 2014-12-23 21:09:43 -07:00
Joel Dice
cbea966d1d various ARM64 JIT bugfixes
Three of the tests now pass.  Yay!
2014-12-23 16:59:04 -07:00
Joel Dice
9158ee39c0 remove 64-bit code from compile-arm.S since it's moved to compile-arm64.S 2014-12-23 16:57:40 -07:00
Joel Dice
b519e245e2 finish implementing operations64.cpp for ARM64 support
This is totally untested so far.
2014-12-22 12:59:27 -07:00
Joshua Warner
a6e88a8faa fix some merge-introduced problems 2014-12-22 12:59:27 -07:00
Joel Dice
123570515f snapshot of ARM64 instruction encoding work
Still not building, but more progress.
2014-12-22 12:59:26 -07:00
Joshua Warner
b3bd58aeff work in progress towards 64-bit ARM JIT support
This won't build, it's just a snapshot of what I have so far.

Conflicts:
	include/avian/codegen/architecture.h
	include/avian/codegen/registers.h
	src/codegen/compiler.cpp
	src/codegen/compiler/event.cpp
	src/codegen/compiler/site.cpp
	src/codegen/compiler/site.h
	src/codegen/registers.cpp
	src/codegen/target/arm/assembler.cpp
	src/codegen/target/arm/registers.h
2014-12-22 12:59:26 -07:00
Joshua Warner
5ce8c2ed54 fix compile-arm64.S when using the apple toolchain 2014-12-10 15:22:02 -07:00
Joshua Warner
a200d4d529 pull in initial version of compile-arm64.S, to fix arm64 build (untested)
Initial implementation courtesy Joel Dice (@dicej)
2014-12-10 15:14:47 -07:00
Joshua Warner
f8b9fcf198 split asm files by architecture (x86 -> i386,x86_64 ; arm -> arm,arm64) 2014-12-10 15:14:18 -07:00
Joshua Warner
8be7b6aeb3 correct THREAD_STATE_THREAD register for arm64 on darwin 2014-12-09 16:34:46 -07:00
Joshua Warner
46e445017e make sure binary-to-object doesn't generate empty objects for invalid format/architecture combinations 2014-12-09 14:56:59 -07:00
Joshua Warner
5e0f7590d9 fix process=interpret build for 'arch=arm64 platform=ios' 2014-12-09 14:56:59 -07:00
Joshua Warner
01de3d9d5c remove lingering 32-count limits on registers, refactor iteration, improve constants, ... 2014-12-09 11:18:00 -07:00
Joshua Warner
a749ba7adc replace (int8_t)Register cast with Register::index() 2014-12-09 08:19:44 -07:00
joshuawarner32@gmail.com
d4045629d7 Remove unnecessary (int8_t) casts in arm backend 2014-12-09 08:19:44 -07:00