11
11
12
12
#include < algorithm>
13
13
14
- LUAU_FASTFLAGVARIABLE (LuauCodegenUserdataOps, false )
15
14
LUAU_FASTFLAGVARIABLE (LuauCodegenFastcall3, false )
16
15
17
16
namespace Luau
@@ -749,50 +748,27 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
749
748
750
749
regTags[ra] = LBC_TYPE_ANY;
751
750
752
- if (FFlag::LuauCodegenUserdataOps)
753
- {
754
- TString* str = gco2ts (function.proto ->k [kc].value .gc );
755
- const char * field = getstr (str);
751
+ TString* str = gco2ts (function.proto ->k [kc].value .gc );
752
+ const char * field = getstr (str);
756
753
757
- if (bcType.a == LBC_TYPE_VECTOR)
754
+ if (bcType.a == LBC_TYPE_VECTOR)
755
+ {
756
+ if (str->len == 1 )
758
757
{
759
- if (str->len == 1 )
760
- {
761
- // Same handling as LOP_GETTABLEKS block in lvmexecute.cpp - case-insensitive comparison with "X" / "Y" / "Z"
762
- char ch = field[0 ] | ' ' ;
763
-
764
- if (ch == ' x' || ch == ' y' || ch == ' z' )
765
- regTags[ra] = LBC_TYPE_NUMBER;
766
- }
758
+ // Same handling as LOP_GETTABLEKS block in lvmexecute.cpp - case-insensitive comparison with "X" / "Y" / "Z"
759
+ char ch = field[0 ] | ' ' ;
767
760
768
- if (regTags[ra] == LBC_TYPE_ANY && hostHooks.vectorAccessBytecodeType )
769
- regTags[ra] = hostHooks.vectorAccessBytecodeType (field, str->len );
770
- }
771
- else if (isCustomUserdataBytecodeType (bcType.a ))
772
- {
773
- if (regTags[ra] == LBC_TYPE_ANY && hostHooks.userdataAccessBytecodeType )
774
- regTags[ra] = hostHooks.userdataAccessBytecodeType (bcType.a , field, str->len );
761
+ if (ch == ' x' || ch == ' y' || ch == ' z' )
762
+ regTags[ra] = LBC_TYPE_NUMBER;
775
763
}
764
+
765
+ if (regTags[ra] == LBC_TYPE_ANY && hostHooks.vectorAccessBytecodeType )
766
+ regTags[ra] = hostHooks.vectorAccessBytecodeType (field, str->len );
776
767
}
777
- else
768
+ else if ( isCustomUserdataBytecodeType (bcType. a ))
778
769
{
779
- if (bcType.a == LBC_TYPE_VECTOR)
780
- {
781
- TString* str = gco2ts (function.proto ->k [kc].value .gc );
782
- const char * field = getstr (str);
783
-
784
- if (str->len == 1 )
785
- {
786
- // Same handling as LOP_GETTABLEKS block in lvmexecute.cpp - case-insensitive comparison with "X" / "Y" / "Z"
787
- char ch = field[0 ] | ' ' ;
788
-
789
- if (ch == ' x' || ch == ' y' || ch == ' z' )
790
- regTags[ra] = LBC_TYPE_NUMBER;
791
- }
792
-
793
- if (regTags[ra] == LBC_TYPE_ANY && hostHooks.vectorAccessBytecodeType )
794
- regTags[ra] = hostHooks.vectorAccessBytecodeType (field, str->len );
795
- }
770
+ if (regTags[ra] == LBC_TYPE_ANY && hostHooks.userdataAccessBytecodeType )
771
+ regTags[ra] = hostHooks.userdataAccessBytecodeType (bcType.a , field, str->len );
796
772
}
797
773
798
774
bcType.result = regTags[ra];
@@ -829,7 +805,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
829
805
regTags[ra] = LBC_TYPE_NUMBER;
830
806
else if (bcType.a == LBC_TYPE_VECTOR && bcType.b == LBC_TYPE_VECTOR)
831
807
regTags[ra] = LBC_TYPE_VECTOR;
832
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType &&
808
+ else if (hostHooks.userdataMetamethodBytecodeType &&
833
809
(isCustomUserdataBytecodeType (bcType.a ) || isCustomUserdataBytecodeType (bcType.b )))
834
810
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , bcType.b , opcodeToHostMetamethod (op));
835
811
@@ -861,7 +837,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
861
837
if (bcType.b == LBC_TYPE_NUMBER || bcType.b == LBC_TYPE_VECTOR)
862
838
regTags[ra] = LBC_TYPE_VECTOR;
863
839
}
864
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType &&
840
+ else if (hostHooks.userdataMetamethodBytecodeType &&
865
841
(isCustomUserdataBytecodeType (bcType.a ) || isCustomUserdataBytecodeType (bcType.b )))
866
842
{
867
843
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , bcType.b , opcodeToHostMetamethod (op));
@@ -884,7 +860,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
884
860
885
861
if (bcType.a == LBC_TYPE_NUMBER && bcType.b == LBC_TYPE_NUMBER)
886
862
regTags[ra] = LBC_TYPE_NUMBER;
887
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType &&
863
+ else if (hostHooks.userdataMetamethodBytecodeType &&
888
864
(isCustomUserdataBytecodeType (bcType.a ) || isCustomUserdataBytecodeType (bcType.b )))
889
865
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , bcType.b , opcodeToHostMetamethod (op));
890
866
@@ -907,7 +883,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
907
883
regTags[ra] = LBC_TYPE_NUMBER;
908
884
else if (bcType.a == LBC_TYPE_VECTOR && bcType.b == LBC_TYPE_VECTOR)
909
885
regTags[ra] = LBC_TYPE_VECTOR;
910
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType &&
886
+ else if (hostHooks.userdataMetamethodBytecodeType &&
911
887
(isCustomUserdataBytecodeType (bcType.a ) || isCustomUserdataBytecodeType (bcType.b )))
912
888
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , bcType.b , opcodeToHostMetamethod (op));
913
889
@@ -939,7 +915,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
939
915
if (bcType.b == LBC_TYPE_NUMBER || bcType.b == LBC_TYPE_VECTOR)
940
916
regTags[ra] = LBC_TYPE_VECTOR;
941
917
}
942
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType &&
918
+ else if (hostHooks.userdataMetamethodBytecodeType &&
943
919
(isCustomUserdataBytecodeType (bcType.a ) || isCustomUserdataBytecodeType (bcType.b )))
944
920
{
945
921
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , bcType.b , opcodeToHostMetamethod (op));
@@ -962,7 +938,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
962
938
963
939
if (bcType.a == LBC_TYPE_NUMBER && bcType.b == LBC_TYPE_NUMBER)
964
940
regTags[ra] = LBC_TYPE_NUMBER;
965
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType &&
941
+ else if (hostHooks.userdataMetamethodBytecodeType &&
966
942
(isCustomUserdataBytecodeType (bcType.a ) || isCustomUserdataBytecodeType (bcType.b )))
967
943
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , bcType.b , opcodeToHostMetamethod (op));
968
944
@@ -984,7 +960,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
984
960
regTags[ra] = LBC_TYPE_NUMBER;
985
961
else if (bcType.a == LBC_TYPE_VECTOR && bcType.b == LBC_TYPE_VECTOR)
986
962
regTags[ra] = LBC_TYPE_VECTOR;
987
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType &&
963
+ else if (hostHooks.userdataMetamethodBytecodeType &&
988
964
(isCustomUserdataBytecodeType (bcType.a ) || isCustomUserdataBytecodeType (bcType.b )))
989
965
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , bcType.b , opcodeToHostMetamethod (op));
990
966
@@ -1014,7 +990,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
1014
990
if (bcType.b == LBC_TYPE_NUMBER || bcType.b == LBC_TYPE_VECTOR)
1015
991
regTags[ra] = LBC_TYPE_VECTOR;
1016
992
}
1017
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType &&
993
+ else if (hostHooks.userdataMetamethodBytecodeType &&
1018
994
(isCustomUserdataBytecodeType (bcType.a ) || isCustomUserdataBytecodeType (bcType.b )))
1019
995
{
1020
996
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , bcType.b , opcodeToHostMetamethod (op));
@@ -1047,7 +1023,7 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
1047
1023
regTags[ra] = LBC_TYPE_NUMBER;
1048
1024
else if (bcType.a == LBC_TYPE_VECTOR)
1049
1025
regTags[ra] = LBC_TYPE_VECTOR;
1050
- else if (FFlag::LuauCodegenUserdataOps && hostHooks.userdataMetamethodBytecodeType && isCustomUserdataBytecodeType (bcType.a ))
1026
+ else if (hostHooks.userdataMetamethodBytecodeType && isCustomUserdataBytecodeType (bcType.a ))
1051
1027
regTags[ra] = hostHooks.userdataMetamethodBytecodeType (bcType.a , LBC_TYPE_ANY, HostMetamethod::Minus);
1052
1028
1053
1029
bcType.result = regTags[ra];
@@ -1203,26 +1179,13 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
1203
1179
1204
1180
bcType.result = LBC_TYPE_FUNCTION;
1205
1181
1206
- if (FFlag::LuauCodegenUserdataOps)
1207
- {
1208
- TString* str = gco2ts (function.proto ->k [kc].value .gc );
1209
- const char * field = getstr (str);
1182
+ TString* str = gco2ts (function.proto ->k [kc].value .gc );
1183
+ const char * field = getstr (str);
1210
1184
1211
- if (bcType.a == LBC_TYPE_VECTOR && hostHooks.vectorNamecallBytecodeType )
1212
- knownNextCallResult = LuauBytecodeType (hostHooks.vectorNamecallBytecodeType (field, str->len ));
1213
- else if (isCustomUserdataBytecodeType (bcType.a ) && hostHooks.userdataNamecallBytecodeType )
1214
- knownNextCallResult = LuauBytecodeType (hostHooks.userdataNamecallBytecodeType (bcType.a , field, str->len ));
1215
- }
1216
- else
1217
- {
1218
- if (bcType.a == LBC_TYPE_VECTOR && hostHooks.vectorNamecallBytecodeType )
1219
- {
1220
- TString* str = gco2ts (function.proto ->k [kc].value .gc );
1221
- const char * field = getstr (str);
1222
-
1223
- knownNextCallResult = LuauBytecodeType (hostHooks.vectorNamecallBytecodeType (field, str->len ));
1224
- }
1225
- }
1185
+ if (bcType.a == LBC_TYPE_VECTOR && hostHooks.vectorNamecallBytecodeType )
1186
+ knownNextCallResult = LuauBytecodeType (hostHooks.vectorNamecallBytecodeType (field, str->len ));
1187
+ else if (isCustomUserdataBytecodeType (bcType.a ) && hostHooks.userdataNamecallBytecodeType )
1188
+ knownNextCallResult = LuauBytecodeType (hostHooks.userdataNamecallBytecodeType (bcType.a , field, str->len ));
1226
1189
break ;
1227
1190
}
1228
1191
case LOP_CALL:
0 commit comments