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Ū  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

Reply via email to