Skip to content

Commit

Permalink
[java/cs] Avoid boxing with Runtime.compare expressions on dynamic fi…
Browse files Browse the repository at this point in the history
…eld access

Closes #4047
  • Loading branch information
waneck committed Jun 25, 2017
1 parent 679e657 commit 46601e4
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/generators/gencs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3014,7 +3014,7 @@ let generate con =
| TBinop (Ast.OpLt, e1, e2)
| TBinop (Ast.OpLte, e1, e2)
| TBinop (Ast.OpGte, e1, e2)
| TBinop (Ast.OpGt, e1, e2) -> is_dynamic e.etype || is_dynamic_expr e1 || is_dynamic_expr e2 || is_string e1.etype || is_string e2.etype
| TBinop (Ast.OpGt, e1, e2) -> is_dynamic e.etype || is_dynamic e1.etype || is_dynamic e2.etype || is_string e1.etype || is_string e2.etype
| TBinop (_, e1, e2) -> is_dynamic e.etype || is_dynamic_expr e1 || is_dynamic_expr e2
| TUnop (_, _, e1) -> is_dynamic_expr e1 || is_null_expr e1 (* we will see if the expression is Null<T> also, as the unwrap from Unop will be the same *)
| _ -> false)
Expand Down
2 changes: 1 addition & 1 deletion src/generators/genjava.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,7 @@ let generate con =
| TBinop (Ast.OpLt, e1, e2)
| TBinop (Ast.OpLte, e1, e2)
| TBinop (Ast.OpGte, e1, e2)
| TBinop (Ast.OpGt, e1, e2) -> is_dynamic_op e.etype || is_dynamic_expr is_dynamic_op e1 || is_dynamic_expr is_dynamic_op e2 || is_string e1.etype || is_string e2.etype
| TBinop (Ast.OpGt, e1, e2) -> is_dynamic_op e.etype || is_dynamic_op e1.etype || is_dynamic_op e2.etype || is_string e1.etype || is_string e2.etype
| TBinop (_, e1, e2) -> is_dynamic_op e.etype || is_dynamic_expr is_dynamic_op e1 || is_dynamic_expr is_dynamic_op e2
| TUnop (_, _, e1) ->
is_dynamic_expr is_dynamic_op e1
Expand Down

1 comment on commit 46601e4

@nadako
Copy link
Member

@nadako nadako commented on 46601e4 Jun 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow it was that simple? that removed a lot of boxing in my codebase!

Please sign in to comment.