|
@@ -130,6 +130,7 @@ type access =
|
|
| AInstanceProto of texpr * field index
|
|
| AInstanceProto of texpr * field index
|
|
| AInstanceField of texpr * field index
|
|
| AInstanceField of texpr * field index
|
|
| AArray of reg * (ttype * ttype) * reg
|
|
| AArray of reg * (ttype * ttype) * reg
|
|
|
|
+ | ACArray of reg * ttype * reg
|
|
| AVirtualMethod of texpr * field index
|
|
| AVirtualMethod of texpr * field index
|
|
| ADynamic of texpr * string index
|
|
| ADynamic of texpr * string index
|
|
| AEnum of tenum * field index
|
|
| AEnum of tenum * field index
|
|
@@ -1376,6 +1377,13 @@ and get_access ctx e =
|
|
free ctx a;
|
|
free ctx a;
|
|
let t = to_type ctx t in
|
|
let t = to_type ctx t in
|
|
AArray (a,(t,t),i)
|
|
AArray (a,(t,t),i)
|
|
|
|
+ | TInst ({ cl_path = ["hl"],"Abstract" },[TInst({ cl_kind = KExpr (EConst (String("hl_carray",_)),_) },_)]) ->
|
|
|
|
+ let a = eval_null_check ctx a in
|
|
|
|
+ hold ctx a;
|
|
|
|
+ let i = eval_to ctx i HI32 in
|
|
|
|
+ free ctx a;
|
|
|
|
+ let t = to_type ctx e.etype in
|
|
|
|
+ ACArray (a,t,i)
|
|
| TAbstract (a,pl) ->
|
|
| TAbstract (a,pl) ->
|
|
loop (Abstract.get_underlying_type a pl)
|
|
loop (Abstract.get_underlying_type a pl)
|
|
| _ ->
|
|
| _ ->
|
|
@@ -1893,7 +1901,13 @@ and eval_expr ctx e =
|
|
r
|
|
r
|
|
| "$asize", [e] ->
|
|
| "$asize", [e] ->
|
|
let r = alloc_tmp ctx HI32 in
|
|
let r = alloc_tmp ctx HI32 in
|
|
- op ctx (OArraySize (r, eval_to ctx e HArray));
|
|
|
|
|
|
+ (match follow e.etype with
|
|
|
|
+ | TInst ({cl_path=["hl"],"Abstract"},[TInst({ cl_kind = KExpr (EConst (String("hl_carray",_)),_) },_)]) ->
|
|
|
|
+ let arr = eval_expr ctx e in
|
|
|
|
+ op ctx (ONullCheck arr);
|
|
|
|
+ op ctx (OArraySize (r, arr))
|
|
|
|
+ | _ ->
|
|
|
|
+ op ctx (OArraySize (r, eval_to ctx e HArray)));
|
|
r
|
|
r
|
|
| "$aalloc", [esize] ->
|
|
| "$aalloc", [esize] ->
|
|
let et = (match follow e.etype with TAbstract ({ a_path = ["hl"],"NativeArray" },[t]) -> to_type ctx t | _ -> invalid()) in
|
|
let et = (match follow e.etype with TAbstract ({ a_path = ["hl"],"NativeArray" },[t]) -> to_type ctx t | _ -> invalid()) in
|
|
@@ -2207,7 +2221,7 @@ and eval_expr ctx e =
|
|
ignore(make_fun ctx ("","") fid f None None);
|
|
ignore(make_fun ctx ("","") fid f None None);
|
|
end;
|
|
end;
|
|
op ctx (OStaticClosure (r,fid));
|
|
op ctx (OStaticClosure (r,fid));
|
|
- | ANone | ALocal _ | AArray _ | ACaptured _ ->
|
|
|
|
|
|
+ | ANone | ALocal _ | AArray _ | ACaptured _ | ACArray _ ->
|
|
abort "Invalid access" e.epos);
|
|
abort "Invalid access" e.epos);
|
|
let to_t = to_type ctx e.etype in
|
|
let to_t = to_type ctx e.etype in
|
|
(match to_t with
|
|
(match to_t with
|
|
@@ -2451,7 +2465,7 @@ and eval_expr ctx e =
|
|
let r = value() in
|
|
let r = value() in
|
|
op ctx (OSetEnumField (ctx.m.mcaptreg,index,r));
|
|
op ctx (OSetEnumField (ctx.m.mcaptreg,index,r));
|
|
r
|
|
r
|
|
- | AEnum _ | ANone | AInstanceFun _ | AInstanceProto _ | AStaticFun _ | AVirtualMethod _ ->
|
|
|
|
|
|
+ | AEnum _ | ANone | AInstanceFun _ | AInstanceProto _ | AStaticFun _ | AVirtualMethod _ | ACArray _ ->
|
|
die "" __LOC__)
|
|
die "" __LOC__)
|
|
| OpBoolOr ->
|
|
| OpBoolOr ->
|
|
let r = alloc_tmp ctx HBool in
|
|
let r = alloc_tmp ctx HBool in
|
|
@@ -2726,6 +2740,10 @@ and eval_expr ctx e =
|
|
(match get_access ctx e with
|
|
(match get_access ctx e with
|
|
| AArray (a,at,idx) ->
|
|
| AArray (a,at,idx) ->
|
|
array_read ctx a at idx e.epos
|
|
array_read ctx a at idx e.epos
|
|
|
|
+ | ACArray (a,t,idx) ->
|
|
|
|
+ let tmp = alloc_tmp ctx t in
|
|
|
|
+ op ctx (OGetArray (tmp,a,idx));
|
|
|
|
+ tmp
|
|
| _ ->
|
|
| _ ->
|
|
die "" __LOC__)
|
|
die "" __LOC__)
|
|
| TMeta (_,e) ->
|
|
| TMeta (_,e) ->
|
|
@@ -3045,7 +3063,7 @@ and gen_assign_op ctx acc e1 f =
|
|
free ctx robj;
|
|
free ctx robj;
|
|
op ctx (ODynSet (robj,fid,r));
|
|
op ctx (ODynSet (robj,fid,r));
|
|
r
|
|
r
|
|
- | ANone | ALocal _ | AStaticFun _ | AInstanceFun _ | AInstanceProto _ | AVirtualMethod _ | AEnum _ ->
|
|
|
|
|
|
+ | ANone | ALocal _ | AStaticFun _ | AInstanceFun _ | AInstanceProto _ | AVirtualMethod _ | AEnum _ | ACArray _ ->
|
|
die "" __LOC__
|
|
die "" __LOC__
|
|
|
|
|
|
and build_capture_vars ctx f =
|
|
and build_capture_vars ctx f =
|