changeset in /hg/icedtea6: 2009-02-26 Gary Benson <gbenson at red...
Gary Benson
gbenson at redhat.com
Thu Feb 26 07:28:29 PST 2009
changeset 252bd67d10c6 in /hg/icedtea6
details: http://icedtea.classpath.org/hg/icedtea6?cmd=changeset;node=252bd67d10c6
description:
2009-02-26 Gary Benson <gbenson at redhat.com>
PR icedtea/202:
* ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
(SharkRuntime::_register_finalizer): New variable.
(SharkRuntime::register_finalizer): New method.
(SharkRuntime::register_finalizer_C): Likewise.
* ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
(SharkRuntime::_register_finalizer): New variable.
(SharkRuntime::initialize): Initialize the above.
(SharkRuntime::register_finalizer_C): New method.
* ports/hotspot/src/share/vm/shark/sharkBlock.hpp
(SharkBlock::call_register_finalizer): New method.
(SharkBlock::do_return): Call the above when compiling
java.lang.Object.<init>.
* ports/hotspot/src/share/vm/shark/sharkBlock.cpp
(SharkBlock::call_register_finalizer): New method.
diffstat:
5 files changed, 93 insertions(+), 3 deletions(-)
ChangeLog | 18 ++++++++
ports/hotspot/src/share/vm/shark/sharkBlock.cpp | 43 +++++++++++++++++++++
ports/hotspot/src/share/vm/shark/sharkBlock.hpp | 8 ++-
ports/hotspot/src/share/vm/shark/sharkRuntime.cpp | 18 ++++++++
ports/hotspot/src/share/vm/shark/sharkRuntime.hpp | 9 +++-
diffs (190 lines):
diff -r 0e0e3cf10018 -r 252bd67d10c6 ChangeLog
--- a/ChangeLog Thu Feb 26 08:55:00 2009 -0500
+++ b/ChangeLog Thu Feb 26 10:24:35 2009 -0500
@@ -1,3 +1,21 @@ 2009-02-26 Gary Benson <gbenson at redhat
+2009-02-26 Gary Benson <gbenson at redhat.com>
+
+ PR icedtea/202:
+ * ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
+ (SharkRuntime::_register_finalizer): New variable.
+ (SharkRuntime::register_finalizer): New method.
+ (SharkRuntime::register_finalizer_C): Likewise.
+ * ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
+ (SharkRuntime::_register_finalizer): New variable.
+ (SharkRuntime::initialize): Initialize the above.
+ (SharkRuntime::register_finalizer_C): New method.
+ * ports/hotspot/src/share/vm/shark/sharkBlock.hpp
+ (SharkBlock::call_register_finalizer): New method.
+ (SharkBlock::do_return): Call the above when compiling
+ java.lang.Object.<init>.
+ * ports/hotspot/src/share/vm/shark/sharkBlock.cpp
+ (SharkBlock::call_register_finalizer): New method.
+
2009-02-26 Gary Benson <gbenson at redhat.com>
* ports/hotspot/src/share/vm/shark/sharkState.cpp: Updated copyright.
diff -r 0e0e3cf10018 -r 252bd67d10c6 ports/hotspot/src/share/vm/shark/sharkBlock.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Thu Feb 26 08:55:00 2009 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkBlock.cpp Thu Feb 26 10:24:35 2009 -0500
@@ -1160,6 +1160,49 @@ void SharkBlock::add_safepoint()
current_state()->merge(orig_state, orig_block, safepointed_block);
}
+void SharkBlock::call_register_finalizer(Value *receiver)
+{
+ BasicBlock *orig_block = builder()->GetInsertBlock();
+ SharkState *orig_state = current_state()->copy();
+
+ BasicBlock *do_call = function()->CreateBlock("has_finalizer");
+ BasicBlock *done = function()->CreateBlock("done");
+
+ Value *klass = builder()->CreateValueOfStructEntry(
+ receiver,
+ in_ByteSize(oopDesc::klass_offset_in_bytes()),
+ SharkType::jobject_type(),
+ "klass");
+
+ Value *klass_part = builder()->CreateAddressOfStructEntry(
+ klass,
+ in_ByteSize(klassOopDesc::klass_part_offset_in_bytes()),
+ SharkType::klass_type(),
+ "klass_part");
+
+ Value *access_flags = builder()->CreateValueOfStructEntry(
+ klass_part,
+ in_ByteSize(Klass::access_flags_offset_in_bytes()),
+ SharkType::jint_type(),
+ "access_flags");
+
+ builder()->CreateCondBr(
+ builder()->CreateICmpNE(
+ builder()->CreateAnd(
+ access_flags,
+ LLVMValue::jint_constant(JVM_ACC_HAS_FINALIZER)),
+ LLVMValue::intptr_constant(0)),
+ do_call, done);
+
+ builder()->SetInsertPoint(do_call);
+ call_vm(SharkRuntime::register_finalizer(), receiver);
+ BasicBlock *branch_block = builder()->GetInsertBlock();
+ builder()->CreateBr(done);
+
+ builder()->SetInsertPoint(done);
+ current_state()->merge(orig_state, orig_block, branch_block);
+}
+
void SharkBlock::handle_return(BasicType type, Value* exception)
{
assert (exception == NULL || type == T_VOID, "exception OR result, please");
diff -r 0e0e3cf10018 -r 252bd67d10c6 ports/hotspot/src/share/vm/shark/sharkBlock.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkBlock.hpp Thu Feb 26 08:55:00 2009 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkBlock.hpp Thu Feb 26 10:24:35 2009 -0500
@@ -1,6 +1,6 @@
/*
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright 2008 Red Hat, Inc.
+ * Copyright 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -403,6 +403,7 @@ class SharkBlock : public ResourceObj {
// Returns
private:
+ void call_register_finalizer(llvm::Value* receiver);
void handle_return(BasicType type, llvm::Value* exception);
void release_locked_monitors();
@@ -468,7 +469,10 @@ class SharkBlock : public ResourceObj {
private:
void do_return(BasicType type)
{
- add_safepoint();
+ if (target()->intrinsic_id() == vmIntrinsics::_Object_init)
+ call_register_finalizer(local(0)->jobject_value());
+ else
+ add_safepoint();
handle_return(type, NULL);
}
void do_athrow()
diff -r 0e0e3cf10018 -r 252bd67d10c6 ports/hotspot/src/share/vm/shark/sharkRuntime.cpp
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Thu Feb 26 08:55:00 2009 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.cpp Thu Feb 26 10:24:35 2009 -0500
@@ -35,6 +35,7 @@ Constant* SharkRuntime::_newarray;
Constant* SharkRuntime::_newarray;
Constant* SharkRuntime::_anewarray;
Constant* SharkRuntime::_multianewarray;
+Constant* SharkRuntime::_register_finalizer;
Constant* SharkRuntime::_resolve_get_put;
Constant* SharkRuntime::_resolve_invoke;
Constant* SharkRuntime::_resolve_klass;
@@ -112,6 +113,14 @@ void SharkRuntime::initialize(SharkBuild
(intptr_t) multianewarray_C,
FunctionType::get(Type::VoidTy, params, false),
"SharkRuntime__multianewarray");
+
+ params.clear();
+ params.push_back(SharkType::thread_type());
+ params.push_back(SharkType::oop_type());
+ _register_finalizer = builder->make_function(
+ (intptr_t) register_finalizer_C,
+ FunctionType::get(Type::VoidTy, params, false),
+ "SharkRuntime__register_finalizer");
params.clear();
params.push_back(SharkType::thread_type());
@@ -339,6 +348,15 @@ JRT_ENTRY(void, SharkRuntime::multianewa
klassOop klass = method(thread)->constants()->klass_at(index, CHECK);
oop obj = arrayKlass::cast(klass)->multi_allocate(ndims, dims, CHECK);
thread->set_vm_result(obj);
+}
+JRT_END
+
+JRT_ENTRY(void, SharkRuntime::register_finalizer_C(JavaThread* thread,
+ oop object))
+{
+ assert(object->is_oop(), "should be");
+ assert(object->klass()->klass_part()->has_finalizer(), "should have");
+ instanceKlass::register_finalizer(instanceOop(object), CHECK);
}
JRT_END
diff -r 0e0e3cf10018 -r 252bd67d10c6 ports/hotspot/src/share/vm/shark/sharkRuntime.hpp
--- a/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp Thu Feb 26 08:55:00 2009 -0500
+++ b/ports/hotspot/src/share/vm/shark/sharkRuntime.hpp Thu Feb 26 10:24:35 2009 -0500
@@ -1,6 +1,6 @@
/*
* Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved.
- * Copyright 2008 Red Hat, Inc.
+ * Copyright 2008, 2009 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,7 @@ class SharkRuntime : public AllStatic {
static llvm::Constant* _newarray;
static llvm::Constant* _anewarray;
static llvm::Constant* _multianewarray;
+ static llvm::Constant* _register_finalizer;
static llvm::Constant* _resolve_get_put;
static llvm::Constant* _resolve_invoke;
static llvm::Constant* _resolve_klass;
@@ -73,6 +74,10 @@ class SharkRuntime : public AllStatic {
{
return _multianewarray;
}
+ static llvm::Constant* register_finalizer()
+ {
+ return _register_finalizer;
+ }
static llvm::Constant* resolve_get_put()
{
return _resolve_get_put;
@@ -117,6 +122,8 @@ class SharkRuntime : public AllStatic {
int index,
int ndims,
int* dims);
+
+ static void register_finalizer_C(JavaThread* thread, oop object);
static void resolve_get_put_C(JavaThread* thread,
ConstantPoolCacheEntry* entry,
More information about the distro-pkg-dev
mailing list