Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename instance_id => process_id #6

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion script/src/v2_scheduler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ impl<DL: CellDataProvider + HeaderProvider + ExtensionProvider + Send + Sync + C
machine
.machine
.memory_mut()
.store64(&args.instance_id_addr, &spawned_vm_id)?;
.store64(&args.process_id_addr, &spawned_vm_id)?;
machine.machine.set_register(A0, SUCCESS as u64);
}
}
Expand Down
18 changes: 8 additions & 10 deletions script/src/v2_syscalls.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Syscall implementation

use crate::{
v2_types::{
DataPieceId, Message, PipeArgs, PipeId, PipeIoArgs, SpawnArgs, TxData, VmId, WaitArgs,
Expand Down Expand Up @@ -261,11 +259,11 @@ impl<DL: CellDataProvider + HeaderProvider + ExtensionProvider + Send + Sync + C
argv_addr = argv_addr.wrapping_add(8);
}

let (instance_id_addr, pipes) = {
let instance_id_addr_addr = spgs_addr.wrapping_add(16);
let instance_id_addr = machine
let (process_id_addr, pipes) = {
let process_id_addr_addr = spgs_addr.wrapping_add(16);
let process_id_addr = machine
.memory_mut()
.load64(&Mac::REG::from_u64(instance_id_addr_addr))?
.load64(&Mac::REG::from_u64(process_id_addr_addr))?
.to_u64();
let pipes_addr_addr = spgs_addr.wrapping_add(24);
let mut pipes_addr = machine
Expand All @@ -287,7 +285,7 @@ impl<DL: CellDataProvider + HeaderProvider + ExtensionProvider + Send + Sync + C
pipes_addr += 8;
}
}
(instance_id_addr, pipes)
(process_id_addr, pipes)
};

// We are fetching the actual cell here for some in-place validation
Expand Down Expand Up @@ -325,7 +323,7 @@ impl<DL: CellDataProvider + HeaderProvider + ExtensionProvider + Send + Sync + C
length,
argv,
pipes,
instance_id_addr,
process_id_addr,
},
));

Expand Down Expand Up @@ -357,7 +355,7 @@ impl<DL: CellDataProvider + HeaderProvider + ExtensionProvider + Send + Sync + C
}

// Fetch current instance ID
fn instance_id<Mac: SupportMachine>(&mut self, machine: &mut Mac) -> Result<(), Error> {
fn process_id<Mac: SupportMachine>(&mut self, machine: &mut Mac) -> Result<(), Error> {
// TODO: charge cycles
machine.set_register(A0, Mac::REG::from_u64(self.id));
Ok(())
Expand Down Expand Up @@ -509,7 +507,7 @@ impl<
// than currently assigned syscall numbers for spawn calls
2601 => self.spawn(machine),
2602 => self.wait(machine),
2603 => self.instance_id(machine),
2603 => self.process_id(machine),
2604 => self.pipe(machine),
2605 => self.pipe_write(machine),
2606 => self.pipe_read(machine),
Expand Down
4 changes: 1 addition & 3 deletions script/src/v2_types.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// Core data structures here

use crate::ScriptGroup;
use ckb_traits::{CellDataProvider, ExtensionProvider, HeaderProvider};
use ckb_types::core::{cell::ResolvedTransaction, Cycle};
Expand Down Expand Up @@ -69,7 +67,7 @@ pub struct SpawnArgs {
pub length: u64,
pub argv: Vec<Bytes>,
pub pipes: Vec<PipeId>,
pub instance_id_addr: u64,
pub process_id_addr: u64,
}

#[derive(Clone, Debug)]
Expand Down
Loading