273
274 // More convenient values for passing
275 EX_CHECK_NONE = 0,
276 EX_CHECK_NO_CATCH = EAM_CHECK,
277 EX_CHECK_FULL = EAM_CHECK | EAM_HANDLE
278 };
279 void check_pending_exception(int action);
280 void handle_exception(llvm::Value* exception, int action);
281 void marshal_exception_fast(int num_options);
282 void marshal_exception_slow(int num_options);
283 llvm::BasicBlock* handler_for_exception(int index);
284
285 // VM calls
286 private:
287 llvm::CallInst* call_vm(llvm::Value* callee,
288 llvm::Value** args_start,
289 llvm::Value** args_end,
290 int exception_action) {
291 decache_for_VM_call();
292 stack()->CreateSetLastJavaFrame();
293 llvm::CallInst *res = builder()->CreateCall(callee, args_start, args_end);
294 stack()->CreateResetLastJavaFrame();
295 cache_after_VM_call();
296 if (exception_action & EAM_CHECK) {
297 check_pending_exception(exception_action);
298 current_state()->set_has_safepointed(true);
299 }
300 return res;
301 }
302
303 public:
304 llvm::CallInst* call_vm(llvm::Value* callee,
305 int exception_action) {
306 llvm::Value *args[] = {thread()};
307 return call_vm(callee, args, args + 1, exception_action);
308 }
309 llvm::CallInst* call_vm(llvm::Value* callee,
310 llvm::Value* arg1,
311 int exception_action) {
312 llvm::Value *args[] = {thread(), arg1};
313 return call_vm(callee, args, args + 2, exception_action);
|
273
274 // More convenient values for passing
275 EX_CHECK_NONE = 0,
276 EX_CHECK_NO_CATCH = EAM_CHECK,
277 EX_CHECK_FULL = EAM_CHECK | EAM_HANDLE
278 };
279 void check_pending_exception(int action);
280 void handle_exception(llvm::Value* exception, int action);
281 void marshal_exception_fast(int num_options);
282 void marshal_exception_slow(int num_options);
283 llvm::BasicBlock* handler_for_exception(int index);
284
285 // VM calls
286 private:
287 llvm::CallInst* call_vm(llvm::Value* callee,
288 llvm::Value** args_start,
289 llvm::Value** args_end,
290 int exception_action) {
291 decache_for_VM_call();
292 stack()->CreateSetLastJavaFrame();
293 llvm::CallInst *res = builder()->CreateCall(callee, llvm::makeArrayRef(args_start, args_end));
294 stack()->CreateResetLastJavaFrame();
295 cache_after_VM_call();
296 if (exception_action & EAM_CHECK) {
297 check_pending_exception(exception_action);
298 current_state()->set_has_safepointed(true);
299 }
300 return res;
301 }
302
303 public:
304 llvm::CallInst* call_vm(llvm::Value* callee,
305 int exception_action) {
306 llvm::Value *args[] = {thread()};
307 return call_vm(callee, args, args + 1, exception_action);
308 }
309 llvm::CallInst* call_vm(llvm::Value* callee,
310 llvm::Value* arg1,
311 int exception_action) {
312 llvm::Value *args[] = {thread(), arg1};
313 return call_vm(callee, args, args + 2, exception_action);
|