src/share/vm/shark/sharkNativeWrapper.cpp
Print this page
rev 3850 : [mq]: shark.patch
*** 57,67 ****
// the wrapper, which results in the odd mild inefficiency but is a
// damn sight easier to code.
OopMap *oopmap = new OopMap(
SharkStack::oopmap_slot_munge(stack()->oopmap_frame_size()),
SharkStack::oopmap_slot_munge(arg_size()));
- oopmap->set_oop(SharkStack::slot2reg(stack()->method_slot_offset()));
// Set up the oop_tmp slot if required:
// - For static methods we use it to handlize the class argument
// for the call, and to protect the same during slow path locks
// (if synchronized).
--- 57,66 ----
*** 81,93 ****
Unimplemented();
_lock_slot_offset = 23;
}
// Start building the argument list
! std::vector<const Type*> param_types;
std::vector<Value*> param_values;
! const PointerType *box_type = PointerType::getUnqual(SharkType::oop_type());
// First argument is the JNIEnv
param_types.push_back(SharkType::jniEnv_type());
param_values.push_back(
builder()->CreateAddressOfStructEntry(
--- 80,92 ----
Unimplemented();
_lock_slot_offset = 23;
}
// Start building the argument list
! std::vector<Type*> param_types;
std::vector<Value*> param_values;
! PointerType *box_type = PointerType::getUnqual(SharkType::oop_type());
// First argument is the JNIEnv
param_types.push_back(SharkType::jniEnv_type());
param_values.push_back(
builder()->CreateAddressOfStructEntry(
*** 147,157 ****
builder()->SetInsertPoint(not_null);
builder()->CreateBr(merge);
builder()->SetInsertPoint(merge);
! phi = builder()->CreatePHI(box_type, "boxed_object");
phi->addIncoming(ConstantPointerNull::get(box_type), null);
phi->addIncoming(box, not_null);
box = phi;
param_types.push_back(box_type);
--- 146,156 ----
builder()->SetInsertPoint(not_null);
builder()->CreateBr(merge);
builder()->SetInsertPoint(merge);
! phi = builder()->CreatePHI(box_type, 0, "boxed_object");
phi->addIncoming(ConstantPointerNull::get(box_type), null);
phi->addIncoming(box, not_null);
box = phi;
param_types.push_back(box_type);
*** 168,178 ****
case T_DOUBLE:
adjusted_offset--;
// fall through
default:
! const Type *param_type = SharkType::to_stackType(arg_type(i));
param_types.push_back(param_type);
param_values.push_back(
builder()->CreateLoad(stack()->slot_addr(adjusted_offset, param_type)));
}
--- 167,177 ----
case T_DOUBLE:
adjusted_offset--;
// fall through
default:
! Type *param_type = SharkType::to_stackType(arg_type(i));
param_types.push_back(param_type);
param_values.push_back(
builder()->CreateLoad(stack()->slot_addr(adjusted_offset, param_type)));
}
*** 199,209 ****
// Change the thread state to _thread_in_native
CreateSetThreadState(_thread_in_native);
// Make the call
BasicType result_type = target()->result_type();
! const Type* return_type;
if (result_type == T_VOID)
return_type = SharkType::void_type();
else if (is_returning_oop())
return_type = box_type;
else
--- 198,208 ----
// Change the thread state to _thread_in_native
CreateSetThreadState(_thread_in_native);
// Make the call
BasicType result_type = target()->result_type();
! Type* return_type;
if (result_type == T_VOID)
return_type = SharkType::void_type();
else if (is_returning_oop())
return_type = box_type;
else
*** 211,229 ****
Value* native_function = builder()->CreateIntToPtr(
LLVMValue::intptr_constant((intptr_t) target()->native_function()),
PointerType::getUnqual(
FunctionType::get(return_type, param_types, false)));
Value *result = builder()->CreateCall(
! native_function, param_values.begin(), param_values.end());
// Start the transition back to _thread_in_Java
CreateSetThreadState(_thread_in_native_trans);
// Make sure new state is visible in the GC thread
if (os::is_MP()) {
if (UseMembar)
! builder()->CreateMemoryBarrier(SharkBuilder::BARRIER_STORELOAD);
else
CreateWriteMemorySerializePage();
}
// Handle safepoint operations, pending suspend requests,
--- 210,228 ----
Value* native_function = builder()->CreateIntToPtr(
LLVMValue::intptr_constant((intptr_t) target()->native_function()),
PointerType::getUnqual(
FunctionType::get(return_type, param_types, false)));
Value *result = builder()->CreateCall(
! native_function, llvm::makeArrayRef(param_values));
// Start the transition back to _thread_in_Java
CreateSetThreadState(_thread_in_native_trans);
// Make sure new state is visible in the GC thread
if (os::is_MP()) {
if (UseMembar)
! builder()->CreateFence(llvm::SequentiallyConsistent, llvm::CrossThread);
else
CreateWriteMemorySerializePage();
}
// Handle safepoint operations, pending suspend requests,
*** 303,313 ****
builder()->SetInsertPoint(not_null);
Value *unboxed_result = builder()->CreateLoad(result);
builder()->CreateBr(merge);
builder()->SetInsertPoint(merge);
! PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), "result");
phi->addIncoming(LLVMValue::null(), null);
phi->addIncoming(unboxed_result, not_null);
result = phi;
}
--- 302,312 ----
builder()->SetInsertPoint(not_null);
Value *unboxed_result = builder()->CreateLoad(result);
builder()->CreateBr(merge);
builder()->SetInsertPoint(merge);
! PHINode *phi = builder()->CreatePHI(SharkType::oop_type(), 0, "result");
phi->addIncoming(LLVMValue::null(), null);
phi->addIncoming(unboxed_result, not_null);
result = phi;
}