Yes. I will do something similar. The PRIMITIVE instruction will be replaced with a call to a specific static method. I thought, I can do that each time when the primitive is called, since it isn't so difficult (in .NET mode) to evaluate the arguments from the primitive itself.
2006/1/18, Thomas Shackell <[EMAIL PROTECTED]>: > One thing to consider (that I forgot to mention) is that the compiler > generates wrappers for primitives. Thus if you have Haskell code like: > > aPrimitive primitive 1 :: Int -> Int > > The code that is generated is a wrapper > > FUN aPrimitive: > PUSH_ARG 0 > EVAL > POP 1 > PRIMITIVE [aPrimitive C code] > RETURN_EVAL > > It *is* possible to get away without the wrapper but it makes life quite > hard, because you need to make sure that the arguments are evaluated > before calling the primitive function. > > You could of course do > > FUN aPrimitive: > PUSH_ARG 0 > EVAL > MK_AP [aPrimitive C code] 1 > RETURN_EVAL > > but this is both quite nasty and also less efficient. > > > Tom > > > Krasimir Angelov wrote: > > Ok. Then I will follow the same way used in the bytecode backend. > > > > 2006/1/18, Thomas Shackell <[EMAIL PROTECTED]>: > > > >>Hi Krasimir, > >> > >>Great work with the .NET backend! > >> > >>It wouldn't be easy. Knowing whether a function internal to this module > >>is primitive is relatively easy. However knowing whether a function in > >>another module is primitive is harder because the program gets it's > >>information about external functions from the .hi file and the .hi file > >>doesn't store whether a function was primitive or not. > >> > >>It would be possible to add it, but messing about with the hi files > >>isn't fun (trust me ;-)). > >> > >>Hope that helps > >> > >>Tom > >> > >>Krasimir Angelov wrote: > >> > >>>Cool! Now I am able to compile the entire base package to IL code but > >>>there is still one problem. The byte code backend is using a special > >>>instruction for all primitives. I would like to try an another > >>>approach that will allow to call the primitives directly. For this > >>>purpose I need to now whether a given Id is an Id of a primitive. Is > >>>it currently possible? It is enough if there was any flag in the Info > >>>datatype. Any suggestions? > >>> > >>>Krasimir > >>> > >>>2006/1/17, Neil Mitchell <[EMAIL PROTECTED]>: > >>> > >>> > >>>>>code. Is it possible to remove the duplicated instances as well? > >>>> > >>>>Yep, I removed them already - they were certainly a bug. It should be > >>>>in the repo already. > >>>> > >>>>The compiler detects duplicate class declarations (good), but > >>>>supresses rename errors with the -redefine flag (bad, fixed now), and > >>>>doesn't detect duplicate instance declarations (bad, unfixed). > >>>> > >>>>Thanks > >>>> > >>>>Neil > >>>> > >>> > >>>_______________________________________________ > >>>Yhc mailing list > >>>[email protected] > >>>http://haskell.org/mailman/listinfo/yhc > >> > >> > > _______________________________________________ Yhc mailing list [email protected] http://haskell.org/mailman/listinfo/yhc
