Changeset 308 in dev for trunk/abdev/BasicCompiler64/Compile_Var.cpp
- Timestamp:
- Aug 29, 2007, 9:05:22 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler64/Compile_Var.cpp
r266 r308 24 24 ///////////////////////////////////////////// 25 25 26 SetReg_WholeVariable( DEF_INT64,pRelativeVar,REG_R11);26 SetReg_WholeVariable(Type(DEF_INT64),pRelativeVar,REG_R11); 27 27 28 28 //mov qword ptr[rsp+offset],r11 ※スタックフレームを利用 … … 376 376 RelativeVar.offset=-LocalVar_ThisPtrOffset; 377 377 378 SetReg_WholeVariable( DEF_PTR_VOID,&RelativeVar,reg);378 SetReg_WholeVariable(Type(DEF_PTR_VOID),&RelativeVar,reg); 379 379 } 380 380 bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType, Subscripts *pResultSubscripts ){ … … 742 742 743 743 bool SetInitGlobalData(int offset,const Type &type,const Subscripts &subscripts,const char *lpszInitBuf){ 744 extern BYTE *initGlobalBuf;745 744 int i2,i3; 746 745 char temporary[VN_SIZE]; … … 846 845 847 846 if( type.IsDouble() ){ 848 *(double *)(initGlobalBuf+offset)=(double)dbl; 847 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite( 848 offset, 849 (const char *)&dbl, 850 sizeof(double) 851 ); 849 852 } 850 853 else if( type.IsSingle() ){ 851 *(float *)(initGlobalBuf+offset)=(float)dbl; 854 float flt = (float)dbl; 855 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite( 856 offset, 857 (const char *)&flt, 858 sizeof(float) 859 ); 852 860 } 853 861 else if( type.Is64() || type.IsPointer() ){ … … 867 875 } 868 876 else{ 869 *(_int64 *)(initGlobalBuf+offset)=i64data; 877 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite( 878 offset, 879 (const char *)&i64data, 880 sizeof(_int64) 881 ); 870 882 } 871 883 } 872 884 else if( type.IsDWord() || type.IsLong() ){ 873 *(DWORD *)(initGlobalBuf+offset)=(DWORD)i64data; 885 long l = (long)i64data; 886 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite( 887 offset, 888 (const char *)&l, 889 sizeof(long) 890 ); 874 891 } 875 892 else if( type.IsWord() || type.IsInteger() ){ 876 *(WORD *)(initGlobalBuf+offset)=(WORD)i64data; 893 short s = (short)i64data; 894 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite( 895 offset, 896 (const char *)&s, 897 sizeof(short) 898 ); 877 899 } 878 900 else if( type.IsSByte() || type.IsByte() || type.IsBoolean() ){ 879 *(BYTE *)(initGlobalBuf+offset)=(BYTE)i64data; 901 char c = (char)i64data; 902 compiler.GetObjectModule().meta.GetGlobalVars().initAreaBuffer.Overwrite( 903 offset, 904 (const char *)&c, 905 sizeof(char) 906 ); 880 907 } 881 908 … … 1057 1084 } 1058 1085 1059 void dim( char *VarName, const Subscripts &subscripts, Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags){ 1086 void dim( char *VarName, const Subscripts &subscripts, const Type &type,const char *InitBuf,const char *ConstractParameter,DWORD dwFlags) 1087 { 1060 1088 if( UserProc::IsGlobalAreaCompiling() ){ 1061 1089 ///////////////////////// … … 1078 1106 bool isConst = ( dwFlags & DIMFLAG_CONST ) ? true:false; 1079 1107 1080 Variable *pVar = new Variable( VarName, type, isConst, false, ConstractParameter );1108 Variable *pVar = new Variable( VarName, type, isConst, false, ConstractParameter, false ); 1081 1109 1082 1110 if( subscripts.size() > 0 ){ … … 1194 1222 SetError(); 1195 1223 } 1196 SetVariableFromRax( DEF_OBJECT, DEF_OBJECT, &RelativeVar );1224 SetVariableFromRax( Type( DEF_OBJECT, *compiler.GetObjectModule().meta.GetClasses().GetObjectClassPtr() ), DEF_OBJECT, &RelativeVar ); 1197 1225 } 1198 1226 } … … 1296 1324 // call AddGlobalRootPtr 1297 1325 compiler.codeGenerator.op_call( pUserProc_AddGlobalRootPtr ); 1298 1299 ReallocNativeCodeBuffer();1300 1326 } 1301 1327 }
Note:
See TracChangeset
for help on using the changeset viewer.