Skip to content

Commit

Permalink
Update to keep up with rustc
Browse files Browse the repository at this point in the history
Deploy the playground to GitHub Pages intead of Azure
  • Loading branch information
rpjohnst committed Jan 19, 2025
1 parent c37d743 commit 957af09
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 21 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
run: cargo test --locked

playground:
permissions:
id-token: write
runs-on: ubuntu-latest
steps:
- name: Rust
Expand All @@ -45,13 +47,11 @@ jobs:
wasm-opt -Os -o src/playground.wasm ../target/wasm32-unknown-unknown/release/playground.wasm
npm ci
npm run build
- name: Login
- name: Upload
if: github.event_name == 'push'
uses: azure/login@v1
uses: actions/upload-pages-artifact@v3
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
path: playground/public
- name: Deploy
if: github.event_name == 'push'
run: |
az storage blob sync --account-name dejavu --container \$web --source playground/public
az cdn endpoint purge --resource-group dejavu --profile-name dejavu --name dejavu --content-paths "/*"
uses: actions/deploy-pages@v4
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
cargo-features = ["strip"]

[workspace]
resolver = "2"
members = [
Expand Down
4 changes: 2 additions & 2 deletions gml/src/back/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ impl ControlFlow {
/// that live across basic block boundaries. A block can either be dominated by a live definition,
/// or it can contain a definition that dominates later blocks.
pub struct Liveness {
pub in_: HandleMap<ssa::Label, HashSet<ssa::Value>>,
pub _in: HandleMap<ssa::Label, HashSet<ssa::Value>>,
pub out: HandleMap<ssa::Label, HashSet<ssa::Value>>,
}

Expand Down Expand Up @@ -107,6 +107,6 @@ impl Liveness {
}
}

Liveness { in_, out }
Liveness { _in: in_, out }
}
}
2 changes: 1 addition & 1 deletion gml/src/back/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct Codegen<'p> {
}

impl<'p> Codegen<'p> {
pub fn new(prototypes: &'p HashMap<Symbol, ssa::Prototype>) -> Codegen {
pub fn new(prototypes: &'p HashMap<Symbol, ssa::Prototype>) -> Codegen<'p> {
Codegen {
function: code::Function::new(),
locations: code::Locations::default(),
Expand Down
12 changes: 9 additions & 3 deletions gml/src/vm/dll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,14 @@ pub fn thunk(calltype: Cc, restype: Type, argtypes: &[Type]) -> Result<Thunk, Er
macro_rules! generate_thunks { [$(($($t:ty),*))*] => { [
$(<unsafe extern "C" fn($($t),*) -> f64 as FnExtern>::call,)*
$(<unsafe extern "C" fn($($t),*) -> *const c_char as FnExtern>::call,)*
$(<unsafe extern "stdcall" fn($($t),*) -> f64 as FnExtern>::call,)*
$(<unsafe extern "stdcall" fn($($t),*) -> *const c_char as FnExtern>::call,)*
$(#[cfg(windows)] <unsafe extern "stdcall" fn($($t),*) -> f64 as FnExtern>::call,)*
$(#[cfg(windows)] <unsafe extern "stdcall" fn($($t),*) -> *const c_char as FnExtern>::call,)*
] } }
static THUNKS: [Thunk; 172] = generate_thunks![
#[cfg(not(windows))]
const NUM_THUNKS: usize = 86;
#[cfg(windows)]
const NUM_THUNKS: usize = 86 + 86;
static THUNKS: [Thunk; NUM_THUNKS] = generate_thunks![
()

(f64)
Expand Down Expand Up @@ -192,4 +196,6 @@ macro_rules! impl_fn_extern_params { ($cc:literal) => {
} }

impl_fn_extern_params!("C");

#[cfg(windows)]
impl_fn_extern_params!("stdcall");
10 changes: 6 additions & 4 deletions gml/src/vm/interpreter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,14 +200,16 @@ impl Thread {
pub fn execute<W: for<'r> vm::Project<'r, (&'r mut World, &'r mut Assets<W>)>>(
&mut self, cx: &mut W, f: Function, args: Vec<Value>
) -> Result<Value> {
let cx: &mut dyn vm::Project<(&mut World, &mut Assets<W>)> = cx;
let cx = unsafe { &mut *(cx as *mut _ as *mut _) };
execute_internal(self, cx, f, args)
unsafe {
let cx: *mut dyn for<'r> vm::Project<'r, (&'r mut World, &'r mut Assets<W>)> = cx;
let cx: *mut dyn for<'r> vm::Project<'r, (&'r mut World, &'r mut Assets<self::W>)> = mem::transmute(cx);
execute_internal(self, &mut *cx, f, args)
}
}
}

// Opaque type to erase the runner-side container for `vm::World` and `vm::Assets`.
extern { type W; }
extern "C" { type W; }

fn execute_internal(
thread: &mut Thread, cx: &mut dyn for<'r> vm::Project<'r, (&'r mut World, &'r mut Assets<W>)>,
Expand Down
1 change: 0 additions & 1 deletion playground/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![cfg(target_arch = "wasm32")]
#![feature(const_mut_refs)]

use std::{io, ptr, slice};
use std::io::Write;
Expand Down
2 changes: 1 addition & 1 deletion runner/src/platform/unknown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub fn run(mut cx: crate::Context) {
crate::motion::State::simulate(&mut cx);
}

pub struct Library(*mut ());
pub struct Library;

impl Library {
pub fn load(_dll: Symbol) -> Option<Library> { None }
Expand Down
2 changes: 1 addition & 1 deletion runner/src/platform/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ extern "system" {
pub fn stop();
}

pub struct Library(*mut ());
pub struct Library;

impl Library {
pub fn load(_dll: Symbol) -> Option<Library> { None }
Expand Down

0 comments on commit 957af09

Please sign in to comment.