Ok, there are two ways how to get around this issue: 1. Change the return type of your method to be int, always return 0 from the method (you will need to use HELPER_METHOD_FRAME_BEGIN_RET_0 instead of HELPER_METHOD_FRAME_BEGIN_0 to make it compile), and call the method using the following pattern:
if (0 != FJit_pHlpMyTest(NULL)) return; You can find an explanation of how this works in fcall.h. BTW: We have run into similar problems during the Whidbey Rotor development and used similar workaround to fix it. For example, here is what the THROW_FROM_HELPER macro in fjit is likely to be in Whidbey Rotor: #define THROW_FROM_HELPER(exceptNum) { \ while (NULL == HCALL1(void*, FJit_pHlpInternalThrowFromHelper, CorInfoException, exceptNum)) { }; \ return; } /* need return so we can decode the epilog */ --- OR --- 2. Enhance the interpreter in clr\src\vm\i386\gmsx86.cpp to understand the new opcode. In your case, it would mean adding the following lines to the big switch statement in clr\src\vm\i386\gmsx86.cpp: case 0x01: // add r/m, reg case 0x03: // add reg, r/m datasize = 0; goto DecodeRM; If you run into more problems like this, you can find the offending instructions by looking at the code pointed by "ip" variable when the assert fires. -Jan This posting is provided "AS IS" with no warranties, and confers no rights. -----Original Message----- From: Discussion of the Rotor Shared Source CLI implementation [mailto:[EMAIL PROTECTED] On Behalf Of Yuan Yu Sent: Monday, January 26, 2004 1:26 PM To: [EMAIL PROTECTED] Subject: Re: [DOTNET-ROTOR] Stacktrace Well, it actually failed on everything I tried. Here is exactly what I did: I was using the following compiler: C:\yuan\proj\rotor>cl Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 13.10.3077 for 80x86 Copyright (C) Microsoft Corporation 1984-2002. All rights reserved. In inc\corinfo.h, I added CORINFO_HELP_MY_TEST right afer CORINFO_HELP_MEMCPY in CorInfoHelpFunc. In vm\jitinterface.cpp, - after the following line: FCDECL2(double, JIT_DoubleDiv, double a, double b); I added: FCDECL1(void, JIT_MyTest, void* arg); - after the following line: JITHELPER(CORINFO_HELP_MEMCPY, NULL ) I added: JITHELPER(CORINFO_HELP_MY_TEST, JIT_MyTest ) - after the definition of JIT_NewArr1, I added: HCIMPL1(void, JIT_MyTest, void* arg) { HELPER_METHOD_FRAME_BEGIN_0(); printf("My test to print stack trace.\n"); void PrintStackTraceToStdout(); PrintStackTraceToStdout(); HELPER_METHOD_FRAME_END(); } HCIMPLEND In fjit\fjitcompiler.cpp, - after the following line: void (jit_call *FJit_pHlpVerification) (int offset); I added: void (jit_call *FJit_pHlpMyTest) (void* arg); - after the folling line: if (!FJit_pHlpAssign_Ref) return false; I added: FJit_pHlpMyTest = (void (jit_call *)(void *arg)) (jitInfo->getHelperFtn(CORINFO_HELP_MY_TEST)); if (!FJit_pHlpMyTest) return false; In fjit\fjit.h, after the following line: extern void (jit_call *FJit_pHlpVerification) (int offset); I added: extern void (jit_call *FJit_pHlpMyTest) (void *arg); In fjit\fjitdef.h, I added a call to FJit_pHlpMyTest in HELPER_CALL STFLD_I4_helper: void HELPER_CALL STFLD_I4_helper(unsigned int offset, int val, CORINFO_Object* or_obj) { if (or_obj == NULL) { THROW_FROM_HELPER(CORINFO_NullReferenceException); } // added to print stack trace: FJit_pHlpMyTest(NULL); *((int*) ((char*)(or_obj)+offset)) = val; } With these changes, it recompiled successfully. I then tried it on the following example: using System; class Test { public static void Main() { int x = 7; x = 17; Console.WriteLine(x); } } It failed with the following error message: C:\yuan\proj\rotor\csharp>csc /debug Test.cs Microsoft (R) Visual C# Shared Source CLI Compiler version 1.0.0003 for Microsoft (R) Shared Source CLI version 1.0.0 Copyright (C) Microsoft Corporation 2002. All rights reserved. C:\yuan\proj\rotor\csharp>clix Test My test to print stack trace. Assert failure(PID 5300 [0x000014b4], Thread: 2760 [0xac8]): !"Bad opcode" File: c:\yuan\proj\rotor\sscli-0\clr\src\vm\rotor_x86 \../i386/gmsx86.cpp, Li ne: 533 Image: C:\yuan\proj\rotor\sscli-0\build\v1.x86chk.rotor\clix.exe Any help would be greatly appreciated. Thanks, -Yuan =================================== This list is hosted by DevelopMentor(r) http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com =================================== This list is hosted by DevelopMentorŪ http://www.develop.com NEW! ASP.NET courses you may be interested in: 2 Days of ASP.NET, 29 Sept 2003, in Redmond http://www.develop.com/courses/2daspdotnet Guerrilla ASP.NET, 13 Oct 2003, in Boston http://www.develop.com/courses/gaspdotnet View archives and manage your subscription(s) at http://discuss.develop.com