Merge "Only log a few types of GC causes for the blocking cases" into oc-dev
diff --git a/build/art.go b/build/art.go
index 053968d..61a9759 100644
--- a/build/art.go
+++ b/build/art.go
@@ -59,8 +59,8 @@
}
if !envFalse(ctx, "ART_USE_READ_BARRIER") && ctx.AConfig().ArtUseReadBarrier() {
- // Used to change the read barrier type. Valid values are BAKER, BROOKS, TABLELOOKUP.
- // The default is BAKER.
+ // Used to change the read barrier type. Valid values are BAKER, BROOKS,
+ // TABLELOOKUP. The default is BAKER.
barrierType := envDefault(ctx, "ART_READ_BARRIER_TYPE", "BAKER")
cflags = append(cflags,
"-DART_USE_READ_BARRIER=1",
diff --git a/compiler/driver/compiler_driver.cc b/compiler/driver/compiler_driver.cc
index 805c5da..f77b3dd 100644
--- a/compiler/driver/compiler_driver.cc
+++ b/compiler/driver/compiler_driver.cc
@@ -78,8 +78,8 @@
#include "vdex_file.h"
#include "verifier/method_verifier.h"
#include "verifier/method_verifier-inl.h"
-#include "verifier/verifier_log_mode.h"
#include "verifier/verifier_deps.h"
+#include "verifier/verifier_enums.h"
namespace art {
@@ -2132,7 +2132,7 @@
hs.NewHandle(soa.Decode<mirror::ClassLoader>(jclass_loader)));
Handle<mirror::Class> klass(
hs.NewHandle(class_linker->FindClass(soa.Self(), descriptor, class_loader)));
- verifier::MethodVerifier::FailureKind failure_kind;
+ verifier::FailureKind failure_kind;
if (klass == nullptr) {
CHECK(soa.Self()->IsExceptionPending());
soa.Self()->ClearException();
@@ -2155,7 +2155,7 @@
true /* allow soft failures */,
log_level_,
&error_msg);
- if (failure_kind == verifier::MethodVerifier::kHardFailure) {
+ if (failure_kind == verifier::FailureKind::kHardFailure) {
LOG(ERROR) << "Verification failed on class " << PrettyDescriptor(descriptor)
<< " because: " << error_msg;
manager_->GetCompiler()->SetHadHardVerifierFailure();
@@ -2163,10 +2163,10 @@
// Force a soft failure for the VerifierDeps. This is a sanity measure, as
// the vdex file already records that the class hasn't been resolved. It avoids
// trying to do future verification optimizations when processing the vdex file.
- DCHECK(failure_kind == verifier::MethodVerifier::kSoftFailure ||
- failure_kind == verifier::MethodVerifier::kNoFailure)
+ DCHECK(failure_kind == verifier::FailureKind::kSoftFailure ||
+ failure_kind == verifier::FailureKind::kNoFailure)
<< failure_kind;
- failure_kind = verifier::MethodVerifier::kSoftFailure;
+ failure_kind = verifier::FailureKind::kSoftFailure;
}
} else if (!SkipClass(jclass_loader, dex_file, klass.Get())) {
CHECK(klass->IsResolved()) << klass->PrettyClass();
@@ -2198,16 +2198,16 @@
<< " failed to fully verify: state= " << klass->GetStatus();
}
if (klass->IsVerified()) {
- DCHECK_EQ(failure_kind, verifier::MethodVerifier::kNoFailure);
+ DCHECK_EQ(failure_kind, verifier::FailureKind::kNoFailure);
} else if (klass->ShouldVerifyAtRuntime()) {
- DCHECK_EQ(failure_kind, verifier::MethodVerifier::kSoftFailure);
+ DCHECK_EQ(failure_kind, verifier::FailureKind::kSoftFailure);
} else {
- DCHECK_EQ(failure_kind, verifier::MethodVerifier::kHardFailure);
+ DCHECK_EQ(failure_kind, verifier::FailureKind::kHardFailure);
}
}
} else {
// Make the skip a soft failure, essentially being considered as verify at runtime.
- failure_kind = verifier::MethodVerifier::kSoftFailure;
+ failure_kind = verifier::FailureKind::kSoftFailure;
}
verifier::VerifierDeps::MaybeRecordVerificationStatus(
dex_file, class_def.class_idx_, failure_kind);
diff --git a/compiler/oat_writer.cc b/compiler/oat_writer.cc
index 1781643..af60def 100644
--- a/compiler/oat_writer.cc
+++ b/compiler/oat_writer.cc
@@ -55,7 +55,6 @@
#include "type_lookup_table.h"
#include "utils/dex_cache_arrays_layout-inl.h"
#include "vdex_file.h"
-#include "verifier/method_verifier.h"
#include "verifier/verifier_deps.h"
#include "zip_archive.h"
diff --git a/compiler/optimizing/optimizing_compiler.cc b/compiler/optimizing/optimizing_compiler.cc
index 8aad539..065c11e 100644
--- a/compiler/optimizing/optimizing_compiler.cc
+++ b/compiler/optimizing/optimizing_compiler.cc
@@ -98,7 +98,7 @@
#include "ssa_liveness_analysis.h"
#include "ssa_phi_elimination.h"
#include "utils/assembler.h"
-#include "verifier/method_verifier.h"
+#include "verifier/verifier_compiler_binding.h"
namespace art {
@@ -1041,7 +1041,7 @@
const VerifiedMethod* verified_method = compiler_driver->GetVerifiedMethod(&dex_file, method_idx);
DCHECK(!verified_method->HasRuntimeThrow());
if (compiler_driver->IsMethodVerifiedWithoutFailures(method_idx, class_def_idx, dex_file)
- || verifier::MethodVerifier::CanCompilerHandleVerificationFailure(
+ || verifier::CanCompilerHandleVerificationFailure(
verified_method->GetEncounteredVerificationFailures())) {
ArenaAllocator arena(Runtime::Current()->GetArenaPool());
CodeVectorAllocator code_allocator(&arena);
diff --git a/compiler/verifier_deps_test.cc b/compiler/verifier_deps_test.cc
index 0b1ab75..4d55eb0 100644
--- a/compiler/verifier_deps_test.cc
+++ b/compiler/verifier_deps_test.cc
@@ -28,12 +28,13 @@
#include "driver/compiler_options.h"
#include "driver/compiler_driver.h"
#include "handle_scope-inl.h"
-#include "verifier/method_verifier-inl.h"
+#include "indenter.h"
#include "mirror/class_loader.h"
#include "runtime.h"
-#include "thread.h"
#include "scoped_thread_state_change-inl.h"
+#include "thread.h"
#include "utils/atomic_method_ref_map-inl.h"
+#include "verifier/method_verifier-inl.h"
namespace art {
namespace verifier {
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc
index a9108e0e..5090c11 100644
--- a/dex2oat/dex2oat.cc
+++ b/dex2oat/dex2oat.cc
@@ -382,8 +382,6 @@
"input dex file.");
UsageError("");
UsageError(" --force-determinism: force the compiler to emit a deterministic output.");
- UsageError(" This option is incompatible with read barriers (e.g., if dex2oat has been");
- UsageError(" built with the environment variable `ART_USE_READ_BARRIER` set to `true`).");
UsageError("");
UsageError(" --classpath-dir=<directory-path>: directory used to resolve relative class paths.");
UsageError("");
@@ -915,9 +913,10 @@
// Fill some values into the key-value store for the oat header.
key_value_store_.reset(new SafeMap<std::string, std::string>());
- // Automatically force determinism for the boot image in a host build if the default GC is CMS
- // or MS and read barriers are not enabled, as the former switches the GC to a non-concurrent
- // one by passing the option `-Xgc:nonconcurrent` (see below).
+ // Automatically force determinism for the boot image in a host build if read barriers
+ // are enabled, or if the default GC is CMS or MS. When the default GC is CMS
+ // (Concurrent Mark-Sweep), the GC is switched to a non-concurrent one by passing the
+ // option `-Xgc:nonconcurrent` (see below).
if (!kIsTargetBuild && IsBootImage()) {
if (SupportsDeterministicCompilation()) {
force_determinism_ = true;
@@ -939,9 +938,9 @@
}
static bool SupportsDeterministicCompilation() {
- return (gc::kCollectorTypeDefault == gc::kCollectorTypeCMS ||
- gc::kCollectorTypeDefault == gc::kCollectorTypeMS) &&
- !kEmitCompilerReadBarrier;
+ return (kUseReadBarrier ||
+ gc::kCollectorTypeDefault == gc::kCollectorTypeCMS ||
+ gc::kCollectorTypeDefault == gc::kCollectorTypeMS);
}
void ExpandOatAndImageFilenames() {
@@ -1233,7 +1232,7 @@
no_inline_from_string_ = option.substr(strlen("--no-inline-from=")).data();
} else if (option == "--force-determinism") {
if (!SupportsDeterministicCompilation()) {
- Usage("Cannot use --force-determinism with read barriers or non-CMS garbage collector");
+ Usage("Option --force-determinism requires read barriers or a CMS/MS garbage collector");
}
force_determinism_ = true;
} else if (option.starts_with("--classpath-dir=")) {
@@ -2421,15 +2420,25 @@
// foreground collector by default for dex2oat.
raw_options.push_back(std::make_pair("-XX:DisableHSpaceCompactForOOM", nullptr));
- // If we're asked to be deterministic, ensure non-concurrent GC for determinism. Also
- // force the free-list implementation for large objects.
if (compiler_options_->IsForceDeterminism()) {
+ // If we're asked to be deterministic, ensure non-concurrent GC for determinism.
+ //
+ // Note that with read barriers, this option is ignored, because Runtime::Init
+ // overrides the foreground GC to be gc::kCollectorTypeCC when instantiating
+ // gc::Heap. This is fine, as concurrent GC requests are not honored in dex2oat,
+ // which uses an unstarted runtime.
raw_options.push_back(std::make_pair("-Xgc:nonconcurrent", nullptr));
+
+ // Also force the free-list implementation for large objects.
raw_options.push_back(std::make_pair("-XX:LargeObjectSpace=freelist", nullptr));
// We also need to turn off the nonmoving space. For that, we need to disable HSpace
// compaction (done above) and ensure that neither foreground nor background collectors
// are concurrent.
+ //
+ // Likewise, this option is ignored with read barriers because Runtime::Init
+ // overrides the background GC to be gc::kCollectorTypeCCBackground, but that's
+ // fine too, for the same reason (see above).
raw_options.push_back(std::make_pair("-XX:BackgroundGC=nonconcurrent", nullptr));
// To make identity hashcode deterministic, set a known seed.
diff --git a/dexlayout/dexlayout.cc b/dexlayout/dexlayout.cc
index 344d735..204af22 100644
--- a/dexlayout/dexlayout.cc
+++ b/dexlayout/dexlayout.cc
@@ -24,6 +24,7 @@
#include <inttypes.h>
#include <stdio.h>
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
#include <iostream>
#include <memory>
diff --git a/runtime/Android.bp b/runtime/Android.bp
index 0860b2e..cff2cbc 100644
--- a/runtime/Android.bp
+++ b/runtime/Android.bp
@@ -457,7 +457,7 @@
"thread.h",
"thread_state.h",
"ti/agent.h",
- "verifier/method_verifier.h",
+ "verifier/verifier_enums.h",
],
output_extension: "operator_out.cc",
}
diff --git a/runtime/class_linker.cc b/runtime/class_linker.cc
index ee33fc4..3ecf595 100644
--- a/runtime/class_linker.cc
+++ b/runtime/class_linker.cc
@@ -3981,7 +3981,7 @@
}
}
-verifier::MethodVerifier::FailureKind ClassLinker::VerifyClass(
+verifier::FailureKind ClassLinker::VerifyClass(
Thread* self, Handle<mirror::Class> klass, verifier::HardFailLogMode log_level) {
{
// TODO: assert that the monitor on the Class is held
@@ -4003,19 +4003,19 @@
// this class as a parent to another.
if (klass->IsErroneous()) {
ThrowEarlierClassFailure(klass.Get());
- return verifier::MethodVerifier::kHardFailure;
+ return verifier::FailureKind::kHardFailure;
}
// Don't attempt to re-verify if already verified.
if (klass->IsVerified()) {
EnsureSkipAccessChecksMethods(klass, image_pointer_size_);
- return verifier::MethodVerifier::kNoFailure;
+ return verifier::FailureKind::kNoFailure;
}
// For AOT, don't attempt to re-verify if we have already found we should
// verify at runtime.
if (Runtime::Current()->IsAotCompiler() && klass->ShouldVerifyAtRuntime()) {
- return verifier::MethodVerifier::kSoftFailure;
+ return verifier::FailureKind::kSoftFailure;
}
if (klass->GetStatus() == mirror::Class::kStatusResolved) {
@@ -4031,7 +4031,7 @@
if (!Runtime::Current()->IsVerificationEnabled()) {
mirror::Class::SetStatus(klass, mirror::Class::kStatusVerified, self);
EnsureSkipAccessChecksMethods(klass, image_pointer_size_);
- return verifier::MethodVerifier::kNoFailure;
+ return verifier::FailureKind::kNoFailure;
}
}
@@ -4041,7 +4041,7 @@
// If we have a superclass and we get a hard verification failure we can return immediately.
if (supertype != nullptr && !AttemptSupertypeVerification(self, klass, supertype)) {
CHECK(self->IsExceptionPending()) << "Verification error should be pending.";
- return verifier::MethodVerifier::kHardFailure;
+ return verifier::FailureKind::kHardFailure;
}
// Verify all default super-interfaces.
@@ -4068,7 +4068,7 @@
} else if (UNLIKELY(!AttemptSupertypeVerification(self, klass, iface))) {
// We had a hard failure while verifying this interface. Just return immediately.
CHECK(self->IsExceptionPending()) << "Verification error should be pending.";
- return verifier::MethodVerifier::kHardFailure;
+ return verifier::FailureKind::kHardFailure;
} else if (UNLIKELY(!iface->IsVerified())) {
// We softly failed to verify the iface. Stop checking and clean up.
// Put the iface into the supertype handle so we know what caused us to fail.
@@ -4095,7 +4095,7 @@
DCHECK(!mirror::Class::IsErroneous(oat_file_class_status) || !preverified);
std::string error_msg;
- verifier::MethodVerifier::FailureKind verifier_failure = verifier::MethodVerifier::kNoFailure;
+ verifier::FailureKind verifier_failure = verifier::FailureKind::kNoFailure;
if (!preverified) {
Runtime* runtime = Runtime::Current();
verifier_failure = verifier::MethodVerifier::VerifyClass(self,
@@ -4109,8 +4109,8 @@
// Verification is done, grab the lock again.
ObjectLock<mirror::Class> lock(self, klass);
- if (preverified || verifier_failure != verifier::MethodVerifier::kHardFailure) {
- if (!preverified && verifier_failure != verifier::MethodVerifier::kNoFailure) {
+ if (preverified || verifier_failure != verifier::FailureKind::kHardFailure) {
+ if (!preverified && verifier_failure != verifier::FailureKind::kNoFailure) {
VLOG(class_linker) << "Soft verification failure in class "
<< klass->PrettyDescriptor()
<< " in " << klass->GetDexCache()->GetLocation()->ToModifiedUtf8()
@@ -4119,7 +4119,7 @@
self->AssertNoPendingException();
// Make sure all classes referenced by catch blocks are resolved.
ResolveClassExceptionHandlerTypes(klass);
- if (verifier_failure == verifier::MethodVerifier::kNoFailure) {
+ if (verifier_failure == verifier::FailureKind::kNoFailure) {
// Even though there were no verifier failures we need to respect whether the super-class and
// super-default-interfaces were verified or requiring runtime reverification.
if (supertype == nullptr || supertype->IsVerified()) {
@@ -4128,10 +4128,10 @@
CHECK_EQ(supertype->GetStatus(), mirror::Class::kStatusRetryVerificationAtRuntime);
mirror::Class::SetStatus(klass, mirror::Class::kStatusRetryVerificationAtRuntime, self);
// Pretend a soft failure occurred so that we don't consider the class verified below.
- verifier_failure = verifier::MethodVerifier::kSoftFailure;
+ verifier_failure = verifier::FailureKind::kSoftFailure;
}
} else {
- CHECK_EQ(verifier_failure, verifier::MethodVerifier::kSoftFailure);
+ CHECK_EQ(verifier_failure, verifier::FailureKind::kSoftFailure);
// Soft failures at compile time should be retried at runtime. Soft
// failures at runtime will be handled by slow paths in the generated
// code. Set status accordingly.
@@ -4152,7 +4152,7 @@
ThrowVerifyError(klass.Get(), "%s", error_msg.c_str());
mirror::Class::SetStatus(klass, mirror::Class::kStatusErrorResolved, self);
}
- if (preverified || verifier_failure == verifier::MethodVerifier::kNoFailure) {
+ if (preverified || verifier_failure == verifier::FailureKind::kNoFailure) {
// Class is verified so we don't need to do any access check on its methods.
// Let the interpreter know it by setting the kAccSkipAccessChecks flag onto each
// method.
diff --git a/runtime/class_linker.h b/runtime/class_linker.h
index 1c280a4..7f652ec 100644
--- a/runtime/class_linker.h
+++ b/runtime/class_linker.h
@@ -24,9 +24,7 @@
#include <utility>
#include <vector>
-#include "base/allocator.h"
#include "base/enums.h"
-#include "base/hash_set.h"
#include "base/macros.h"
#include "base/mutex.h"
#include "class_table.h"
@@ -38,8 +36,7 @@
#include "jni.h"
#include "mirror/class.h"
#include "object_callbacks.h"
-#include "verifier/method_verifier.h"
-#include "verifier/verifier_log_mode.h"
+#include "verifier/verifier_enums.h"
namespace art {
@@ -453,7 +450,7 @@
REQUIRES_SHARED(Locks::mutator_lock_)
REQUIRES(!Roles::uninterruptible_);
- verifier::MethodVerifier::FailureKind VerifyClass(
+ verifier::FailureKind VerifyClass(
Thread* self,
Handle<mirror::Class> klass,
verifier::HardFailLogMode log_level = verifier::HardFailLogMode::kLogNone)
diff --git a/runtime/dex_file.cc b/runtime/dex_file.cc
index 688f95b..625794e 100644
--- a/runtime/dex_file.cc
+++ b/runtime/dex_file.cc
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/file.h>
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
#include <sys/stat.h>
#include <zlib.h>
diff --git a/runtime/elf_file.cc b/runtime/elf_file.cc
index 59b734f..5fbdc46 100644
--- a/runtime/elf_file.cc
+++ b/runtime/elf_file.cc
@@ -17,6 +17,7 @@
#include "elf_file.h"
#include <inttypes.h>
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
#include <sys/types.h>
#include <unistd.h>
diff --git a/runtime/gc/accounting/atomic_stack.h b/runtime/gc/accounting/atomic_stack.h
index db9568a..351798e 100644
--- a/runtime/gc/accounting/atomic_stack.h
+++ b/runtime/gc/accounting/atomic_stack.h
@@ -17,6 +17,8 @@
#ifndef ART_RUNTIME_GC_ACCOUNTING_ATOMIC_STACK_H_
#define ART_RUNTIME_GC_ACCOUNTING_ATOMIC_STACK_H_
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
+
#include <algorithm>
#include <memory>
#include <string>
@@ -25,7 +27,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "mem_map.h"
-#include "stack.h"
+#include "stack_reference.h"
namespace art {
namespace gc {
diff --git a/runtime/gc/accounting/bitmap.cc b/runtime/gc/accounting/bitmap.cc
index 380cb8e..e535380 100644
--- a/runtime/gc/accounting/bitmap.cc
+++ b/runtime/gc/accounting/bitmap.cc
@@ -16,6 +16,8 @@
#include "bitmap-inl.h"
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
+
#include "base/bit_utils.h"
#include "card_table.h"
#include "jit/jit_code_cache.h"
diff --git a/runtime/gc/accounting/read_barrier_table.h b/runtime/gc/accounting/read_barrier_table.h
index e77a5b8..775746f 100644
--- a/runtime/gc/accounting/read_barrier_table.h
+++ b/runtime/gc/accounting/read_barrier_table.h
@@ -17,6 +17,8 @@
#ifndef ART_RUNTIME_GC_ACCOUNTING_READ_BARRIER_TABLE_H_
#define ART_RUNTIME_GC_ACCOUNTING_READ_BARRIER_TABLE_H_
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
+
#include "base/bit_utils.h"
#include "base/mutex.h"
#include "gc/space/space.h"
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index 80b569a..e193d2a 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -22,8 +22,10 @@
#include "base/stl_util.h"
#include "base/systrace.h"
#include "debugger.h"
+#include "gc/accounting/atomic_stack.h"
#include "gc/accounting/heap_bitmap-inl.h"
#include "gc/accounting/mod_union_table-inl.h"
+#include "gc/accounting/read_barrier_table.h"
#include "gc/accounting/space_bitmap-inl.h"
#include "gc/gc_pause_listener.h"
#include "gc/reference_processor.h"
diff --git a/runtime/gc/collector/concurrent_copying.h b/runtime/gc/collector/concurrent_copying.h
index c21520d..f877314 100644
--- a/runtime/gc/collector/concurrent_copying.h
+++ b/runtime/gc/collector/concurrent_copying.h
@@ -23,8 +23,6 @@
#include "jni.h"
#include "object_callbacks.h"
#include "offsets.h"
-#include "gc/accounting/atomic_stack.h"
-#include "gc/accounting/read_barrier_table.h"
#include "gc/accounting/space_bitmap.h"
#include "mirror/object.h"
#include "mirror/object_reference.h"
@@ -40,8 +38,11 @@
namespace gc {
namespace accounting {
+ template<typename T> class AtomicStack;
+ typedef AtomicStack<mirror::Object> ObjectStack;
typedef SpaceBitmap<kObjectAlignment> ContinuousSpaceBitmap;
class HeapBitmap;
+ class ReadBarrierTable;
} // namespace accounting
namespace space {
diff --git a/runtime/gc/heap-inl.h b/runtime/gc/heap-inl.h
index a50d125..79086da 100644
--- a/runtime/gc/heap-inl.h
+++ b/runtime/gc/heap-inl.h
@@ -57,8 +57,8 @@
HandleWrapperObjPtr<mirror::Class> h = hs.NewHandleWrapper(&klass);
self->PoisonObjectPointers();
}
- // Need to check that we arent the large object allocator since the large object allocation code
- // path this function. If we didn't check we would have an infinite loop.
+ // Need to check that we aren't the large object allocator since the large object allocation code
+ // path includes this function. If we didn't check we would have an infinite loop.
ObjPtr<mirror::Object> obj;
if (kCheckLargeObject && UNLIKELY(ShouldAllocLargeObject(klass, byte_count))) {
obj = AllocLargeObject<kInstrumented, PreFenceVisitor>(self, &klass, byte_count,
@@ -198,7 +198,7 @@
} else {
DCHECK(!gc_stress_mode_);
}
- // IsConcurrentGc() isn't known at compile time so we can optimize by not checking it for
+ // IsGcConcurrent() isn't known at compile time so we can optimize by not checking it for
// the BumpPointer or TLAB allocators. This is nice since it allows the entire if statement to be
// optimized out. And for the other allocators, AllocatorMayHaveConcurrentGC is a constant since
// the allocator_type should be constant propagated.
diff --git a/runtime/gc/heap.cc b/runtime/gc/heap.cc
index be7e856..bd4f99b 100644
--- a/runtime/gc/heap.cc
+++ b/runtime/gc/heap.cc
@@ -3744,8 +3744,8 @@
if (!Runtime::Current()->IsShuttingDown(self)) {
// Wait for any GCs currently running to finish.
if (WaitForGcToComplete(cause, self) == collector::kGcTypeNone) {
- // If the we can't run the GC type we wanted to run, find the next appropriate one and try that
- // instead. E.g. can't do partial, so do full instead.
+ // If the we can't run the GC type we wanted to run, find the next appropriate one and try
+ // that instead. E.g. can't do partial, so do full instead.
collector::GcType next_gc_type = next_gc_type_;
// If forcing full and next gc type is sticky, override with a non-sticky type.
if (force_full && next_gc_type == collector::kGcTypeSticky) {
diff --git a/runtime/interpreter/interpreter_common.cc b/runtime/interpreter/interpreter_common.cc
index 326f5c9..ef0ddb3 100644
--- a/runtime/interpreter/interpreter_common.cc
+++ b/runtime/interpreter/interpreter_common.cc
@@ -32,7 +32,6 @@
#include "reflection.h"
#include "reflection-inl.h"
#include "stack.h"
-#include "verifier/method_verifier.h"
#include "well_known_classes.h"
namespace art {
diff --git a/runtime/mem_map.cc b/runtime/mem_map.cc
index 40309b9..6c39361 100644
--- a/runtime/mem_map.cc
+++ b/runtime/mem_map.cc
@@ -16,26 +16,26 @@
#include "mem_map.h"
-#include "base/memory_tool.h"
-#include <backtrace/BacktraceMap.h>
#include <inttypes.h>
#include <stdlib.h>
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
+#ifndef ANDROID_OS
+#include <sys/resource.h>
+#endif
#include <memory>
#include <sstream>
#include "android-base/stringprintf.h"
+#include "android-base/unique_fd.h"
+#include "backtrace/BacktraceMap.h"
+#include "cutils/ashmem.h"
-#include "base/unix_file/fd_file.h"
-#include "os.h"
-#include "thread-inl.h"
+#include "base/allocator.h"
+#include "base/memory_tool.h"
+#include "globals.h"
#include "utils.h"
-#include <cutils/ashmem.h>
-
-#ifndef ANDROID_OS
-#include <sys/resource.h>
-#endif
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
@@ -44,6 +44,12 @@
namespace art {
using android::base::StringPrintf;
+using android::base::unique_fd;
+
+using Maps = AllocationTrackingMultiMap<void*, MemMap*, kAllocatorTagMaps>;
+
+// All the non-empty MemMaps. Use a multimap as we do a reserve-and-divide (eg ElfMap::Load()).
+static Maps* gMaps GUARDED_BY(MemMap::GetMemMapsLock()) = nullptr;
static std::ostream& operator<<(
std::ostream& os,
@@ -59,7 +65,7 @@
return os;
}
-std::ostream& operator<<(std::ostream& os, const MemMap::Maps& mem_maps) {
+std::ostream& operator<<(std::ostream& os, const Maps& mem_maps) {
os << "MemMap:" << std::endl;
for (auto it = mem_maps.begin(); it != mem_maps.end(); ++it) {
void* base = it->first;
@@ -71,7 +77,6 @@
}
std::mutex* MemMap::mem_maps_lock_ = nullptr;
-MemMap::Maps* MemMap::maps_ = nullptr;
#if USE_ART_LOW_4G_ALLOCATOR
// Handling mem_map in 32b address range for 64b architectures that do not support MAP_32BIT.
@@ -132,7 +137,7 @@
#endif
// Return true if the address range is contained in a single memory map by either reading
-// the maps_ variable or the /proc/self/map entry.
+// the gMaps variable or the /proc/self/map entry.
bool MemMap::ContainedWithinExistingMap(uint8_t* ptr, size_t size, std::string* error_msg) {
uintptr_t begin = reinterpret_cast<uintptr_t>(ptr);
uintptr_t end = begin + size;
@@ -141,7 +146,7 @@
// further.
{
std::lock_guard<std::mutex> mu(*mem_maps_lock_);
- for (auto& pair : *maps_) {
+ for (auto& pair : *gMaps) {
MemMap* const map = pair.second;
if (begin >= reinterpret_cast<uintptr_t>(map->Begin()) &&
end <= reinterpret_cast<uintptr_t>(map->End())) {
@@ -302,8 +307,6 @@
flags |= MAP_FIXED;
}
- File fd;
-
if (use_ashmem) {
if (!kIsTargetBuild) {
// When not on Android (either host or assuming a linux target) ashmem is faked using
@@ -316,15 +319,17 @@
}
}
+ unique_fd fd;
+
+
if (use_ashmem) {
// android_os_Debug.cpp read_mapinfo assumes all ashmem regions associated with the VM are
// prefixed "dalvik-".
std::string debug_friendly_name("dalvik-");
debug_friendly_name += name;
- fd.Reset(ashmem_create_region(debug_friendly_name.c_str(), page_aligned_byte_count),
- /* check_usage */ false);
+ fd.reset(ashmem_create_region(debug_friendly_name.c_str(), page_aligned_byte_count));
- if (fd.Fd() == -1) {
+ if (fd.get() == -1) {
// We failed to create the ashmem region. Print a warning, but continue
// anyway by creating a true anonymous mmap with an fd of -1. It is
// better to use an unlabelled anonymous map than to fail to create a
@@ -344,7 +349,7 @@
page_aligned_byte_count,
prot,
flags,
- fd.Fd(),
+ fd.get(),
0,
low_4gb);
saved_errno = errno;
@@ -361,7 +366,7 @@
page_aligned_byte_count,
prot,
flags,
- fd.Fd(),
+ fd.get(),
strerror(saved_errno));
}
return nullptr;
@@ -490,15 +495,15 @@
}
}
- // Remove it from maps_.
+ // Remove it from gMaps.
std::lock_guard<std::mutex> mu(*mem_maps_lock_);
bool found = false;
- DCHECK(maps_ != nullptr);
- for (auto it = maps_->lower_bound(base_begin_), end = maps_->end();
+ DCHECK(gMaps != nullptr);
+ for (auto it = gMaps->lower_bound(base_begin_), end = gMaps->end();
it != end && it->first == base_begin_; ++it) {
if (it->second == this) {
found = true;
- maps_->erase(it);
+ gMaps->erase(it);
break;
}
}
@@ -518,10 +523,10 @@
CHECK(base_begin_ != nullptr);
CHECK_NE(base_size_, 0U);
- // Add it to maps_.
+ // Add it to gMaps.
std::lock_guard<std::mutex> mu(*mem_maps_lock_);
- DCHECK(maps_ != nullptr);
- maps_->insert(std::make_pair(base_begin_, this));
+ DCHECK(gMaps != nullptr);
+ gMaps->insert(std::make_pair(base_begin_, this));
}
}
@@ -551,22 +556,21 @@
DCHECK_EQ(tail_base_begin + tail_base_size, old_base_end);
DCHECK_ALIGNED(tail_base_size, kPageSize);
- int int_fd = -1;
+ unique_fd fd;
int flags = MAP_PRIVATE | MAP_ANONYMOUS;
if (use_ashmem) {
// android_os_Debug.cpp read_mapinfo assumes all ashmem regions associated with the VM are
// prefixed "dalvik-".
std::string debug_friendly_name("dalvik-");
debug_friendly_name += tail_name;
- int_fd = ashmem_create_region(debug_friendly_name.c_str(), tail_base_size);
+ fd.reset(ashmem_create_region(debug_friendly_name.c_str(), tail_base_size));
flags = MAP_PRIVATE | MAP_FIXED;
- if (int_fd == -1) {
+ if (fd.get() == -1) {
*error_msg = StringPrintf("ashmem_create_region failed for '%s': %s",
tail_name, strerror(errno));
return nullptr;
}
}
- File fd(int_fd, /* check_usage */ false);
MEMORY_TOOL_MAKE_UNDEFINED(tail_base_begin, tail_base_size);
// Unmap/map the tail region.
@@ -581,13 +585,17 @@
// calls. Otherwise, libc (or something else) might take this memory
// region. Note this isn't perfect as there's no way to prevent
// other threads to try to take this memory region here.
- uint8_t* actual = reinterpret_cast<uint8_t*>(mmap(tail_base_begin, tail_base_size, tail_prot,
- flags, fd.Fd(), 0));
+ uint8_t* actual = reinterpret_cast<uint8_t*>(mmap(tail_base_begin,
+ tail_base_size,
+ tail_prot,
+ flags,
+ fd.get(),
+ 0));
if (actual == MAP_FAILED) {
PrintFileToLog("/proc/self/maps", LogSeverity::WARNING);
*error_msg = StringPrintf("anonymous mmap(%p, %zd, 0x%x, 0x%x, %d, 0) failed. See process "
"maps in the log.", tail_base_begin, tail_base_size, tail_prot, flags,
- fd.Fd());
+ fd.get());
return nullptr;
}
return new MemMap(tail_name, actual, tail_size, actual, tail_base_size, tail_prot, false);
@@ -662,7 +670,7 @@
}
void MemMap::DumpMapsLocked(std::ostream& os, bool terse) {
- const auto& mem_maps = *maps_;
+ const auto& mem_maps = *gMaps;
if (!terse) {
os << mem_maps;
return;
@@ -722,7 +730,7 @@
bool MemMap::HasMemMap(MemMap* map) {
void* base_begin = map->BaseBegin();
- for (auto it = maps_->lower_bound(base_begin), end = maps_->end();
+ for (auto it = gMaps->lower_bound(base_begin), end = gMaps->end();
it != end && it->first == base_begin; ++it) {
if (it->second == map) {
return true;
@@ -734,8 +742,8 @@
MemMap* MemMap::GetLargestMemMapAt(void* address) {
size_t largest_size = 0;
MemMap* largest_map = nullptr;
- DCHECK(maps_ != nullptr);
- for (auto it = maps_->lower_bound(address), end = maps_->end();
+ DCHECK(gMaps != nullptr);
+ for (auto it = gMaps->lower_bound(address), end = gMaps->end();
it != end && it->first == address; ++it) {
MemMap* map = it->second;
CHECK(map != nullptr);
@@ -753,10 +761,10 @@
return;
}
mem_maps_lock_ = new std::mutex();
- // Not for thread safety, but for the annotation that maps_ is GUARDED_BY(mem_maps_lock_).
+ // Not for thread safety, but for the annotation that gMaps is GUARDED_BY(mem_maps_lock_).
std::lock_guard<std::mutex> mu(*mem_maps_lock_);
- DCHECK(maps_ == nullptr);
- maps_ = new Maps;
+ DCHECK(gMaps == nullptr);
+ gMaps = new Maps;
}
void MemMap::Shutdown() {
@@ -765,11 +773,11 @@
return;
}
{
- // Not for thread safety, but for the annotation that maps_ is GUARDED_BY(mem_maps_lock_).
+ // Not for thread safety, but for the annotation that gMaps is GUARDED_BY(mem_maps_lock_).
std::lock_guard<std::mutex> mu(*mem_maps_lock_);
- DCHECK(maps_ != nullptr);
- delete maps_;
- maps_ = nullptr;
+ DCHECK(gMaps != nullptr);
+ delete gMaps;
+ gMaps = nullptr;
}
delete mem_maps_lock_;
mem_maps_lock_ = nullptr;
@@ -830,17 +838,17 @@
std::lock_guard<std::mutex> mu(*mem_maps_lock_);
for (uintptr_t ptr = next_mem_pos_; ptr < 4 * GB; ptr += kPageSize) {
- // Use maps_ as an optimization to skip over large maps.
+ // Use gMaps as an optimization to skip over large maps.
// Find the first map which is address > ptr.
- auto it = maps_->upper_bound(reinterpret_cast<void*>(ptr));
- if (it != maps_->begin()) {
+ auto it = gMaps->upper_bound(reinterpret_cast<void*>(ptr));
+ if (it != gMaps->begin()) {
auto before_it = it;
--before_it;
// Start at the end of the map before the upper bound.
ptr = std::max(ptr, reinterpret_cast<uintptr_t>(before_it->second->BaseEnd()));
CHECK_ALIGNED(ptr, kPageSize);
}
- while (it != maps_->end()) {
+ while (it != gMaps->end()) {
// How much space do we have until the next map?
size_t delta = reinterpret_cast<uintptr_t>(it->first) - ptr;
// If the space may be sufficient, break out of the loop.
@@ -1001,12 +1009,12 @@
base_size_ = aligned_base_size;
begin_ = aligned_base_begin;
size_ = aligned_base_size;
- DCHECK(maps_ != nullptr);
+ DCHECK(gMaps != nullptr);
if (base_begin < aligned_base_begin) {
- auto it = maps_->find(base_begin);
- CHECK(it != maps_->end()) << "MemMap not found";
- maps_->erase(it);
- maps_->insert(std::make_pair(base_begin_, this));
+ auto it = gMaps->find(base_begin);
+ CHECK(it != gMaps->end()) << "MemMap not found";
+ gMaps->erase(it);
+ gMaps->insert(std::make_pair(base_begin_, this));
}
}
diff --git a/runtime/mem_map.h b/runtime/mem_map.h
index ceb4c33..140877e 100644
--- a/runtime/mem_map.h
+++ b/runtime/mem_map.h
@@ -17,18 +17,14 @@
#ifndef ART_RUNTIME_MEM_MAP_H_
#define ART_RUNTIME_MEM_MAP_H_
-#include "base/mutex.h"
-
-#include <string>
-#include <map>
-#include <mutex>
-
#include <stddef.h>
-#include <sys/mman.h> // For the PROT_* and MAP_* constants.
#include <sys/types.h>
-#include "base/allocator.h"
-#include "globals.h"
+#include <map>
+#include <mutex>
+#include <string>
+
+#include "android-base/thread_annotations.h"
namespace art {
@@ -180,8 +176,6 @@
static void DumpMaps(std::ostream& os, bool terse = false)
REQUIRES(!MemMap::mem_maps_lock_);
- typedef AllocationTrackingMultiMap<void*, MemMap*, kAllocatorTagMaps> Maps;
-
// Init and Shutdown are NOT thread safe.
// Both may be called multiple times and MemMap objects may be created any
// time after the first call to Init and before the first call to Shutodwn.
@@ -196,6 +190,11 @@
// Align the map by unmapping the unaligned parts at the lower and the higher ends.
void AlignBy(size_t size);
+ // For annotation reasons.
+ static std::mutex* GetMemMapsLock() RETURN_CAPABILITY(mem_maps_lock_) {
+ return nullptr;
+ }
+
private:
MemMap(const std::string& name,
uint8_t* begin,
@@ -245,14 +244,10 @@
static std::mutex* mem_maps_lock_;
- // All the non-empty MemMaps. Use a multimap as we do a reserve-and-divide (eg ElfMap::Load()).
- static Maps* maps_ GUARDED_BY(MemMap::mem_maps_lock_);
-
friend class MemMapTest; // To allow access to base_begin_ and base_size_.
};
std::ostream& operator<<(std::ostream& os, const MemMap& mem_map);
-std::ostream& operator<<(std::ostream& os, const MemMap::Maps& mem_maps);
// Zero and release pages if possible, no requirements on alignments.
void ZeroAndReleasePages(void* address, size_t length);
diff --git a/runtime/mirror/class-inl.h b/runtime/mirror/class-inl.h
index 6c723ef..5122b37 100644
--- a/runtime/mirror/class-inl.h
+++ b/runtime/mirror/class-inl.h
@@ -96,7 +96,13 @@
}
inline uint32_t Class::GetCopiedMethodsStartOffset() {
- return GetFieldShort(OFFSET_OF_OBJECT_MEMBER(Class, copied_methods_offset_));
+ // Object::GetFieldShort returns an int16_t value, but
+ // Class::copied_methods_offset_ is an uint16_t value; cast the
+ // latter to int16_t before returning it as an uint32_t value, so
+ // that uint16_t values between 2^15 and 2^16-1 are correctly
+ // handled.
+ return static_cast<uint16_t>(
+ GetFieldShort(OFFSET_OF_OBJECT_MEMBER(Class, copied_methods_offset_)));
}
inline uint32_t Class::GetDirectMethodsStartOffset() {
@@ -104,7 +110,13 @@
}
inline uint32_t Class::GetVirtualMethodsStartOffset() {
- return GetFieldShort(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_offset_));
+ // Object::GetFieldShort returns an int16_t value, but
+ // Class::virtual_method_offset_ is an uint16_t value; cast the
+ // latter to int16_t before returning it as an uint32_t value, so
+ // that uint16_t values between 2^15 and 2^16-1 are correctly
+ // handled.
+ return static_cast<uint16_t>(
+ GetFieldShort(OFFSET_OF_OBJECT_MEMBER(Class, virtual_methods_offset_)));
}
template<VerifyObjectFlags kVerifyFlags>
diff --git a/runtime/openjdkjvmti/ti_redefine.cc b/runtime/openjdkjvmti/ti_redefine.cc
index 41ed862..cca1486 100644
--- a/runtime/openjdkjvmti/ti_redefine.cc
+++ b/runtime/openjdkjvmti/ti_redefine.cc
@@ -66,7 +66,7 @@
#include "ti_class_loader.h"
#include "transform.h"
#include "verifier/method_verifier.h"
-#include "verifier/verifier_log_mode.h"
+#include "verifier/verifier_enums.h"
namespace openjdkjvmti {
@@ -1063,7 +1063,7 @@
art::StackHandleScope<2> hs(driver_->self_);
std::string error;
// TODO Make verification log level lower
- art::verifier::MethodVerifier::FailureKind failure =
+ art::verifier::FailureKind failure =
art::verifier::MethodVerifier::VerifyClass(driver_->self_,
dex_file_.get(),
hs.NewHandle(iter.GetNewDexCache()),
@@ -1074,7 +1074,7 @@
/*log_level*/
art::verifier::HardFailLogMode::kLogWarning,
&error);
- bool passes = failure == art::verifier::MethodVerifier::kNoFailure;
+ bool passes = failure == art::verifier::FailureKind::kNoFailure;
if (!passes) {
RecordFailure(ERR(FAILS_VERIFICATION), "Failed to verify class. Error was: " + error);
}
diff --git a/runtime/quick_exception_handler.cc b/runtime/quick_exception_handler.cc
index 72e0500..b866941 100644
--- a/runtime/quick_exception_handler.cc
+++ b/runtime/quick_exception_handler.cc
@@ -32,7 +32,6 @@
#include "oat_quick_method_header.h"
#include "stack.h"
#include "stack_map.h"
-#include "verifier/method_verifier.h"
namespace art {
diff --git a/runtime/runtime_options.h b/runtime/runtime_options.h
index 5fcb86e..c509992 100644
--- a/runtime/runtime_options.h
+++ b/runtime/runtime_options.h
@@ -17,13 +17,15 @@
#ifndef ART_RUNTIME_RUNTIME_OPTIONS_H_
#define ART_RUNTIME_RUNTIME_OPTIONS_H_
-#include "base/variant_map.h"
-#include "cmdline_types.h" // TODO: don't need to include this file here
-
-// Map keys
#include <vector>
#include <string>
+
+#include <stdio.h>
+#include <stdarg.h>
+
#include "base/logging.h"
+#include "base/variant_map.h"
+#include "cmdline_types.h" // TODO: don't need to include this file here
#include "jdwp/jdwp.h"
#include "jit/jit.h"
#include "jit/jit_code_cache.h"
@@ -31,9 +33,7 @@
#include "gc/space/large_object_space.h"
#include "arch/instruction_set.h"
#include "jit/profile_saver_options.h"
-#include "verifier/verify_mode.h"
-#include <stdio.h>
-#include <stdarg.h>
+#include "verifier/verifier_enums.h"
namespace art {
diff --git a/runtime/vdex_file.cc b/runtime/vdex_file.cc
index 9ff104b..945f08b 100644
--- a/runtime/vdex_file.cc
+++ b/runtime/vdex_file.cc
@@ -16,6 +16,8 @@
#include "vdex_file.h"
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
+
#include <memory>
#include "base/logging.h"
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index e09f95c..2b0c612 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -36,6 +36,7 @@
#include "dex_instruction_visitor.h"
#include "experimental_flags.h"
#include "gc/accounting/card_table-inl.h"
+#include "handle_scope-inl.h"
#include "indenter.h"
#include "intern_table.h"
#include "leb128.h"
@@ -52,7 +53,7 @@
#include "scoped_thread_state_change-inl.h"
#include "utils.h"
#include "verifier_deps.h"
-#include "handle_scope-inl.h"
+#include "verifier_compiler_binding.h"
namespace art {
namespace verifier {
@@ -136,14 +137,14 @@
reg_line->MarkAllRegistersAsConflicts(verifier);
}
-MethodVerifier::FailureKind MethodVerifier::VerifyClass(Thread* self,
- mirror::Class* klass,
- CompilerCallbacks* callbacks,
- bool allow_soft_failures,
- HardFailLogMode log_level,
- std::string* error) {
+FailureKind MethodVerifier::VerifyClass(Thread* self,
+ mirror::Class* klass,
+ CompilerCallbacks* callbacks,
+ bool allow_soft_failures,
+ HardFailLogMode log_level,
+ std::string* error) {
if (klass->IsVerified()) {
- return kNoFailure;
+ return FailureKind::kNoFailure;
}
bool early_failure = false;
std::string failure_message;
@@ -167,7 +168,7 @@
ClassReference ref(&dex_file, klass->GetDexClassDefIndex());
callbacks->ClassRejected(ref);
}
- return kHardFailure;
+ return FailureKind::kHardFailure;
}
StackHandleScope<2> hs(self);
Handle<mirror::DexCache> dex_cache(hs.NewHandle(klass->GetDexCache()));
@@ -188,12 +189,9 @@
return kDirect ? it->HasNextDirectMethod() : it->HasNextVirtualMethod();
}
-static MethodVerifier::FailureKind FailureKindMax(MethodVerifier::FailureKind fk1,
- MethodVerifier::FailureKind fk2) {
- static_assert(MethodVerifier::FailureKind::kNoFailure <
- MethodVerifier::FailureKind::kSoftFailure
- && MethodVerifier::FailureKind::kSoftFailure <
- MethodVerifier::FailureKind::kHardFailure,
+static FailureKind FailureKindMax(FailureKind fk1, FailureKind fk2) {
+ static_assert(FailureKind::kNoFailure < FailureKind::kSoftFailure
+ && FailureKind::kSoftFailure < FailureKind::kHardFailure,
"Unexpected FailureKind order");
return std::max(fk1, fk2);
}
@@ -257,8 +255,8 @@
log_level,
need_precise_constants,
&hard_failure_msg);
- if (result.kind == kHardFailure) {
- if (failure_data.kind == kHardFailure) {
+ if (result.kind == FailureKind::kHardFailure) {
+ if (failure_data.kind == FailureKind::kHardFailure) {
// If we logged an error before, we need a newline.
*error_string += "\n";
} else {
@@ -277,15 +275,15 @@
return failure_data;
}
-MethodVerifier::FailureKind MethodVerifier::VerifyClass(Thread* self,
- const DexFile* dex_file,
- Handle<mirror::DexCache> dex_cache,
- Handle<mirror::ClassLoader> class_loader,
- const DexFile::ClassDef& class_def,
- CompilerCallbacks* callbacks,
- bool allow_soft_failures,
- HardFailLogMode log_level,
- std::string* error) {
+FailureKind MethodVerifier::VerifyClass(Thread* self,
+ const DexFile* dex_file,
+ Handle<mirror::DexCache> dex_cache,
+ Handle<mirror::ClassLoader> class_loader,
+ const DexFile::ClassDef& class_def,
+ CompilerCallbacks* callbacks,
+ bool allow_soft_failures,
+ HardFailLogMode log_level,
+ std::string* error) {
ScopedTrace trace(__FUNCTION__);
// A class must not be abstract and final.
@@ -293,13 +291,13 @@
*error = "Verifier rejected class ";
*error += PrettyDescriptor(dex_file->GetClassDescriptor(class_def));
*error += ": class is abstract and final.";
- return kHardFailure;
+ return FailureKind::kHardFailure;
}
const uint8_t* class_data = dex_file->GetClassData(class_def);
if (class_data == nullptr) {
// empty class, probably a marker interface
- return kNoFailure;
+ return FailureKind::kNoFailure;
}
ClassDataItemIterator it(*dex_file, class_data);
while (it.HasNextStaticField() || it.HasNextInstanceField()) {
@@ -335,8 +333,8 @@
data1.Merge(data2);
- if (data1.kind == kNoFailure) {
- return kNoFailure;
+ if (data1.kind == FailureKind::kNoFailure) {
+ return FailureKind::kNoFailure;
} else {
if ((data1.types & VERIFY_ERROR_LOCKING) != 0) {
// Print a warning about expected slow-down. Use a string temporary to print one contiguous
@@ -412,7 +410,7 @@
verifier.DumpFailures(VLOG_STREAM(verifier) << "Soft verification failures in "
<< dex_file->PrettyMethod(method_idx) << "\n");
}
- result.kind = kSoftFailure;
+ result.kind = FailureKind::kSoftFailure;
if (method != nullptr &&
!CanCompilerHandleVerificationFailure(verifier.encountered_failure_types_)) {
method->SetDontCompile();
@@ -432,7 +430,7 @@
// code is valid (even the dead and unverified one). As such this is done only for apps.
// (CompilerDriver DCHECKs in VerifyClassVisitor that methods from boot image are
// fully verified).
- result.kind = kSoftFailure;
+ result.kind = FailureKind::kSoftFailure;
}
}
if ((verifier.encountered_failure_types_ & VerifyError::VERIFY_ERROR_LOCKING) != 0) {
@@ -446,7 +444,7 @@
if (UNLIKELY(verifier.have_pending_experimental_failure_)) {
// Failed due to being forced into interpreter. This is ok because
// we just want to skip verification.
- result.kind = kSoftFailure;
+ result.kind = FailureKind::kSoftFailure;
} else {
CHECK(verifier.have_pending_hard_failure_);
if (VLOG_IS_ON(verifier)) {
@@ -477,7 +475,7 @@
*hard_failure_msg =
verifier.failure_messages_[verifier.failure_messages_.size() - 1]->str();
}
- result.kind = kHardFailure;
+ result.kind = FailureKind::kHardFailure;
if (callbacks != nullptr) {
// Let the interested party know that we failed the class.
@@ -4137,6 +4135,12 @@
}
bool MethodVerifier::CheckCallSite(uint32_t call_site_idx) {
+ if (call_site_idx >= dex_file_->NumCallSiteIds()) {
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Bad call site id #" << call_site_idx
+ << " >= " << dex_file_->NumCallSiteIds();
+ return false;
+ }
+
CallSiteArrayValueIterator it(*dex_file_, dex_file_->GetCallSiteId(call_site_idx));
// Check essential arguments are provided. The dex file verifier has verified indicies of the
// main values (method handle, name, method_type).
@@ -4147,9 +4151,11 @@
return false;
}
- // Get and check the first argument: the method handle.
+ // Get and check the first argument: the method handle (index range
+ // checked by the dex file verifier).
uint32_t method_handle_idx = static_cast<uint32_t>(it.GetJavaValue().i);
it.Next();
+
const DexFile::MethodHandleItem& mh = dex_file_->GetMethodHandle(method_handle_idx);
if (mh.method_handle_type_ != static_cast<uint16_t>(DexFile::MethodHandleType::kInvokeStatic)) {
Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "Call site #" << call_site_idx
diff --git a/runtime/verifier/method_verifier.h b/runtime/verifier/method_verifier.h
index 7b67967..26dc15e 100644
--- a/runtime/verifier/method_verifier.h
+++ b/runtime/verifier/method_verifier.h
@@ -33,7 +33,7 @@
#include "method_reference.h"
#include "register_line.h"
#include "reg_type_cache.h"
-#include "verifier_log_mode.h"
+#include "verifier_enums.h"
namespace art {
@@ -50,57 +50,6 @@
using RegisterLineArenaUniquePtr = std::unique_ptr<RegisterLine, RegisterLineArenaDelete>;
class RegType;
-/*
- * "Direct" and "virtual" methods are stored independently. The type of call used to invoke the
- * method determines which list we search, and whether we travel up into superclasses.
- *
- * (<clinit>, <init>, and methods declared "private" or "static" are stored in the "direct" list.
- * All others are stored in the "virtual" list.)
- */
-enum MethodType {
- METHOD_UNKNOWN = 0,
- METHOD_DIRECT, // <init>, private
- METHOD_STATIC, // static
- METHOD_VIRTUAL, // virtual
- METHOD_SUPER, // super
- METHOD_INTERFACE, // interface
- METHOD_POLYMORPHIC // polymorphic
-};
-std::ostream& operator<<(std::ostream& os, const MethodType& rhs);
-
-/*
- * An enumeration of problems that can turn up during verification.
- * Both VERIFY_ERROR_BAD_CLASS_SOFT and VERIFY_ERROR_BAD_CLASS_HARD denote failures that cause
- * the entire class to be rejected. However, VERIFY_ERROR_BAD_CLASS_SOFT denotes a soft failure
- * that can potentially be corrected, and the verifier will try again at runtime.
- * VERIFY_ERROR_BAD_CLASS_HARD denotes a hard failure that can't be corrected, and will cause
- * the class to remain uncompiled. Other errors denote verification errors that cause bytecode
- * to be rewritten to fail at runtime.
- */
-enum VerifyError {
- VERIFY_ERROR_BAD_CLASS_HARD = 1, // VerifyError; hard error that skips compilation.
- VERIFY_ERROR_BAD_CLASS_SOFT = 2, // VerifyError; soft error that verifies again at runtime.
-
- VERIFY_ERROR_NO_CLASS = 4, // NoClassDefFoundError.
- VERIFY_ERROR_NO_FIELD = 8, // NoSuchFieldError.
- VERIFY_ERROR_NO_METHOD = 16, // NoSuchMethodError.
- VERIFY_ERROR_ACCESS_CLASS = 32, // IllegalAccessError.
- VERIFY_ERROR_ACCESS_FIELD = 64, // IllegalAccessError.
- VERIFY_ERROR_ACCESS_METHOD = 128, // IllegalAccessError.
- VERIFY_ERROR_CLASS_CHANGE = 256, // IncompatibleClassChangeError.
- VERIFY_ERROR_INSTANTIATION = 512, // InstantiationError.
- // For opcodes that don't have complete verifier support, we need a way to continue
- // execution at runtime without attempting to re-verify (since we know it will fail no
- // matter what). Instead, run as the interpreter in a special "do access checks" mode
- // which will perform verifier-like checking on the fly.
- VERIFY_ERROR_FORCE_INTERPRETER = 1024, // Skip the verification phase at runtime;
- // force the interpreter to do access checks.
- // (sets a soft fail at compile time).
- VERIFY_ERROR_LOCKING = 2048, // Could not guarantee balanced locking. This should be
- // punted to the interpreter with access checks.
-};
-std::ostream& operator<<(std::ostream& os, const VerifyError& rhs);
-
// We don't need to store the register data for many instructions, because we either only need
// it at branch points (for verification) or GC points and branches (for verification +
// type-precise register analysis).
@@ -136,20 +85,6 @@
// The verifier
class MethodVerifier {
public:
- enum FailureKind {
- kNoFailure,
- kSoftFailure,
- kHardFailure,
- };
-
- static bool CanCompilerHandleVerificationFailure(uint32_t encountered_failure_types) {
- constexpr uint32_t unresolved_mask = verifier::VerifyError::VERIFY_ERROR_NO_CLASS
- | verifier::VerifyError::VERIFY_ERROR_ACCESS_CLASS
- | verifier::VerifyError::VERIFY_ERROR_ACCESS_FIELD
- | verifier::VerifyError::VERIFY_ERROR_ACCESS_METHOD;
- return (encountered_failure_types & (~unresolved_mask)) == 0;
- }
-
// Verify a class. Returns "kNoFailure" on success.
static FailureKind VerifyClass(Thread* self,
mirror::Class* klass,
@@ -325,7 +260,7 @@
// Verification result for method(s). Includes a (maximum) failure kind, and (the union of)
// all failure types.
struct FailureData : ValueObject {
- FailureKind kind = kNoFailure;
+ FailureKind kind = FailureKind::kNoFailure;
uint32_t types = 0U;
// Merge src into this. Uses the most severe failure kind, and the union of types.
@@ -869,7 +804,6 @@
DISALLOW_COPY_AND_ASSIGN(MethodVerifier);
};
-std::ostream& operator<<(std::ostream& os, const MethodVerifier::FailureKind& rhs);
} // namespace verifier
} // namespace art
diff --git a/runtime/verifier/method_verifier_test.cc b/runtime/verifier/method_verifier_test.cc
index bdb6b68..d987467 100644
--- a/runtime/verifier/method_verifier_test.cc
+++ b/runtime/verifier/method_verifier_test.cc
@@ -26,7 +26,7 @@
#include "dex_file-inl.h"
#include "scoped_thread_state_change-inl.h"
#include "utils.h"
-#include "verifier_log_mode.h"
+#include "verifier_enums.h"
namespace art {
namespace verifier {
@@ -41,15 +41,15 @@
// Verify the class
std::string error_msg;
- MethodVerifier::FailureKind failure = MethodVerifier::VerifyClass(
+ FailureKind failure = MethodVerifier::VerifyClass(
self, klass, nullptr, true, HardFailLogMode::kLogWarning, &error_msg);
if (android::base::StartsWith(descriptor, "Ljava/lang/invoke")) {
- ASSERT_TRUE(failure == MethodVerifier::kSoftFailure ||
- failure == MethodVerifier::kNoFailure) << error_msg;
+ ASSERT_TRUE(failure == FailureKind::kSoftFailure ||
+ failure == FailureKind::kNoFailure) << error_msg;
} else {
- ASSERT_TRUE(failure == MethodVerifier::kNoFailure) << error_msg;
+ ASSERT_TRUE(failure == FailureKind::kNoFailure) << error_msg;
}
}
diff --git a/runtime/verifier/verifier_compiler_binding.h b/runtime/verifier/verifier_compiler_binding.h
new file mode 100644
index 0000000..4f9a13f
--- /dev/null
+++ b/runtime/verifier/verifier_compiler_binding.h
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2011 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_VERIFIER_VERIFIER_COMPILER_BINDING_H_
+#define ART_RUNTIME_VERIFIER_VERIFIER_COMPILER_BINDING_H_
+
+#include <inttypes.h>
+
+#include "base/macros.h"
+#include "verifier_enums.h"
+
+namespace art {
+namespace verifier {
+
+ALWAYS_INLINE
+static inline bool CanCompilerHandleVerificationFailure(uint32_t encountered_failure_types) {
+ constexpr uint32_t unresolved_mask = verifier::VerifyError::VERIFY_ERROR_NO_CLASS
+ | verifier::VerifyError::VERIFY_ERROR_ACCESS_CLASS
+ | verifier::VerifyError::VERIFY_ERROR_ACCESS_FIELD
+ | verifier::VerifyError::VERIFY_ERROR_ACCESS_METHOD;
+ return (encountered_failure_types & (~unresolved_mask)) == 0;
+}
+
+} // namespace verifier
+} // namespace art
+
+#endif // ART_RUNTIME_VERIFIER_VERIFIER_COMPILER_BINDING_H_
diff --git a/runtime/verifier/verifier_deps.cc b/runtime/verifier/verifier_deps.cc
index 0497a6d..122e05f 100644
--- a/runtime/verifier/verifier_deps.cc
+++ b/runtime/verifier/verifier_deps.cc
@@ -23,8 +23,10 @@
#include "base/stl_util.h"
#include "compiler_callbacks.h"
#include "dex_file-inl.h"
+#include "indenter.h"
#include "leb128.h"
#include "mirror/class-inl.h"
+#include "mirror/class_loader.h"
#include "obj_ptr-inl.h"
#include "runtime.h"
@@ -502,8 +504,8 @@
void VerifierDeps::MaybeRecordVerificationStatus(const DexFile& dex_file,
dex::TypeIndex type_idx,
- MethodVerifier::FailureKind failure_kind) {
- if (failure_kind == MethodVerifier::kNoFailure) {
+ FailureKind failure_kind) {
+ if (failure_kind == FailureKind::kNoFailure) {
// We only record classes that did not fully verify at compile time.
return;
}
diff --git a/runtime/verifier/verifier_deps.h b/runtime/verifier/verifier_deps.h
index 11750fd..d69e4dc 100644
--- a/runtime/verifier/verifier_deps.h
+++ b/runtime/verifier/verifier_deps.h
@@ -21,17 +21,26 @@
#include <set>
#include <vector>
-#include "art_field.h"
-#include "art_method.h"
#include "base/array_ref.h"
#include "base/mutex.h"
-#include "indenter.h"
+#include "handle.h"
#include "method_resolution_kind.h"
-#include "method_verifier.h" // For MethodVerifier::FailureKind.
#include "obj_ptr.h"
-#include "os.h"
+#include "thread.h"
+#include "verifier_enums.h" // For MethodVerifier::FailureKind.
namespace art {
+
+class ArtField;
+class ArtMethod;
+class DexFile;
+class VariableIndentationOutputStream;
+
+namespace mirror {
+class Class;
+class ClassLoader;
+}
+
namespace verifier {
// Verification dependencies collector class used by the MethodVerifier to record
@@ -59,7 +68,7 @@
// Record the verification status of the class at `type_idx`.
static void MaybeRecordVerificationStatus(const DexFile& dex_file,
dex::TypeIndex type_idx,
- MethodVerifier::FailureKind failure_kind)
+ FailureKind failure_kind)
REQUIRES(!Locks::verifier_deps_lock_);
// Record the outcome `klass` of resolving type `type_idx` from `dex_file`.
diff --git a/runtime/verifier/verifier_enums.h b/runtime/verifier/verifier_enums.h
new file mode 100644
index 0000000..bbdd45d
--- /dev/null
+++ b/runtime/verifier/verifier_enums.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2015 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#ifndef ART_RUNTIME_VERIFIER_VERIFIER_ENUMS_H_
+#define ART_RUNTIME_VERIFIER_VERIFIER_ENUMS_H_
+
+#include <stdint.h>
+
+namespace art {
+namespace verifier {
+
+// The mode that the verifier should run as.
+enum class VerifyMode : int8_t {
+ kNone, // Everything is assumed verified.
+ kEnable, // Standard verification, try pre-verifying at compile-time.
+ kSoftFail, // Force a soft fail, punting to the interpreter with access checks.
+};
+
+// The outcome of verification.
+enum class FailureKind {
+ kNoFailure,
+ kSoftFailure,
+ kHardFailure,
+};
+std::ostream& operator<<(std::ostream& os, const FailureKind& rhs);
+
+// How to log hard failures during verification.
+enum class HardFailLogMode {
+ kLogNone, // Don't log hard failures at all.
+ kLogVerbose, // Log with severity VERBOSE.
+ kLogWarning, // Log with severity WARNING.
+ kLogInternalFatal, // Log with severity FATAL_WITHOUT_ABORT
+};
+
+/*
+ * "Direct" and "virtual" methods are stored independently. The type of call used to invoke the
+ * method determines which list we search, and whether we travel up into superclasses.
+ *
+ * (<clinit>, <init>, and methods declared "private" or "static" are stored in the "direct" list.
+ * All others are stored in the "virtual" list.)
+ */
+enum MethodType {
+ METHOD_UNKNOWN = 0,
+ METHOD_DIRECT, // <init>, private
+ METHOD_STATIC, // static
+ METHOD_VIRTUAL, // virtual
+ METHOD_SUPER, // super
+ METHOD_INTERFACE, // interface
+ METHOD_POLYMORPHIC // polymorphic
+};
+std::ostream& operator<<(std::ostream& os, const MethodType& rhs);
+
+/*
+ * An enumeration of problems that can turn up during verification.
+ * Both VERIFY_ERROR_BAD_CLASS_SOFT and VERIFY_ERROR_BAD_CLASS_HARD denote failures that cause
+ * the entire class to be rejected. However, VERIFY_ERROR_BAD_CLASS_SOFT denotes a soft failure
+ * that can potentially be corrected, and the verifier will try again at runtime.
+ * VERIFY_ERROR_BAD_CLASS_HARD denotes a hard failure that can't be corrected, and will cause
+ * the class to remain uncompiled. Other errors denote verification errors that cause bytecode
+ * to be rewritten to fail at runtime.
+ */
+enum VerifyError {
+ VERIFY_ERROR_BAD_CLASS_HARD = 1, // VerifyError; hard error that skips compilation.
+ VERIFY_ERROR_BAD_CLASS_SOFT = 2, // VerifyError; soft error that verifies again at runtime.
+
+ VERIFY_ERROR_NO_CLASS = 4, // NoClassDefFoundError.
+ VERIFY_ERROR_NO_FIELD = 8, // NoSuchFieldError.
+ VERIFY_ERROR_NO_METHOD = 16, // NoSuchMethodError.
+ VERIFY_ERROR_ACCESS_CLASS = 32, // IllegalAccessError.
+ VERIFY_ERROR_ACCESS_FIELD = 64, // IllegalAccessError.
+ VERIFY_ERROR_ACCESS_METHOD = 128, // IllegalAccessError.
+ VERIFY_ERROR_CLASS_CHANGE = 256, // IncompatibleClassChangeError.
+ VERIFY_ERROR_INSTANTIATION = 512, // InstantiationError.
+ // For opcodes that don't have complete verifier support, we need a way to continue
+ // execution at runtime without attempting to re-verify (since we know it will fail no
+ // matter what). Instead, run as the interpreter in a special "do access checks" mode
+ // which will perform verifier-like checking on the fly.
+ VERIFY_ERROR_FORCE_INTERPRETER = 1024, // Skip the verification phase at runtime;
+ // force the interpreter to do access checks.
+ // (sets a soft fail at compile time).
+ VERIFY_ERROR_LOCKING = 2048, // Could not guarantee balanced locking. This should be
+ // punted to the interpreter with access checks.
+};
+std::ostream& operator<<(std::ostream& os, const VerifyError& rhs);
+
+} // namespace verifier
+} // namespace art
+
+#endif // ART_RUNTIME_VERIFIER_VERIFIER_ENUMS_H_
diff --git a/runtime/verifier/verifier_log_mode.h b/runtime/verifier/verifier_log_mode.h
deleted file mode 100644
index e83d174..0000000
--- a/runtime/verifier/verifier_log_mode.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2016 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_RUNTIME_VERIFIER_VERIFIER_LOG_MODE_H_
-#define ART_RUNTIME_VERIFIER_VERIFIER_LOG_MODE_H_
-
-namespace art {
-namespace verifier {
-
-enum class HardFailLogMode {
- kLogNone, // Don't log hard failures at all.
- kLogVerbose, // Log with severity VERBOSE.
- kLogWarning, // Log with severity WARNING.
- kLogInternalFatal, // Log with severity FATAL_WITHOUT_ABORT
-};
-
-} // namespace verifier
-} // namespace art
-
-#endif // ART_RUNTIME_VERIFIER_VERIFIER_LOG_MODE_H_
diff --git a/runtime/verifier/verify_mode.h b/runtime/verifier/verify_mode.h
deleted file mode 100644
index bea4378..0000000
--- a/runtime/verifier/verify_mode.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2015 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_RUNTIME_VERIFIER_VERIFY_MODE_H_
-#define ART_RUNTIME_VERIFIER_VERIFY_MODE_H_
-
-#include <stdint.h>
-
-namespace art {
-namespace verifier {
-
-// The mode that the verifier should run as.
-enum class VerifyMode : int8_t {
- kNone, // Everything is assumed verified.
- kEnable, // Standard verification, try pre-verifying at compile-time.
- kSoftFail, // Force a soft fail, punting to the interpreter with access checks.
-};
-
-} // namespace verifier
-} // namespace art
-
-#endif // ART_RUNTIME_VERIFIER_VERIFY_MODE_H_
diff --git a/runtime/zip_archive.cc b/runtime/zip_archive.cc
index 416873f..0d0d5c7 100644
--- a/runtime/zip_archive.cc
+++ b/runtime/zip_archive.cc
@@ -18,6 +18,7 @@
#include <fcntl.h>
#include <stdio.h>
+#include <sys/mman.h> // For the PROT_* and MAP_* constants.
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
diff --git a/test/901-hello-ti-agent/src/art/Test901.java b/test/901-hello-ti-agent/src/art/Test901.java
index 26f7399..eef2188 100644
--- a/test/901-hello-ti-agent/src/art/Test901.java
+++ b/test/901-hello-ti-agent/src/art/Test901.java
@@ -18,8 +18,6 @@
public class Test901 {
public static void run() {
- Main.bindAgentJNIForClass(Test901.class);
-
System.out.println("Hello, world!");
if (checkLivePhase()) {
diff --git a/test/902-hello-transformation/src/art/Main.java b/test/902-hello-transformation/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/902-hello-transformation/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/902-hello-transformation/src/art/Redefinition.java b/test/902-hello-transformation/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/902-hello-transformation/src/art/Redefinition.java
+++ b/test/902-hello-transformation/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/903-hello-tagging/src/art/Test903.java b/test/903-hello-tagging/src/art/Test903.java
index 1691a94..49645dd 100644
--- a/test/903-hello-tagging/src/art/Test903.java
+++ b/test/903-hello-tagging/src/art/Test903.java
@@ -22,8 +22,6 @@
public class Test903 {
public static void run() {
- Main.bindAgentJNIForClass(Test903.class);
-
doTest();
testGetTaggedObjects();
testTags();
diff --git a/test/904-object-allocation/src/art/Main.java b/test/904-object-allocation/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/904-object-allocation/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/904-object-allocation/src/art/Test904.java b/test/904-object-allocation/src/art/Test904.java
index 70a4b98..fda8985 100644
--- a/test/904-object-allocation/src/art/Test904.java
+++ b/test/904-object-allocation/src/art/Test904.java
@@ -21,8 +21,6 @@
public class Test904 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test904.class);
-
// Use a list to ensure objects must be allocated.
ArrayList<Object> l = new ArrayList<>(100);
diff --git a/test/905-object-free/src/art/Test905.java b/test/905-object-free/src/art/Test905.java
index 1ed7a0e..62b6e62 100644
--- a/test/905-object-free/src/art/Test905.java
+++ b/test/905-object-free/src/art/Test905.java
@@ -21,7 +21,6 @@
public class Test905 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test905.class);
doTest();
}
diff --git a/test/906-iterate-heap/src/art/Test906.java b/test/906-iterate-heap/src/art/Test906.java
index feebf9c..fe18e38 100644
--- a/test/906-iterate-heap/src/art/Test906.java
+++ b/test/906-iterate-heap/src/art/Test906.java
@@ -21,7 +21,6 @@
public class Test906 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test906.class);
doTest();
}
diff --git a/test/907-get-loaded-classes/src/art/Main.java b/test/907-get-loaded-classes/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/907-get-loaded-classes/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/907-get-loaded-classes/src/art/Test907.java b/test/907-get-loaded-classes/src/art/Test907.java
index d654428..df9ce7a 100644
--- a/test/907-get-loaded-classes/src/art/Test907.java
+++ b/test/907-get-loaded-classes/src/art/Test907.java
@@ -22,7 +22,6 @@
public class Test907 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test907.class);
doTest();
}
diff --git a/test/908-gc-start-finish/src/art/Main.java b/test/908-gc-start-finish/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/908-gc-start-finish/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/908-gc-start-finish/src/art/Test908.java b/test/908-gc-start-finish/src/art/Test908.java
index ceaa98c..db84a6c 100644
--- a/test/908-gc-start-finish/src/art/Test908.java
+++ b/test/908-gc-start-finish/src/art/Test908.java
@@ -20,7 +20,6 @@
public class Test908 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test908.class);
doTest();
}
diff --git a/test/909-attach-agent/src/art/Main.java b/test/909-attach-agent/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/909-attach-agent/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/910-methods/src/art/Main.java b/test/910-methods/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/910-methods/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/910-methods/src/art/Test910.java b/test/910-methods/src/art/Test910.java
index aa6d13a..e1da277 100644
--- a/test/910-methods/src/art/Test910.java
+++ b/test/910-methods/src/art/Test910.java
@@ -22,7 +22,6 @@
public class Test910 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test910.class);
doTest();
}
diff --git a/test/911-get-stack-trace/expected.txt b/test/911-get-stack-trace/expected.txt
index fb5f71b..8510ff9 100644
--- a/test/911-get-stack-trace/expected.txt
+++ b/test/911-get-stack-trace/expected.txt
@@ -22,7 +22,7 @@
bar (IIILart/ControlData;)J 0 26
foo (IIILart/ControlData;)I 0 21
doTest ()V 38 25
- run ()V 0 30
+ run ()V 0 25
---------
print (Ljava/lang/Thread;II)V 0 38
printOrWait (IILart/ControlData;)V 6 41
@@ -42,7 +42,7 @@
bar (IIILart/ControlData;)J 0 26
foo (IIILart/ControlData;)I 0 21
doTest ()V 42 26
- run ()V 0 30
+ run ()V 0 25
---------
getStackTrace (Ljava/lang/Thread;II)[[Ljava/lang/String; -1 -2
print (Ljava/lang/Thread;II)V 0 38
@@ -57,13 +57,13 @@
baz (IIILart/ControlData;)Ljava/lang/Object; 9 34
From bottom
---------
- run ()V 0 30
+ run ()V 0 25
---------
baz (IIILart/ControlData;)Ljava/lang/Object; 9 34
bar (IIILart/ControlData;)J 0 26
foo (IIILart/ControlData;)I 0 21
doTest ()V 65 32
- run ()V 0 30
+ run ()V 0 25
---------
bar (IIILart/ControlData;)J 0 26
foo (IIILart/ControlData;)I 0 21
@@ -361,7 +361,7 @@
getAllStackTraces (I)[[Ljava/lang/Object; -1 -2
printAll (I)V 0 75
doTest ()V 128 59
- run ()V 24 42
+ run ()V 24 37
---------
main
@@ -596,7 +596,7 @@
getAllStackTraces (I)[[Ljava/lang/Object; -1 -2
printAll (I)V 0 75
doTest ()V 133 61
- run ()V 24 42
+ run ()V 24 37
---------
main
@@ -628,7 +628,7 @@
getThreadListStackTraces ([Ljava/lang/Thread;I)[[Ljava/lang/Object; -1 -2
printList ([Ljava/lang/Thread;I)V 0 68
doTest ()V 116 54
- run ()V 32 46
+ run ()V 32 41
---------
ThreadListTraces Thread 0
@@ -675,7 +675,7 @@
getThreadListStackTraces ([Ljava/lang/Thread;I)[[Ljava/lang/Object; -1 -2
printList ([Ljava/lang/Thread;I)V 0 68
doTest ()V 121 56
- run ()V 32 46
+ run ()V 32 41
---------
ThreadListTraces Thread 0
diff --git a/test/911-get-stack-trace/src/art/Main.java b/test/911-get-stack-trace/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/911-get-stack-trace/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/911-get-stack-trace/src/art/PrintThread.java b/test/911-get-stack-trace/src/art/PrintThread.java
index f50a66b..fee5ba0 100644
--- a/test/911-get-stack-trace/src/art/PrintThread.java
+++ b/test/911-get-stack-trace/src/art/PrintThread.java
@@ -41,7 +41,8 @@
// We have to ignore some threads when printing all stack traces. These are threads that may or
// may not exist depending on the environment.
public final static String IGNORE_THREAD_NAME_REGEX =
- "Binder:|RenderThread|hwuiTask|Jit thread pool worker|Instr:|JDWP|Profile Saver|main";
+ "Binder:|RenderThread|hwuiTask|Jit thread pool worker|Instr:|JDWP|Profile Saver|main|" +
+ "queued-work-looper";
public final static Matcher IGNORE_THREADS =
Pattern.compile(IGNORE_THREAD_NAME_REGEX).matcher("");
@@ -88,4 +89,4 @@
}
public static native String[][] getStackTrace(Thread thread, int start, int max);
-}
\ No newline at end of file
+}
diff --git a/test/911-get-stack-trace/src/art/Test911.java b/test/911-get-stack-trace/src/art/Test911.java
index ee59368..5774546 100644
--- a/test/911-get-stack-trace/src/art/Test911.java
+++ b/test/911-get-stack-trace/src/art/Test911.java
@@ -18,11 +18,6 @@
public class Test911 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(AllTraces.class);
- Main.bindAgentJNIForClass(Frames.class);
- Main.bindAgentJNIForClass(PrintThread.class);
- Main.bindAgentJNIForClass(ThreadListTraces.class);
-
Thread t = new Thread("Test911") {
@Override
public void run() {
diff --git a/test/912-classes/src/art/Test912.java b/test/912-classes/src/art/Test912.java
index f3ff2b0..9896eac 100644
--- a/test/912-classes/src/art/Test912.java
+++ b/test/912-classes/src/art/Test912.java
@@ -25,7 +25,6 @@
public class Test912 {
public static void run() throws Exception {
- art.Main.bindAgentJNIForClass(Test912.class);
doTest();
}
diff --git a/test/912-classes/src/art/Test912Art.java b/test/912-classes/src/art/Test912Art.java
index e438473..6da3cad 100644
--- a/test/912-classes/src/art/Test912Art.java
+++ b/test/912-classes/src/art/Test912Art.java
@@ -25,7 +25,6 @@
public class Test912Art {
public static void run() throws Exception {
- art.Main.bindAgentJNIForClass(Test912Art.class);
doTest();
}
diff --git a/test/913-heaps/src/art/Test913.java b/test/913-heaps/src/art/Test913.java
index d3b29cf..8800b1a 100644
--- a/test/913-heaps/src/art/Test913.java
+++ b/test/913-heaps/src/art/Test913.java
@@ -25,8 +25,6 @@
public class Test913 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test913.class);
-
doTest();
// Use a countdown latch for synchronization, as join() will introduce more roots.
diff --git a/test/914-hello-obsolescence/src/art/Main.java b/test/914-hello-obsolescence/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/914-hello-obsolescence/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/914-hello-obsolescence/src/art/Redefinition.java b/test/914-hello-obsolescence/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/914-hello-obsolescence/src/art/Redefinition.java
+++ b/test/914-hello-obsolescence/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/915-obsolete-2/src/art/Main.java b/test/915-obsolete-2/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/915-obsolete-2/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/915-obsolete-2/src/art/Redefinition.java b/test/915-obsolete-2/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/915-obsolete-2/src/art/Redefinition.java
+++ b/test/915-obsolete-2/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/916-obsolete-jit/src/Main.java b/test/916-obsolete-jit/src/Main.java
index cb202e4..17a7a86 100644
--- a/test/916-obsolete-jit/src/Main.java
+++ b/test/916-obsolete-jit/src/Main.java
@@ -116,7 +116,6 @@
}
public static void main(String[] args) {
- art.Main.bindAgentJNIForClass(Main.class);
doTest(new Transform(), new TestWatcher());
}
diff --git a/test/916-obsolete-jit/src/art/Main.java b/test/916-obsolete-jit/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/916-obsolete-jit/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/916-obsolete-jit/src/art/Redefinition.java b/test/916-obsolete-jit/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/916-obsolete-jit/src/art/Redefinition.java
+++ b/test/916-obsolete-jit/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/917-fields-transformation/src/art/Main.java b/test/917-fields-transformation/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/917-fields-transformation/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/917-fields-transformation/src/art/Redefinition.java b/test/917-fields-transformation/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/917-fields-transformation/src/art/Redefinition.java
+++ b/test/917-fields-transformation/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/918-fields/src/art/Main.java b/test/918-fields/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/918-fields/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/918-fields/src/art/Test918.java b/test/918-fields/src/art/Test918.java
index 89d518c..ca23c03 100644
--- a/test/918-fields/src/art/Test918.java
+++ b/test/918-fields/src/art/Test918.java
@@ -21,7 +21,6 @@
public class Test918 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test918.class);
doTest();
}
diff --git a/test/919-obsolete-fields/src/art/Main.java b/test/919-obsolete-fields/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/919-obsolete-fields/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/919-obsolete-fields/src/art/Redefinition.java b/test/919-obsolete-fields/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/919-obsolete-fields/src/art/Redefinition.java
+++ b/test/919-obsolete-fields/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/920-objects/src/art/Main.java b/test/920-objects/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/920-objects/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/920-objects/src/art/Test920.java b/test/920-objects/src/art/Test920.java
index 708e417..03038a6 100644
--- a/test/920-objects/src/art/Test920.java
+++ b/test/920-objects/src/art/Test920.java
@@ -21,7 +21,6 @@
public class Test920 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test920.class);
doTest();
}
diff --git a/test/921-hello-failure/src/art/Main.java b/test/921-hello-failure/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/921-hello-failure/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/921-hello-failure/src/art/Redefinition.java b/test/921-hello-failure/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/921-hello-failure/src/art/Redefinition.java
+++ b/test/921-hello-failure/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/922-properties/src/art/Main.java b/test/922-properties/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/922-properties/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/922-properties/src/art/Test922.java b/test/922-properties/src/art/Test922.java
index 4b2204a..d105a21 100644
--- a/test/922-properties/src/art/Test922.java
+++ b/test/922-properties/src/art/Test922.java
@@ -21,7 +21,6 @@
public class Test922 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test922.class);
doTest();
}
diff --git a/test/923-monitors/src/art/Main.java b/test/923-monitors/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/923-monitors/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/923-monitors/src/art/Test923.java b/test/923-monitors/src/art/Test923.java
index 02e86a6..0995cf0 100644
--- a/test/923-monitors/src/art/Test923.java
+++ b/test/923-monitors/src/art/Test923.java
@@ -23,7 +23,6 @@
public class Test923 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test923.class);
doTest();
}
diff --git a/test/924-threads/src/art/Main.java b/test/924-threads/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/924-threads/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/924-threads/src/art/Test924.java b/test/924-threads/src/art/Test924.java
index 5445939..84b7c62 100644
--- a/test/924-threads/src/art/Test924.java
+++ b/test/924-threads/src/art/Test924.java
@@ -29,8 +29,6 @@
public class Test924 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test924.class);
-
// Run the test on its own thread, so we have a known state for the "current" thread.
Thread t = new Thread("TestThread") {
@Override
diff --git a/test/925-threadgroups/src/art/Main.java b/test/925-threadgroups/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/925-threadgroups/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/925-threadgroups/src/art/Test925.java b/test/925-threadgroups/src/art/Test925.java
index 14ca7a7..8d1e665 100644
--- a/test/925-threadgroups/src/art/Test925.java
+++ b/test/925-threadgroups/src/art/Test925.java
@@ -25,7 +25,6 @@
public class Test925 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test925.class);
doTest();
}
diff --git a/test/926-multi-obsolescence/src/art/Main.java b/test/926-multi-obsolescence/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/926-multi-obsolescence/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/926-multi-obsolescence/src/art/Redefinition.java b/test/926-multi-obsolescence/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/926-multi-obsolescence/src/art/Redefinition.java
+++ b/test/926-multi-obsolescence/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/927-timers/src/art/Main.java b/test/927-timers/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/927-timers/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/927-timers/src/art/Test927.java b/test/927-timers/src/art/Test927.java
index 1ed0160..e5bd8f1 100644
--- a/test/927-timers/src/art/Test927.java
+++ b/test/927-timers/src/art/Test927.java
@@ -20,7 +20,6 @@
public class Test927 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test927.class);
doTest();
}
diff --git a/test/928-jni-table/src/art/Main.java b/test/928-jni-table/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/928-jni-table/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/928-jni-table/src/art/Test928.java b/test/928-jni-table/src/art/Test928.java
index 3f3935d..0fbfb7e 100644
--- a/test/928-jni-table/src/art/Test928.java
+++ b/test/928-jni-table/src/art/Test928.java
@@ -18,7 +18,6 @@
public class Test928 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test928.class);
doJNITableTest();
System.out.println("Done");
diff --git a/test/929-search/src/Main.java b/test/929-search/src/Main.java
index 4073c3f..bbeb081 100644
--- a/test/929-search/src/Main.java
+++ b/test/929-search/src/Main.java
@@ -18,7 +18,6 @@
public class Main {
public static void main(String[] args) throws Exception {
- art.Main.bindAgentJNIForClass(Main.class);
doTest();
}
diff --git a/test/929-search/src/art/Main.java b/test/929-search/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/929-search/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/930-hello-retransform/src/art/Main.java b/test/930-hello-retransform/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/930-hello-retransform/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/930-hello-retransform/src/art/Redefinition.java b/test/930-hello-retransform/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/930-hello-retransform/src/art/Redefinition.java
+++ b/test/930-hello-retransform/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/931-agent-thread/src/art/Main.java b/test/931-agent-thread/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/931-agent-thread/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/931-agent-thread/src/art/Test931.java b/test/931-agent-thread/src/art/Test931.java
index bc096a7..be69466 100644
--- a/test/931-agent-thread/src/art/Test931.java
+++ b/test/931-agent-thread/src/art/Test931.java
@@ -20,7 +20,6 @@
public class Test931 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test931.class);
testAgentThread();
System.out.println("Done");
diff --git a/test/932-transform-saves/src/art/Main.java b/test/932-transform-saves/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/932-transform-saves/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/932-transform-saves/src/art/Redefinition.java b/test/932-transform-saves/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/932-transform-saves/src/art/Redefinition.java
+++ b/test/932-transform-saves/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/933-misc-events/src/art/Main.java b/test/933-misc-events/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/933-misc-events/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/933-misc-events/src/art/Test933.java b/test/933-misc-events/src/art/Test933.java
index afebbf8..04f96e1 100644
--- a/test/933-misc-events/src/art/Test933.java
+++ b/test/933-misc-events/src/art/Test933.java
@@ -18,7 +18,6 @@
public class Test933 {
public static void run() throws Exception {
- Main.bindAgentJNIForClass(Test933.class);
testSigQuit();
System.out.println("Done");
diff --git a/test/934-load-transform/src/Main.java b/test/934-load-transform/src/Main.java
index 69c839f..1401b7d 100644
--- a/test/934-load-transform/src/Main.java
+++ b/test/934-load-transform/src/Main.java
@@ -70,7 +70,6 @@
}
public static void main(String[] args) {
- art.Main.bindAgentJNIForClass(Main.class);
// Don't pop transformations. Make sure that even if 2 threads race to define the class both
// will get the same result.
setPopRetransformations(false);
diff --git a/test/934-load-transform/src/art/Main.java b/test/934-load-transform/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/934-load-transform/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/934-load-transform/src/art/Redefinition.java b/test/934-load-transform/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/934-load-transform/src/art/Redefinition.java
+++ b/test/934-load-transform/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/935-non-retransformable/src/art/Main.java b/test/935-non-retransformable/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/935-non-retransformable/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/935-non-retransformable/src/art/Redefinition.java b/test/935-non-retransformable/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/935-non-retransformable/src/art/Redefinition.java
+++ b/test/935-non-retransformable/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/936-search-onload/src/Main.java b/test/936-search-onload/src/Main.java
index 8d40753..2e7a871 100644
--- a/test/936-search-onload/src/Main.java
+++ b/test/936-search-onload/src/Main.java
@@ -18,7 +18,6 @@
public class Main {
public static void main(String[] args) throws Exception {
- art.Main.bindAgentJNIForClass(Main.class);
doTest();
}
diff --git a/test/936-search-onload/src/art/Main.java b/test/936-search-onload/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/936-search-onload/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/937-hello-retransform-package/src/art/Main.java b/test/937-hello-retransform-package/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/937-hello-retransform-package/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/937-hello-retransform-package/src/art/Redefinition.java b/test/937-hello-retransform-package/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/937-hello-retransform-package/src/art/Redefinition.java
+++ b/test/937-hello-retransform-package/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/938-load-transform-bcp/src/Main.java b/test/938-load-transform-bcp/src/Main.java
index e560942..69658c0 100644
--- a/test/938-load-transform-bcp/src/Main.java
+++ b/test/938-load-transform-bcp/src/Main.java
@@ -97,7 +97,6 @@
}
public static void main(String[] args) {
- art.Main.bindAgentJNIForClass(Main.class);
setPopRetransformations(false);
addCommonTransformationResult("java/util/OptionalLong", CLASS_BYTES, DEX_BYTES);
enableCommonRetransformation(true);
diff --git a/test/938-load-transform-bcp/src/art/Main.java b/test/938-load-transform-bcp/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/938-load-transform-bcp/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/938-load-transform-bcp/src/art/Redefinition.java b/test/938-load-transform-bcp/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/938-load-transform-bcp/src/art/Redefinition.java
+++ b/test/938-load-transform-bcp/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/939-hello-transformation-bcp/src/art/Main.java b/test/939-hello-transformation-bcp/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/939-hello-transformation-bcp/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/939-hello-transformation-bcp/src/art/Redefinition.java b/test/939-hello-transformation-bcp/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/939-hello-transformation-bcp/src/art/Redefinition.java
+++ b/test/939-hello-transformation-bcp/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/940-recursive-obsolete/src/art/Main.java b/test/940-recursive-obsolete/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/940-recursive-obsolete/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/940-recursive-obsolete/src/art/Redefinition.java b/test/940-recursive-obsolete/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/940-recursive-obsolete/src/art/Redefinition.java
+++ b/test/940-recursive-obsolete/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/941-recurive-obsolete-jit/src/Main.java b/test/941-recurive-obsolete-jit/src/Main.java
index 1c391a4..89d593b 100644
--- a/test/941-recurive-obsolete-jit/src/Main.java
+++ b/test/941-recurive-obsolete-jit/src/Main.java
@@ -101,7 +101,6 @@
}
public static void main(String[] args) {
- art.Main.bindAgentJNIForClass(Main.class);
doTest(new Transform());
}
diff --git a/test/941-recurive-obsolete-jit/src/art/Main.java b/test/941-recurive-obsolete-jit/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/941-recurive-obsolete-jit/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/941-recurive-obsolete-jit/src/art/Redefinition.java b/test/941-recurive-obsolete-jit/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/941-recurive-obsolete-jit/src/art/Redefinition.java
+++ b/test/941-recurive-obsolete-jit/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/942-private-recursive/src/art/Main.java b/test/942-private-recursive/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/942-private-recursive/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/942-private-recursive/src/art/Redefinition.java b/test/942-private-recursive/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/942-private-recursive/src/art/Redefinition.java
+++ b/test/942-private-recursive/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/943-private-recursive-jit/src/Main.java b/test/943-private-recursive-jit/src/Main.java
index 01760ad..871c636 100644
--- a/test/943-private-recursive-jit/src/Main.java
+++ b/test/943-private-recursive-jit/src/Main.java
@@ -111,7 +111,6 @@
}
public static void main(String[] args) {
- art.Main.bindAgentJNIForClass(Main.class);
doTest(new Transform());
}
diff --git a/test/943-private-recursive-jit/src/art/Main.java b/test/943-private-recursive-jit/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/943-private-recursive-jit/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/943-private-recursive-jit/src/art/Redefinition.java b/test/943-private-recursive-jit/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/943-private-recursive-jit/src/art/Redefinition.java
+++ b/test/943-private-recursive-jit/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/944-transform-classloaders/src/art/Main.java b/test/944-transform-classloaders/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/944-transform-classloaders/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/944-transform-classloaders/src/art/Redefinition.java b/test/944-transform-classloaders/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/944-transform-classloaders/src/art/Redefinition.java
+++ b/test/944-transform-classloaders/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/945-obsolete-native/src/art/Main.java b/test/945-obsolete-native/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/945-obsolete-native/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/945-obsolete-native/src/art/Redefinition.java b/test/945-obsolete-native/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/945-obsolete-native/src/art/Redefinition.java
+++ b/test/945-obsolete-native/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/945-obsolete-native/src/art/Test945.java b/test/945-obsolete-native/src/art/Test945.java
index 6cf31f6..97fd0bb 100644
--- a/test/945-obsolete-native/src/art/Test945.java
+++ b/test/945-obsolete-native/src/art/Test945.java
@@ -21,9 +21,9 @@
public class Test945 {
static class Transform {
- static {
- art.Main.bindAgentJNIForClass(Transform.class);
- }
+ // static block to ensure that there is a <clinit> method. This used to be needed due to a bug.
+ // Since it's annoying to recompute the transformed bytes we will just leave this here.
+ static { }
public void sayHi(Runnable r) {
System.out.println("hello");
diff --git a/test/946-obsolete-throw/src/art/Main.java b/test/946-obsolete-throw/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/946-obsolete-throw/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/946-obsolete-throw/src/art/Redefinition.java b/test/946-obsolete-throw/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/946-obsolete-throw/src/art/Redefinition.java
+++ b/test/946-obsolete-throw/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/947-reflect-method/src/art/Main.java b/test/947-reflect-method/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/947-reflect-method/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/947-reflect-method/src/art/Redefinition.java b/test/947-reflect-method/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/947-reflect-method/src/art/Redefinition.java
+++ b/test/947-reflect-method/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/948-change-annotations/src/Main.java b/test/948-change-annotations/src/Main.java
index 5d3406d..4fd2bfd 100644
--- a/test/948-change-annotations/src/Main.java
+++ b/test/948-change-annotations/src/Main.java
@@ -56,7 +56,6 @@
"AAQgAAACAAAAmwIAAAAgAAABAAAApwIAAAAQAAABAAAAuAIAAA==");
public static void main(String[] args) {
- art.Main.bindAgentJNIForClass(Main.class);
doTest(new RemoveAnnotationsTest());
doTest(new AddAnnotationsTest());
doTest(new ChangeAnnotationValues());
diff --git a/test/948-change-annotations/src/art/Main.java b/test/948-change-annotations/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/948-change-annotations/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/948-change-annotations/src/art/Redefinition.java b/test/948-change-annotations/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/948-change-annotations/src/art/Redefinition.java
+++ b/test/948-change-annotations/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/949-in-memory-transform/src/art/Main.java b/test/949-in-memory-transform/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/949-in-memory-transform/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/949-in-memory-transform/src/art/Redefinition.java b/test/949-in-memory-transform/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/949-in-memory-transform/src/art/Redefinition.java
+++ b/test/949-in-memory-transform/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/950-redefine-intrinsic/src/Main.java b/test/950-redefine-intrinsic/src/Main.java
index 369a8f4..d4f4e8f 100644
--- a/test/950-redefine-intrinsic/src/Main.java
+++ b/test/950-redefine-intrinsic/src/Main.java
@@ -426,7 +426,6 @@
}
public static void main(String[] args) {
- art.Main.bindAgentJNIForClass(Main.class);
doTest(10000);
}
diff --git a/test/950-redefine-intrinsic/src/art/Main.java b/test/950-redefine-intrinsic/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/950-redefine-intrinsic/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/950-redefine-intrinsic/src/art/Redefinition.java b/test/950-redefine-intrinsic/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/950-redefine-intrinsic/src/art/Redefinition.java
+++ b/test/950-redefine-intrinsic/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/951-threaded-obsolete/src/art/Main.java b/test/951-threaded-obsolete/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/951-threaded-obsolete/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/951-threaded-obsolete/src/art/Redefinition.java b/test/951-threaded-obsolete/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/951-threaded-obsolete/src/art/Redefinition.java
+++ b/test/951-threaded-obsolete/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/980-redefine-object/src/Main.java b/test/980-redefine-object/src/Main.java
index 63c0cab..2428b55 100644
--- a/test/980-redefine-object/src/Main.java
+++ b/test/980-redefine-object/src/Main.java
@@ -316,7 +316,6 @@
}
public static void main(String[] args) {
- art.Main.bindAgentJNIForClass(Main.class);
doTest();
}
diff --git a/test/980-redefine-object/src/art/Main.java b/test/980-redefine-object/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/980-redefine-object/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/980-redefine-object/src/art/Redefinition.java b/test/980-redefine-object/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/980-redefine-object/src/art/Redefinition.java
+++ b/test/980-redefine-object/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/981-dedup-original-dex/src/art/Main.java b/test/981-dedup-original-dex/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/981-dedup-original-dex/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/981-dedup-original-dex/src/art/Redefinition.java b/test/981-dedup-original-dex/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/981-dedup-original-dex/src/art/Redefinition.java
+++ b/test/981-dedup-original-dex/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/982-ok-no-retransform/src/art/Main.java b/test/982-ok-no-retransform/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/982-ok-no-retransform/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/982-ok-no-retransform/src/art/Redefinition.java b/test/982-ok-no-retransform/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/982-ok-no-retransform/src/art/Redefinition.java
+++ b/test/982-ok-no-retransform/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/983-source-transform-verify/src/art/Main.java b/test/983-source-transform-verify/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/983-source-transform-verify/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/983-source-transform-verify/src/art/Redefinition.java b/test/983-source-transform-verify/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/983-source-transform-verify/src/art/Redefinition.java
+++ b/test/983-source-transform-verify/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/984-obsolete-invoke/src/art/Main.java b/test/984-obsolete-invoke/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/984-obsolete-invoke/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/984-obsolete-invoke/src/art/Redefinition.java b/test/984-obsolete-invoke/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/984-obsolete-invoke/src/art/Redefinition.java
+++ b/test/984-obsolete-invoke/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/984-obsolete-invoke/src/art/Test984.java b/test/984-obsolete-invoke/src/art/Test984.java
index 3fe66f6..0b0767c 100644
--- a/test/984-obsolete-invoke/src/art/Test984.java
+++ b/test/984-obsolete-invoke/src/art/Test984.java
@@ -72,7 +72,6 @@
"AA==");
public static void run() {
- art.Main.bindAgentJNIForClass(Test984.class);
doTest();
}
diff --git a/test/985-re-obsolete/src/art/Main.java b/test/985-re-obsolete/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/985-re-obsolete/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/985-re-obsolete/src/art/Redefinition.java b/test/985-re-obsolete/src/art/Redefinition.java
index 0350ab4..56d2938 100644
--- a/test/985-re-obsolete/src/art/Redefinition.java
+++ b/test/985-re-obsolete/src/art/Redefinition.java
@@ -19,11 +19,6 @@
import java.util.ArrayList;
// Common Redefinition functions. Placed here for use by CTS
public class Redefinition {
- // Bind native functions.
- static {
- Main.bindAgentJNIForClass(Redefinition.class);
- }
-
public static final class CommonClassDefinition {
public final Class<?> target;
public final byte[] class_file_bytes;
diff --git a/test/986-native-method-bind/expected.txt b/test/986-native-method-bind/expected.txt
index 3376e6f..a470285 100644
--- a/test/986-native-method-bind/expected.txt
+++ b/test/986-native-method-bind/expected.txt
@@ -2,6 +2,7 @@
Hello - 2
private static native void art.Test986$Transform.sayHi() = Java_art_Test986_00024Transform_sayHi__ -> NoReallySayGoodbye
Bye
+private static native void art.Test986.rebindTransformClass(java.lang.Class) = Java_art_Test986_rebindTransformClass -> Java_art_Test986_rebindTransformClass
private static native void art.Test986$Transform.sayHi() = Java_art_Test986_00024Transform_sayHi__ -> Java_art_Test986_00024Transform_sayHi2
private static native void art.Test986$Transform.sayHi2() = Java_art_Test986_00024Transform_sayHi2 -> Java_art_Test986_00024Transform_sayHi2
Hello - 2
diff --git a/test/986-native-method-bind/src/art/Main.java b/test/986-native-method-bind/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/986-native-method-bind/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/986-native-method-bind/src/art/Test986.java b/test/986-native-method-bind/src/art/Test986.java
index aac73d3..f621c9f 100644
--- a/test/986-native-method-bind/src/art/Test986.java
+++ b/test/986-native-method-bind/src/art/Test986.java
@@ -20,13 +20,6 @@
import java.util.HashMap;
public class Test986 {
- static {
- // NB This is called before any setup is done so we don't need to worry about getting bind
- // events.
- Main.bindAgentJNIForClass(Test986.class);
- }
-
-
private static final HashMap<Method, String> SymbolMap = new HashMap<>();
// A class with a native method we can play with.
diff --git a/test/987-agent-bind/src/art/Main.java b/test/987-agent-bind/src/art/Main.java
deleted file mode 100644
index 8b01920..0000000
--- a/test/987-agent-bind/src/art/Main.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package art;
-
-// Binder class so the agent's C code has something that can be bound and exposed to tests.
-// In a package to separate cleanly and work around CTS reference issues (though this class
-// should be replaced in the CTS version).
-public class Main {
- // Load the given class with the given classloader, and bind all native methods to corresponding
- // C methods in the agent. Will abort if any of the steps fail.
- public static native void bindAgentJNI(String className, ClassLoader classLoader);
- // Same as above, giving the class directly.
- public static native void bindAgentJNIForClass(Class<?> klass);
-}
diff --git a/test/Android.run-test-jvmti-java-library.mk b/test/Android.run-test-jvmti-java-library.mk
index 70ee693..c480be5 100644
--- a/test/Android.run-test-jvmti-java-library.mk
+++ b/test/Android.run-test-jvmti-java-library.mk
@@ -74,6 +74,8 @@
981-dedup-original-dex/src/art/Test981.java \
982-ok-no-retransform/src/art/Test982.java \
984-obsolete-invoke/src/art/Test984.java \
+ 985-re-obsolete/src/art/Test985.java \
+ 986-native-method-bind/src/art/Test986.java \
JVMTI_RUN_TEST_GENERATED_NUMBERS := \
901 \
@@ -114,6 +116,8 @@
981 \
982 \
984 \
+ 985 \
+ 986 \
# Try to enforce that the directories correspond to the Java files we pull in.
JVMTI_RUN_TEST_DIR_CHECK := $(sort $(foreach DIR,$(JVMTI_RUN_TEST_GENERATED_NUMBERS), \
diff --git a/test/ti-agent/agent_startup.cc b/test/ti-agent/agent_startup.cc
index be73de5..d6fd266 100644
--- a/test/ti-agent/agent_startup.cc
+++ b/test/ti-agent/agent_startup.cc
@@ -14,8 +14,6 @@
* limitations under the License.
*/
-#include "agent_startup.h"
-
#include "android-base/logging.h"
#include "android-base/macros.h"
@@ -26,75 +24,7 @@
namespace art {
-static constexpr const char* kMainClass = "art/Main";
-
-static StartCallback gCallback = nullptr;
-
-// TODO: Check this. This may not work on device. The classloader containing the app's classes
-// may not have been created at this point (i.e., if it's not the system classloader).
-static void JNICALL VMInitCallback(jvmtiEnv* callback_jvmti_env,
- JNIEnv* jni_env,
- jthread thread ATTRIBUTE_UNUSED) {
- // Bind kMainClass native methods.
- BindFunctions(callback_jvmti_env, jni_env, kMainClass);
-
- if (gCallback != nullptr) {
- gCallback(callback_jvmti_env, jni_env);
- gCallback = nullptr;
- }
-
- // And delete the jvmtiEnv.
- callback_jvmti_env->DisposeEnvironment();
-}
-
-// Install a phase callback that will bind JNI functions on VMInit.
-void BindOnLoad(JavaVM* vm, StartCallback callback) {
- // Use a new jvmtiEnv. Otherwise we might collide with table changes.
- jvmtiEnv* install_env;
- if (vm->GetEnv(reinterpret_cast<void**>(&install_env), JVMTI_VERSION_1_0) != 0) {
- LOG(FATAL) << "Could not get jvmtiEnv";
- }
- SetAllCapabilities(install_env);
-
- {
- jvmtiEventCallbacks callbacks;
- memset(&callbacks, 0, sizeof(jvmtiEventCallbacks));
- callbacks.VMInit = VMInitCallback;
-
- CheckJvmtiError(install_env, install_env->SetEventCallbacks(&callbacks, sizeof(callbacks)));
- }
-
- CheckJvmtiError(install_env, install_env->SetEventNotificationMode(JVMTI_ENABLE,
- JVMTI_EVENT_VM_INIT,
- nullptr));
-
- gCallback = callback;
-}
-
-// Ensure binding of the Main class when the agent is started through OnAttach.
-void BindOnAttach(JavaVM* vm, StartCallback callback) {
- // Get a JNIEnv. As the thread is attached, we must not destroy it.
- JNIEnv* env;
- CHECK_EQ(0, vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6))
- << "Could not get JNIEnv";
-
- jvmtiEnv* bind_jvmti_env;
- CHECK_EQ(0, vm->GetEnv(reinterpret_cast<void**>(&bind_jvmti_env), JVMTI_VERSION_1_0))
- << "Could not get jvmtiEnv";
- SetAllCapabilities(bind_jvmti_env);
-
- BindFunctions(bind_jvmti_env, env, kMainClass);
-
- if (callback != nullptr) {
- callback(bind_jvmti_env, env);
- }
-
- if (bind_jvmti_env->DisposeEnvironment() != JVMTI_ERROR_NONE) {
- LOG(FATAL) << "Could not dispose temporary jvmtiEnv";
- }
-}
-
-// Utility functions for art.Main shim.
+// Utility functions for binding jni methods.
extern "C" JNIEXPORT void JNICALL Java_art_Main_bindAgentJNI(
JNIEnv* env, jclass klass ATTRIBUTE_UNUSED, jstring className, jobject classLoader) {
ScopedUtfChars name(env, className);
diff --git a/test/ti-agent/agent_startup.h b/test/ti-agent/agent_startup.h
deleted file mode 100644
index 4963320..0000000
--- a/test/ti-agent/agent_startup.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2017 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef ART_TEST_TI_AGENT_AGENT_STARTUP_H_
-#define ART_TEST_TI_AGENT_AGENT_STARTUP_H_
-
-#include <functional>
-
-#include "jni.h"
-#include "jvmti.h"
-
-namespace art {
-
-using StartCallback = void(*)(jvmtiEnv*, JNIEnv*);
-
-// Ensure binding of the Main class when the agent is started through OnLoad.
-void BindOnLoad(JavaVM* vm, StartCallback callback);
-
-// Ensure binding of the Main class when the agent is started through OnAttach.
-void BindOnAttach(JavaVM* vm, StartCallback callback);
-
-} // namespace art
-
-#endif // ART_TEST_TI_AGENT_AGENT_STARTUP_H_
diff --git a/test/ti-agent/common_load.cc b/test/ti-agent/common_load.cc
index 3455409..fd47f59 100644
--- a/test/ti-agent/common_load.cc
+++ b/test/ti-agent/common_load.cc
@@ -20,7 +20,6 @@
#include "base/logging.h"
#include "base/macros.h"
-#include "agent_startup.h"
#include "common_helper.h"
#include "jni_binder.h"
#include "jvmti_helper.h"
@@ -117,8 +116,6 @@
SetIsJVM(remaining_options);
- BindOnLoad(vm, nullptr);
-
AgentLib* lib = FindAgent(name_option);
OnLoad fn = nullptr;
if (lib == nullptr) {
@@ -141,8 +138,6 @@
return -1;
}
- BindOnAttach(vm, nullptr);
-
AgentLib* lib = FindAgent(name_option);
if (lib == nullptr) {
printf("Unable to find agent named: %s, add it to the list in test/ti-agent/common_load.cc\n",