Skip to content

Commit

Permalink
Updated tests/syntax_callref.nit
Browse files Browse the repository at this point in the history
Signed-off-by: Louis-Vincent Boudreault <[email protected]>
  • Loading branch information
lvboudre committed Oct 7, 2019
1 parent 1ff59e4 commit 53ff63f
Show file tree
Hide file tree
Showing 9 changed files with 604 additions and 500 deletions.
461 changes: 225 additions & 236 deletions src/compiler/abstract_compiler.nit

Large diffs are not rendered by default.

24 changes: 9 additions & 15 deletions src/compiler/global_compiler.nit
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,7 @@ class GlobalCompilerVisitor
my_recv = autobox(recv, object_type)
end
var thunk = new CustomizedThunkFunction(mmethoddef, my_recv.mtype.as(MClassType))
thunk.polymorph_call_flag = not my_recv.is_exact #true
#thunk.force_polymorphism = not my_recv.is_exact
thunk.polymorph_call_flag = not my_recv.is_exact
compiler.todo(method)
compiler.todo(thunk)

Expand All @@ -499,12 +498,7 @@ class GlobalCompilerVisitor
var ret_mtype = mmethoddef.msignature.return_mtype

if ret_mtype != null then
# TODO check for separate compiler
ret_mtype = resolve_for(ret_mtype, routine)
# var temp = ret_mtype
# If mmethoddef has a return type, use the type defined
# in the routine instance instead.
#ret_mtype = routine_type.arguments.last
end
var callsite = "{underlying_method}({ss})"
if ret_mtype != null then
Expand Down Expand Up @@ -1122,17 +1116,17 @@ private class CustomizedRuntimeFunction
# class A[E]
# fun toto(x: E)
# do
# ...do something with x...
# # ...do something with x...
# end
# end
# end
# var a = new A[nullable Int]
# var f = &a.toto
# f.call(null) <-- Will produce a proper C callsite, but it will
# -- produce unreachable (dead code) for type checking
# -- and covariance. Thus, creating warnings when
# -- compiling in global. However, if you ignore
# -- those warnings, the binary works perfectly fine.
# f.call(null) # Will produce a proper C callsite, but it will
# # produce unreachable (dead code) for type checking
# # and covariance. Thus, creating warnings when
# # compiling in global. However, if you ignore
# # those warnings, the binary works perfectly fine.
# ~~~~
var intromclassdef = self.mmethoddef.mproperty.intro_mclassdef
var is_callref = v.compiler.all_routine_types_name.has(intromclassdef.name)
Expand Down Expand Up @@ -1165,12 +1159,12 @@ private class CustomizedRuntimeFunction
end
end

# Thunk implementation for global compiler.
# For more detail see `abstract_compiler::ThunkFunction` documentation.
class CustomizedThunkFunction
super ThunkFunction
super CustomizedRuntimeFunction

#var force_polymorphism = false

redef fun c_name
do
return "THUNK_" + super
Expand Down
Loading

0 comments on commit 53ff63f

Please sign in to comment.