Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
894382d7
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
894382d7
编写于
3月 22, 2022
作者:
Z
Zoltan Varga
提交者:
GitHub
3月 22, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[mono] Remove the llvmonly exception handling code, its not used any more. (#66875)
上级
f25b23e0
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
82 addition
and
320 deletion
+82
-320
src/mono/mono/metadata/jit-icall-reg.h
src/mono/mono/metadata/jit-icall-reg.h
+0
-5
src/mono/mono/mini/llvmonly-runtime.c
src/mono/mono/mini/llvmonly-runtime.c
+0
-12
src/mono/mono/mini/llvmonly-runtime.h
src/mono/mono/mini/llvmonly-runtime.h
+0
-4
src/mono/mono/mini/method-to-ir.c
src/mono/mono/mini/method-to-ir.c
+2
-13
src/mono/mono/mini/mini-exceptions.c
src/mono/mono/mini/mini-exceptions.c
+0
-72
src/mono/mono/mini/mini-llvm.c
src/mono/mono/mini/mini-llvm.c
+79
-208
src/mono/mono/mini/mini-runtime.c
src/mono/mono/mini/mini-runtime.c
+0
-5
src/native/public/mono/jit/details/jit-types.h
src/native/public/mono/jit/details/jit-types.h
+1
-1
未找到文件。
src/mono/mono/metadata/jit-icall-reg.h
浏览文件 @
894382d7
...
...
@@ -140,16 +140,11 @@ MONO_JIT_ICALL (mini_llvmonly_resolve_vcall_gsharedvt) \
MONO_JIT_ICALL (mini_llvmonly_resolve_vcall_gsharedvt_fast) \
MONO_JIT_ICALL (mini_llvmonly_throw_nullref_exception) \
MONO_JIT_ICALL (mini_llvmonly_throw_aot_failed_exception) \
MONO_JIT_ICALL (mini_llvmonly_pop_lmf) \
MONO_JIT_ICALL (mini_llvmonly_interp_entry_gsharedvt) \
MONO_JIT_ICALL (mini_llvmonly_throw_exception) \
MONO_JIT_ICALL (mini_llvmonly_rethrow_exception) \
MONO_JIT_ICALL (mini_llvmonly_throw_corlib_exception) \
MONO_JIT_ICALL (mini_llvmonly_resume_exception) \
MONO_JIT_ICALL (mini_llvmonly_resume_exception_il_state) \
MONO_JIT_ICALL (mini_llvmonly_load_exception) \
MONO_JIT_ICALL (mini_llvmonly_clear_exception) \
MONO_JIT_ICALL (mini_llvmonly_match_exception) \
MONO_JIT_ICALL (mono_amd64_resume_unwind) \
MONO_JIT_ICALL (mono_amd64_start_gsharedvt_call) \
MONO_JIT_ICALL (mono_amd64_throw_corlib_exception) \
...
...
src/mono/mono/mini/llvmonly-runtime.c
浏览文件 @
894382d7
...
...
@@ -975,18 +975,6 @@ mini_llvmonly_throw_aot_failed_exception (const char *name)
mini_llvmonly_throw_exception
((
MonoObject
*
)
ex
);
}
/*
* mini_llvmonly_pop_lmf:
*
* Pop LMF off the LMF stack.
*/
void
mini_llvmonly_pop_lmf
(
MonoLMF
*
lmf
)
{
if
(
lmf
->
previous_lmf
)
mono_set_lmf
((
MonoLMF
*
)
lmf
->
previous_lmf
);
}
void
mini_llvmonly_interp_entry_gsharedvt
(
gpointer
imethod
,
gpointer
res
,
gpointer
*
args
)
{
...
...
src/mono/mono/mini/llvmonly-runtime.h
浏览文件 @
894382d7
...
...
@@ -36,18 +36,14 @@ G_EXTERN_C void mini_llvmonly_throw_nullref_exception (void);
G_EXTERN_C
void
mini_llvmonly_throw_aot_failed_exception
(
const
char
*
name
);
G_EXTERN_C
void
mini_llvmonly_pop_lmf
(
MonoLMF
*
lmf
);
G_EXTERN_C
void
mini_llvmonly_interp_entry_gsharedvt
(
gpointer
imethod
,
gpointer
res
,
gpointer
*
args
);
/* These are implemented in mini-exceptions.c */
G_EXTERN_C
void
mini_llvmonly_throw_exception
(
MonoObject
*
ex
);
G_EXTERN_C
void
mini_llvmonly_rethrow_exception
(
MonoObject
*
ex
);
G_EXTERN_C
void
mini_llvmonly_throw_corlib_exception
(
guint32
ex_token_index
);
G_EXTERN_C
void
mini_llvmonly_resume_exception
(
void
);
G_EXTERN_C
void
mini_llvmonly_resume_exception_il_state
(
MonoLMF
*
lmf
,
gpointer
info
);
G_EXTERN_C
MonoObject
*
mini_llvmonly_load_exception
(
void
);
G_EXTERN_C
void
mini_llvmonly_clear_exception
(
void
);
G_EXTERN_C
gint32
mini_llvmonly_match_exception
(
MonoJitInfo
*
jinfo
,
guint32
region_start
,
guint32
region_end
,
gpointer
rgctx
,
MonoObject
*
this_obj
);
#endif
src/mono/mono/mini/method-to-ir.c
浏览文件 @
894382d7
...
...
@@ -6496,17 +6496,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
mono_emit_method_call
(
cfg
,
wrapper
,
args
,
NULL
);
}
if
(
cfg
->
llvm_only
&&
cfg
->
interp
&&
cfg
->
method
==
method
&&
!
cfg
->
deopt
)
{
if
(
header
->
num_clauses
)
{
for
(
int
i
=
0
;
i
<
header
->
num_clauses
;
++
i
)
{
MonoExceptionClause
*
clause
=
&
header
->
clauses
[
i
];
/* Finally clauses are checked after the remove_finally pass */
if
(
clause
->
flags
!=
MONO_EXCEPTION_CLAUSE_FINALLY
)
cfg
->
interp_entry_only
=
TRUE
;
}
}
}
if
(
cfg
->
llvm_only
)
g_assert
(
cfg
->
interp
);
/* we use a separate basic block for the initialization code */
NEW_BBLOCK
(
cfg
,
init_localsbb
);
...
...
@@ -8147,7 +8138,6 @@ call_end:
#ifdef TARGET_WASM
if
(
common_call
&&
needs_stack_walk
&&
!
cfg
->
deopt
)
/* If an exception is thrown, the LMF is popped by a call to mini_llvmonly_pop_lmf () */
emit_pop_lmf
(
cfg
);
#endif
...
...
@@ -11695,7 +11685,6 @@ mono_ldptr:
#ifdef TARGET_WASM
if
(
cfg
->
lmf_var
&&
!
cfg
->
deopt
)
{
// mini_llvmonly_pop_lmf () might be called before emit_push_lmf () so initialize the LMF
cfg
->
cbb
=
init_localsbb
;
EMIT_NEW_VARLOADA
(
cfg
,
ins
,
cfg
->
lmf_var
,
NULL
);
int
lmf_reg
=
ins
->
dreg
;
...
...
src/mono/mono/mini/mini-exceptions.c
浏览文件 @
894382d7
...
...
@@ -3529,17 +3529,6 @@ llvmonly_reraise_exception (MonoException *e)
mini_llvmonly_rethrow_exception
((
MonoObject
*
)
e
);
}
/*
* mini_llvmonly_resume_exception:
*
* Resume exception propagation.
*/
void
mini_llvmonly_resume_exception
(
void
)
{
mono_llvm_cpp_throw_exception
();
}
static
G_GNUC_UNUSED
void
print_lmf_chain
(
MonoLMF
*
lmf
)
{
...
...
@@ -3680,67 +3669,6 @@ mini_llvmonly_clear_exception (void)
mono_memory_barrier
();
}
/*
* mini_llvmonly_match_exception:
*
* Return the innermost clause containing REGION_START-REGION_END which can handle
* the current exception.
*/
gint32
mini_llvmonly_match_exception
(
MonoJitInfo
*
jinfo
,
guint32
region_start
,
guint32
region_end
,
gpointer
rgctx
,
MonoObject
*
this_obj
)
{
ERROR_DECL
(
error
);
MonoJitTlsData
*
jit_tls
=
mono_get_jit_tls
();
MonoObject
*
exc
;
gint32
index
=
-
1
;
g_assert
(
jit_tls
->
thrown_exc
);
exc
=
mono_gchandle_get_target_internal
(
jit_tls
->
thrown_exc
);
if
(
jit_tls
->
thrown_non_exc
)
{
/*
* Have to unwrap RuntimeWrappedExceptions if the
* method's assembly doesn't have a RuntimeCompatibilityAttribute.
*/
if
(
!
wrap_non_exception_throws
(
jinfo_get_method
(
jinfo
)))
exc
=
mono_gchandle_get_target_internal
(
jit_tls
->
thrown_non_exc
);
}
for
(
int
i
=
0
;
i
<
jinfo
->
num_clauses
;
i
++
)
{
MonoJitExceptionInfo
*
ei
=
&
jinfo
->
clauses
[
i
];
MonoClass
*
catch_class
;
if
(
!
(
ei
->
try_offset
==
region_start
&&
ei
->
try_offset
+
ei
->
try_len
==
region_end
)
)
continue
;
catch_class
=
ei
->
data
.
catch_class
;
if
(
mono_class_is_open_constructed_type
(
m_class_get_byval_arg
(
catch_class
)))
{
MonoGenericContext
context
;
MonoType
*
inflated_type
;
g_assert
(
rgctx
||
this_obj
);
context
=
mono_get_generic_context_from_stack_frame
(
jinfo
,
rgctx
?
rgctx
:
this_obj
->
vtable
);
inflated_type
=
mono_class_inflate_generic_type_checked
(
m_class_get_byval_arg
(
catch_class
),
&
context
,
error
);
mono_error_assert_ok
(
error
);
/* FIXME don't swallow the error */
catch_class
=
mono_class_from_mono_type_internal
(
inflated_type
);
mono_metadata_free_type
(
inflated_type
);
}
// FIXME: Handle edge cases handled in get_exception_catch_class
if
(
ei
->
flags
==
MONO_EXCEPTION_CLAUSE_NONE
&&
mono_object_isinst_checked
(
exc
,
catch_class
,
error
))
{
index
=
ei
->
clause_index
;
break
;
}
else
mono_error_assert_ok
(
error
);
if
(
ei
->
flags
==
MONO_EXCEPTION_CLAUSE_FILTER
)
{
g_assert_not_reached
();
}
}
return
index
;
}
#if defined(ENABLE_LLVM) && defined(HAVE_UNWIND_H)
G_EXTERN_C
_Unwind_Reason_Code
mono_debug_personality
(
int
a
,
_Unwind_Action
b
,
uint64_t
c
,
struct
_Unwind_Exception
*
d
,
struct
_Unwind_Context
*
e
)
...
...
src/mono/mono/mini/mini-llvm.c
浏览文件 @
894382d7
...
...
@@ -4765,105 +4765,6 @@ emit_throw (EmitContext *ctx, MonoBasicBlock *bb, gboolean rethrow, LLVMValueRef
emit_call
(
ctx
,
bb
,
&
ctx
->
builder
,
callee
,
&
arg
,
1
);
}
static
void
emit_resume_eh
(
EmitContext
*
ctx
,
MonoBasicBlock
*
bb
)
{
const
MonoJitICallId
icall_id
=
MONO_JIT_ICALL_mini_llvmonly_resume_exception
;
LLVMValueRef
callee
;
LLVMTypeRef
fun_sig
=
LLVMFunctionType0
(
LLVMVoidType
(),
FALSE
);
g_assert
(
ctx
->
cfg
->
compile_aot
);
callee
=
get_callee
(
ctx
,
fun_sig
,
MONO_PATCH_INFO_JIT_ICALL_ID
,
GUINT_TO_POINTER
(
icall_id
));
emit_call
(
ctx
,
bb
,
&
ctx
->
builder
,
callee
,
NULL
,
0
);
LLVMBuildUnreachable
(
ctx
->
builder
);
ctx
->
builder
=
create_builder
(
ctx
);
}
static
LLVMValueRef
mono_llvm_emit_clear_exception_call
(
EmitContext
*
ctx
,
LLVMBuilderRef
builder
)
{
const
MonoJitICallId
icall_id
=
MONO_JIT_ICALL_mini_llvmonly_clear_exception
;
LLVMTypeRef
call_sig
=
LLVMFunctionType
(
LLVMVoidType
(),
NULL
,
0
,
FALSE
);
LLVMValueRef
callee
=
NULL
;
if
(
!
callee
)
{
callee
=
get_callee
(
ctx
,
call_sig
,
MONO_PATCH_INFO_JIT_ICALL_ID
,
GUINT_TO_POINTER
(
icall_id
));
}
g_assert
(
builder
&&
callee
);
return
LLVMBuildCall
(
builder
,
callee
,
NULL
,
0
,
""
);
}
static
LLVMValueRef
mono_llvm_emit_load_exception_call
(
EmitContext
*
ctx
,
LLVMBuilderRef
builder
)
{
const
MonoJitICallId
icall_id
=
MONO_JIT_ICALL_mini_llvmonly_load_exception
;
LLVMTypeRef
call_sig
=
LLVMFunctionType
(
ObjRefType
(),
NULL
,
0
,
FALSE
);
LLVMValueRef
callee
=
NULL
;
g_assert
(
ctx
->
cfg
->
compile_aot
);
if
(
!
callee
)
{
callee
=
get_callee
(
ctx
,
call_sig
,
MONO_PATCH_INFO_JIT_ICALL_ID
,
GUINT_TO_POINTER
(
icall_id
));
}
g_assert
(
builder
&&
callee
);
return
LLVMBuildCall
(
builder
,
callee
,
NULL
,
0
,
"load_exception"
);
}
static
LLVMValueRef
mono_llvm_emit_match_exception_call
(
EmitContext
*
ctx
,
LLVMBuilderRef
builder
,
gint32
region_start
,
gint32
region_end
)
{
const
char
*
icall_name
=
"mini_llvmonly_match_exception"
;
const
MonoJitICallId
icall_id
=
MONO_JIT_ICALL_mini_llvmonly_match_exception
;
ctx
->
builder
=
builder
;
LLVMValueRef
args
[
5
];
const
int
num_args
=
G_N_ELEMENTS
(
args
);
args
[
0
]
=
convert
(
ctx
,
get_aotconst
(
ctx
,
MONO_PATCH_INFO_AOT_JIT_INFO
,
GINT_TO_POINTER
(
ctx
->
cfg
->
method_index
),
LLVMPointerType
(
IntPtrType
(),
0
)),
IntPtrType
());
args
[
1
]
=
LLVMConstInt
(
LLVMInt32Type
(),
region_start
,
0
);
args
[
2
]
=
LLVMConstInt
(
LLVMInt32Type
(),
region_end
,
0
);
if
(
ctx
->
cfg
->
rgctx_var
)
{
if
(
ctx
->
cfg
->
llvm_only
)
{
args
[
3
]
=
convert
(
ctx
,
ctx
->
rgctx_arg
,
IntPtrType
());
}
else
{
LLVMValueRef
rgctx_alloc
=
ctx
->
addresses
[
ctx
->
cfg
->
rgctx_var
->
dreg
];
g_assert
(
rgctx_alloc
);
args
[
3
]
=
LLVMBuildLoad
(
builder
,
convert
(
ctx
,
rgctx_alloc
,
LLVMPointerType
(
IntPtrType
(),
0
)),
""
);
}
}
else
{
args
[
3
]
=
LLVMConstInt
(
IntPtrType
(),
0
,
0
);
}
if
(
ctx
->
this_arg
)
args
[
4
]
=
convert
(
ctx
,
ctx
->
this_arg
,
IntPtrType
());
else
args
[
4
]
=
LLVMConstInt
(
IntPtrType
(),
0
,
0
);
LLVMTypeRef
match_sig
=
LLVMFunctionType5
(
LLVMInt32Type
(),
IntPtrType
(),
LLVMInt32Type
(),
LLVMInt32Type
(),
IntPtrType
(),
IntPtrType
(),
FALSE
);
LLVMValueRef
callee
;
g_assert
(
ctx
->
cfg
->
compile_aot
);
ctx
->
builder
=
builder
;
// get_callee expects ctx->builder to be the emitting builder
callee
=
get_callee
(
ctx
,
match_sig
,
MONO_PATCH_INFO_JIT_ICALL_ID
,
GUINT_TO_POINTER
(
icall_id
));
g_assert
(
builder
&&
callee
);
g_assert
(
ctx
->
ex_var
);
return
LLVMBuildCall
(
builder
,
callee
,
args
,
num_args
,
icall_name
);
}
// FIXME: This won't work because the code-finding makes this
// not a constant.
/*#define MONO_PERSONALITY_DEBUG*/
...
...
@@ -4958,100 +4859,96 @@ emit_llvmonly_landing_pad (EmitContext *ctx, int group_index, int group_size)
LLVMAddClause
(
landing_pad
,
cast
);
}
if
(
ctx
->
cfg
->
deopt
)
{
/*
* Call mini_llvmonly_resume_exception_il_state (lmf, il_state)
*
* The call will execute the catch clause and the rest of the method and store the return
* value into ctx->il_state_ret.
*/
if
(
!
ctx
->
has_catch
)
{
/* Unused */
LLVMBuildUnreachable
(
builder
);
return
lpad_bb
;
}
if
(
mono_opt_wasm_exceptions
)
{
bb_name
=
g_strdup_printf
(
"CATCH_CONT%d_BB"
,
group_index
);
LLVMBasicBlockRef
catch_cont_bb
=
gen_bb
(
ctx
,
bb_name
);
g_free
(
bb_name
);
LLVMBuildCatchRet
(
builder
,
catchpad
,
catch_cont_bb
);
LLVMPositionBuilderAtEnd
(
builder
,
catch_cont_bb
);
}
g_assert
(
ctx
->
cfg
->
deopt
);
const
MonoJitICallId
icall_id
=
MONO_JIT_ICALL_mini_llvmonly_resume_exception_il_state
;
LLVMValueRef
callee
;
LLVMValueRef
args
[
2
];
/*
* Call mini_llvmonly_resume_exception_il_state (lmf, il_state)
*
* The call will execute the catch clause and the rest of the method and store the return
* value into ctx->il_state_ret.
*/
if
(
!
ctx
->
has_catch
)
{
/* Unused */
LLVMBuildUnreachable
(
builder
);
return
lpad_bb
;
}
LLVMTypeRef
fun_sig
=
LLVMFunctionType2
(
LLVMVoidType
(),
IntPtrType
(),
IntPtrType
(),
FALSE
);
if
(
mono_opt_wasm_exceptions
)
{
bb_name
=
g_strdup_printf
(
"CATCH_CONT%d_BB"
,
group_index
);
LLVMBasicBlockRef
catch_cont_bb
=
gen_bb
(
ctx
,
bb_name
);
g_free
(
bb_name
);
LLVMBuildCatchRet
(
builder
,
catchpad
,
catch_cont_bb
);
LLVMPositionBuilderAtEnd
(
builder
,
catch_cont_bb
);
}
callee
=
get_callee
(
ctx
,
fun_sig
,
MONO_PATCH_INFO_JIT_ICALL_ID
,
GUINT_TO_POINTER
(
icall_id
));
const
MonoJitICallId
icall_id
=
MONO_JIT_ICALL_mini_llvmonly_resume_exception_il_state
;
LLVMValueRef
callee
;
LLVMValueRef
args
[
2
];
g_assert
(
ctx
->
cfg
->
lmf_var
);
g_assert
(
ctx
->
addresses
[
ctx
->
cfg
->
lmf_var
->
dreg
]);
args
[
0
]
=
LLVMBuildPtrToInt
(
ctx
->
builder
,
ctx
->
addresses
[
ctx
->
cfg
->
lmf_var
->
dreg
],
IntPtrType
(),
""
);
args
[
1
]
=
LLVMBuildPtrToInt
(
ctx
->
builder
,
ctx
->
il_state
,
IntPtrType
(),
""
);
emit_call
(
ctx
,
NULL
,
&
ctx
->
builder
,
callee
,
args
,
2
);
LLVMTypeRef
fun_sig
=
LLVMFunctionType2
(
LLVMVoidType
(),
IntPtrType
(),
IntPtrType
(),
FALSE
);
/* Return the value set in ctx->il_state_ret */
callee
=
get_callee
(
ctx
,
fun_sig
,
MONO_PATCH_INFO_JIT_ICALL_ID
,
GUINT_TO_POINTER
(
icall_id
));
LLVMTypeRef
ret_type
=
LLVMGetReturnType
(
LLVMGetElementType
(
LLVMTypeOf
(
ctx
->
lmethod
)));
LLVMBuilderRef
builder
=
ctx
->
builder
;
LLVMValueRef
addr
,
retval
,
gep
,
indexes
[
2
];
g_assert
(
ctx
->
cfg
->
lmf_var
);
g_assert
(
ctx
->
addresses
[
ctx
->
cfg
->
lmf_var
->
dreg
]);
args
[
0
]
=
LLVMBuildPtrToInt
(
ctx
->
builder
,
ctx
->
addresses
[
ctx
->
cfg
->
lmf_var
->
dreg
],
IntPtrType
(),
""
);
args
[
1
]
=
LLVMBuildPtrToInt
(
ctx
->
builder
,
ctx
->
il_state
,
IntPtrType
(),
""
);
emit_call
(
ctx
,
NULL
,
&
ctx
->
builder
,
callee
,
args
,
2
);
switch
(
ctx
->
linfo
->
ret
.
storage
)
{
case
LLVMArgNone
:
LLVMBuildRetVoid
(
builder
);
break
;
case
LLVMArgNormal
:
case
LLVMArgWasmVtypeAsScalar
:
case
LLVMArgVtypeInReg
:
{
if
(
ctx
->
sig
->
ret
->
type
==
MONO_TYPE_VOID
)
{
LLVMBuildRetVoid
(
builder
);
break
;
}
/* Return the value set in ctx->il_state_ret */
addr
=
ctx
->
il_state_ret
;
g_assert
(
addr
)
;
LLVMTypeRef
ret_type
=
LLVMGetReturnType
(
LLVMGetElementType
(
LLVMTypeOf
(
ctx
->
lmethod
)))
;
LLVMValueRef
addr
,
retval
,
gep
,
indexes
[
2
]
;
addr
=
convert
(
ctx
,
ctx
->
il_state_ret
,
LLVMPointerType
(
ret_type
,
0
));
indexes
[
0
]
=
LLVMConstInt
(
LLVMInt32Type
(),
0
,
FALSE
);
indexes
[
1
]
=
LLVMConstInt
(
LLVMInt32Type
(),
0
,
FALSE
);
gep
=
LLVMBuildGEP
(
builder
,
addr
,
indexes
,
1
,
""
);
builder
=
ctx
->
builder
;
LLVMBuildRet
(
builder
,
LLVMBuildLoad
(
builder
,
gep
,
""
));
switch
(
ctx
->
linfo
->
ret
.
storage
)
{
case
LLVMArgNone
:
LLVMBuildRetVoid
(
builder
);
break
;
case
LLVMArgNormal
:
case
LLVMArgWasmVtypeAsScalar
:
case
LLVMArgVtypeInReg
:
{
if
(
ctx
->
sig
->
ret
->
type
==
MONO_TYPE_VOID
)
{
LLVMBuildRetVoid
(
builder
);
break
;
}
case
LLVMArgVtypeRetAddr
:
{
LLVMValueRef
ret_addr
;
g_assert
(
cfg
->
vret_addr
)
;
ret_addr
=
ctx
->
values
[
cfg
->
vret_addr
->
dreg
]
;
addr
=
ctx
->
il_state_ret
;
g_assert
(
addr
)
;
addr
=
ctx
->
il_state_ret
;
g_assert
(
addr
);
addr
=
convert
(
ctx
,
ctx
->
il_state_ret
,
LLVMPointerType
(
ret_type
,
0
));
indexes
[
0
]
=
LLVMConstInt
(
LLVMInt32Type
(),
0
,
FALSE
);
indexes
[
1
]
=
LLVMConstInt
(
LLVMInt32Type
(),
0
,
FALSE
);
gep
=
LLVMBuildGEP
(
builder
,
addr
,
indexes
,
1
,
""
);
/* The ret value is in il_state_ret, copy it to the memory pointed to by the vret arg */
ret_type
=
type_to_llvm_type
(
ctx
,
ctx
->
sig
->
ret
);
indexes
[
0
]
=
LLVMConstInt
(
LLVMInt32Type
(),
0
,
FALSE
);
indexes
[
1
]
=
LLVMConstInt
(
LLVMInt32Type
(),
0
,
FALSE
);
gep
=
LLVMBuildGEP
(
builder
,
addr
,
indexes
,
1
,
""
);
retval
=
convert
(
ctx
,
LLVMBuildLoad
(
builder
,
gep
,
""
),
ret_type
);
LLVMBuildRet
(
builder
,
LLVMBuildLoad
(
builder
,
gep
,
""
));
break
;
}
case
LLVMArgVtypeRetAddr
:
{
LLVMValueRef
ret_addr
;
LLVMBuildStore
(
builder
,
retval
,
convert
(
ctx
,
ret_addr
,
LLVMPointerType
(
ret_type
,
0
)));
LLVMBuildRetVoid
(
builder
);
break
;
}
default:
g_assert_not_reached
();
break
;
}
g_assert
(
cfg
->
vret_addr
);
ret_addr
=
ctx
->
values
[
cfg
->
vret_addr
->
dreg
];
return
lpad_bb
;
}
addr
=
ctx
->
il_state_ret
;
g_assert
(
addr
);
/* Non interp based EH doesn't work */
g_assert_not_reached
();
/* The ret value is in il_state_ret, copy it to the memory pointed to by the vret arg */
ret_type
=
type_to_llvm_type
(
ctx
,
ctx
->
sig
->
ret
);
indexes
[
0
]
=
LLVMConstInt
(
LLVMInt32Type
(),
0
,
FALSE
);
indexes
[
1
]
=
LLVMConstInt
(
LLVMInt32Type
(),
0
,
FALSE
);
gep
=
LLVMBuildGEP
(
builder
,
addr
,
indexes
,
1
,
""
);
retval
=
convert
(
ctx
,
LLVMBuildLoad
(
builder
,
gep
,
""
),
ret_type
);
LLVMBuildStore
(
builder
,
retval
,
convert
(
ctx
,
ret_addr
,
LLVMPointerType
(
ret_type
,
0
)));
LLVMBuildRetVoid
(
builder
);
break
;
}
default:
g_assert_not_reached
();
break
;
}
return
lpad_bb
;
}
...
...
@@ -5340,42 +5237,19 @@ emit_llvmonly_handler_start (EmitContext *ctx, MonoBasicBlock *bb, LLVMBasicBloc
int
clause_index
=
MONO_REGION_CLAUSE_INDEX
(
bb
->
region
);
MonoExceptionClause
*
clause
=
&
ctx
->
cfg
->
header
->
clauses
[
clause_index
];
// Make exception available to catch blocks
if
(
!
(
clause
->
flags
&
MONO_EXCEPTION_CLAUSE_FINALLY
||
clause
->
flags
&
MONO_EXCEPTION_CLAUSE_FAULT
))
{
LLVMValueRef
mono_exc
=
mono_llvm_emit_load_exception_call
(
ctx
,
ctx
->
builder
);
g_assert
(
ctx
->
cfg
->
deopt
);
g_assert
(
ctx
->
ex_var
);
LLVMBuildStore
(
ctx
->
builder
,
LLVMBuildBitCast
(
ctx
->
builder
,
mono_exc
,
ObjRefType
(),
""
),
ctx
->
ex_var
);
/* This code is not executed becase the landing pad transitions to the intepreter */
if
(
!
(
clause
->
flags
&
MONO_EXCEPTION_CLAUSE_FINALLY
||
clause
->
flags
&
MONO_EXCEPTION_CLAUSE_FAULT
))
{
if
(
bb
->
in_scount
==
1
)
{
MonoInst
*
exvar
=
bb
->
in_stack
[
0
];
g_assert
(
!
ctx
->
values
[
exvar
->
dreg
]);
g_assert
(
ctx
->
ex_var
);
ctx
->
values
[
exvar
->
dreg
]
=
LLVMBuildLoad
(
ctx
->
builder
,
ctx
->
ex_var
,
"save_exception"
);
ctx
->
values
[
exvar
->
dreg
]
=
LLVMConstNull
(
ObjRefType
());
emit_volatile_store
(
ctx
,
exvar
->
dreg
);
}
mono_llvm_emit_clear_exception_call
(
ctx
,
ctx
->
builder
);
}
#ifdef TARGET_WASM
if
(
ctx
->
cfg
->
lmf_var
&&
!
ctx
->
cfg
->
deopt
)
{
LLVMValueRef
callee
;
LLVMValueRef
args
[
1
];
LLVMTypeRef
sig
=
LLVMFunctionType1
(
LLVMVoidType
(),
ctx
->
module
->
ptr_type
,
FALSE
);
/*
* There might be an LMF on the stack inserted to enable stack walking, see
* method_needs_stack_walk (). If an exception is thrown, the LMF popping code
* is not executed, so do it here.
*/
g_assert
(
ctx
->
addresses
[
ctx
->
cfg
->
lmf_var
->
dreg
]);
callee
=
get_callee
(
ctx
,
sig
,
MONO_PATCH_INFO_JIT_ICALL_ADDR
,
GUINT_TO_POINTER
(
MONO_JIT_ICALL_mini_llvmonly_pop_lmf
));
args
[
0
]
=
convert
(
ctx
,
ctx
->
addresses
[
ctx
->
cfg
->
lmf_var
->
dreg
],
ctx
->
module
->
ptr_type
);
emit_call
(
ctx
,
bb
,
&
ctx
->
builder
,
callee
,
args
,
1
);
}
#endif
LLVMBuilderRef
handler_builder
=
create_builder
(
ctx
);
LLVMBasicBlockRef
target_bb
=
ctx
->
bblocks
[
bb
->
block_num
].
call_handler_target_bb
;
LLVMPositionBuilderAtEnd
(
handler_builder
,
target_bb
);
...
...
@@ -11260,12 +11134,9 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
}
if
(
ctx
->
llvm_only
)
{
if
(
!
cfg
->
deopt
)
{
emit_resume_eh
(
ctx
,
bb
);
}
else
{
/* Not needed */
LLVMBuildUnreachable
(
builder
);
}
g_assert
(
cfg
->
deopt
);
/* Not needed */
LLVMBuildUnreachable
(
builder
);
}
else
{
LLVMTypeRef
icall_sig
=
LLVMFunctionType
(
LLVMVoidType
(),
NULL
,
0
,
FALSE
);
if
(
ctx
->
cfg
->
compile_aot
)
{
...
...
src/mono/mono/mini/mini-runtime.c
浏览文件 @
894382d7
...
...
@@ -4688,11 +4688,7 @@ register_icalls (void)
register_icall
(
mini_llvmonly_throw_exception
,
mono_icall_sig_void_object
,
TRUE
);
register_icall
(
mini_llvmonly_rethrow_exception
,
mono_icall_sig_void_object
,
TRUE
);
register_icall
(
mini_llvmonly_throw_corlib_exception
,
mono_icall_sig_void_int
,
TRUE
);
register_icall
(
mini_llvmonly_resume_exception
,
mono_icall_sig_void
,
TRUE
);
register_icall
(
mini_llvmonly_resume_exception_il_state
,
mono_icall_sig_void_ptr_ptr
,
TRUE
);
register_icall
(
mini_llvmonly_load_exception
,
mono_icall_sig_object
,
TRUE
);
register_icall
(
mini_llvmonly_clear_exception
,
NULL
,
TRUE
);
register_icall
(
mini_llvmonly_match_exception
,
mono_icall_sig_int_ptr_int_int_ptr_object
,
TRUE
);
#if defined(ENABLE_LLVM) && defined(HAVE_UNWIND_H)
register_icall
(
mono_llvm_set_unhandled_exception_handler
,
NULL
,
TRUE
);
...
...
@@ -4895,7 +4891,6 @@ register_icalls (void)
register_icall
(
mini_llvmonly_init_delegate_virtual
,
mono_icall_sig_void_object_object_ptr
,
TRUE
);
register_icall
(
mini_llvmonly_throw_nullref_exception
,
mono_icall_sig_void
,
TRUE
);
register_icall
(
mini_llvmonly_throw_aot_failed_exception
,
mono_icall_sig_void_ptr
,
TRUE
);
register_icall
(
mini_llvmonly_pop_lmf
,
mono_icall_sig_void_ptr
,
TRUE
);
register_icall
(
mini_llvmonly_interp_entry_gsharedvt
,
mono_icall_sig_void_ptr_ptr_ptr
,
TRUE
);
register_icall
(
mono_get_assembly_object
,
mono_icall_sig_object_ptr
,
TRUE
);
...
...
src/native/public/mono/jit/details/jit-types.h
浏览文件 @
894382d7
...
...
@@ -21,7 +21,7 @@ typedef enum {
/* Enables full AOT mode, JIT is disabled and not allowed,
* equivalent to mono_jit_set_aot_only (true) */
MONO_AOT_MODE_FULL
,
/* Same as
full, but use only llvm compiled code
*/
/* Same as
LLVMONLY_INTERP
*/
MONO_AOT_MODE_LLVMONLY
,
/*
* Use interpreter only, no native code is generated
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录