Comments (11)
Sorry for the late response...
Would you be willing to help us fix this?
It's a bug in our IL interpreter..
from cosmos.
I've also run into several "not implanted" IL errors. I'm assuming this has something to do with the recent Z-machine implantation.
from cosmos.
Which Z-machine implementation?
The bug is in our IL interpreter, and isn't too hard to fix. We could guide you through the process....
from cosmos.
That'd be great! Fair warning, I'm a bit lost on "IL interpreter". Is that
what interprets methods + etc into machine language?
from cosmos.
Oh, I thought it had something to do with it. Never mind!
from cosmos.
@phsah123 IL looks for example like this:
IL_0001: ldc.i4.3 (Loads a constant int32 value of 4 on to the stack)
IL_0002: ldc.i4.2
IL_0003: add
offset 3 ha no way of knowing (without looking back) what types it has to add (it could be 2 bytes, but also 2 decimals). The il interpreter "interprets" the previous instructions (and branches etc are also handled) to see what operand types the compiler needs to use..
The situation for stobj is not yet implemented.
from cosmos.
So I decided to take a stab at this problem since I've been meaning to check out Cosmos in detail for some time and had some free time today.
Fixing Stobj for GetNumberOfStackPops and GetNumberOfStackPushes was simple enough. However, after I fixed those two things I got an issue of a missing plug for RuntimeTypeHandle::CreateInstanceForAnotherGenericParameter.
This method is called from EqualityComparer.CreateComparer when a System.Collections.Generic.Dictionary is constructed.
Of course, it might seem confusing that there is a Dictionary getting created considering pshah123's code doesn't use the Dictionary class. Well, apparently after you go over 6 cases in a switch statement on a string, the C# compiler changes it into a Dictionary lookup instead.
Anyway, I tracked down CreateInstanceForAnotherGenericParameter's implementation in CoreCLR to CreateInstanceForGenericType, and it is a bit of a doozy.
I'm pretty sure the whole thing boils down to allocating and constructing a GenericEqualityComparer (in our case), but it isn't immediately obvious to me how to best do the same thing in Cosmos. I wanted to post in here and see if anyone wanted to point me in the right direction before I dive down this rabbit hole.
from cosmos.
And on a semi-related note: Is there a way to get changes I've made to Cosmos into my installed user kit without restarting Visual Studio every time? Whenever I make a change to IL2CPU, I end up closing all my instances of Visual Studio and running install.bat again. Not sure if I missed something in the documentation or the workflow there is just a bit tedious right now.
from cosmos.
@PathogenDavid Good work. Can you send a pull request for the GetNumberOfStackPops and GetNumberOfStackPushes changes?
Most likely the CreateCompiler code uses reflection to do its magic, which won't work for sure on cosmos.
Maybe we could make special cases in EqualityComparer.CreateComparer for the main types (String, numeric types, etc)
@PathogenDavid Would you be interested in helping us out? We could really use some lower-level people. We have some humps in the compiler currently and once we're past those, we could really move forward again...
from cosmos.
@mterwoord
Sure, do know though that I have no idea if stobj is working since I couldn't compile+run the code without the plug. The pull request is #77.
That is what I was thinking as well. It wouldn't be as ideal, but it certainly works. I'll give it a try sometime this week and report back.
I'm definitely interested in helping out, but I can't really promise any consistent effort on my part for the time being. My free time is a bit sporadic these days.
from cosmos.
@PathogenDavid If you're interested in helping, please add me on skype (same handle), and I'll get you going. At first, we could use help on getting the PR's reviewed...
from cosmos.
Related Issues (20)
- Makefile build paths HOT 1
- for the "MakeIso" task was not specified for the required parameter "UseUEFI"
- The Website Instructions Say To Install VS 2019, But latest Version Runs VS 2022 HOT 3
- Question: How could i bring back grub instead of Limine HOT 3
- Plug for RegularExpression (Regex) HOT 3
- filesystem HOT 2
- CS0120 HOT 4
- VBE Canvas - positioning issue HOT 11
- VBE Canvas - 1366x768 is "tilted" HOT 5
- System calls? HOT 2
- VBECanvas display issue HOT 6
- Can’t find one for vs-2010 HOT 3
- Won’t boot on old computers HOT 13
- How can I format a fat32 disk HOT 5
- "Visual Studio Workloads was not found. Install install .Net Core 6.0 Runtime" HOT 3
- Cosmos: Build errors
- Build ISO Doesn't Work At All HOT 9
- File.Exists() causes CPU Exception HOT 8
- can someone help me i dont know how to fix this HOT 4
- Nothing happens to me after starting my OS (the input cursor flashes, but I did not add this to the code) HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cosmos.